-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (34 loc) · 1011 Bytes
/
lint-and-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: lint-and-test
on: [push]
jobs:
lint:
name: Run ShellCheck
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install ShellCheck
run: sudo apt-get install shellcheck
- name: Find shell scripts with \#!/bin/sh and run ShellCheck
run: |
files=$(find . -type f ! -path '*/\.*' -exec grep -lE '^#!(/usr)?/bin/sh' {} +)
if [ -n "$files" ]; then
shellcheck -a -S warning -s sh $files
else
echo "No shell scripts with #!/bin/sh shebang found."
fi
test:
name: Run shellspec
runs-on: ubuntu-latest
steps:
- name: Install shellspec
run: |
cd ~
wget https://github.com/shellspec/shellspec/archive/0.28.1.tar.gz
tar xzvf 0.28.1.tar.gz
mkdir ~/.local/bin
ln -s ~/shellspec-0.28.1/bin/shellspec ~/.local/bin/
- name: Check out code
uses: actions/checkout@v4
- name: Run shellspec
run: shellspec