-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (84 loc) · 2.35 KB
/
bats_tests.yml
File metadata and controls
104 lines (84 loc) · 2.35 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Bats Tests
on:
pull_request:
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-bats-tests
cancel-in-progress: true
jobs:
actionlint:
name: Validate GitHub Workflows (actionlint)
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install actionlint
run: |
ACTIONLINT_VERSION="1.7.7"
curl -sSfL "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" \
| tar -xz
sudo mv actionlint /usr/local/bin/actionlint
actionlint -version
- name: Run Workflow Linter
run: actionlint
shellcheck:
name: Lint Shell Scripts (shellcheck)
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install shellcheck
run: |
sudo apt-get update -y
sudo apt-get install -y shellcheck
- name: Run Shell Linter
run: shellcheck scripts/*.sh
shfmt:
name: Check Shell Formatting (shfmt)
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install shfmt
run: |
sudo apt-get update -y
sudo apt-get install -y shfmt
- name: Run Shell Formatter Check
run: git ls-files '*.sh' '*.bash' '*.bats' | xargs shfmt -d -i 4 -ci
bats:
name: Run Shell Test Suite (bats)
needs:
- shellcheck
- shfmt
- actionlint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install bats (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install -y bats
- name: Install bats (macOS)
if: runner.os == 'macOS'
run: brew install bats-core
- name: Run bats Test Suite
run: bats --recursive tests/bats