Skip to content

Commit 2cab09d

Browse files
committed
Add CI workflow with shellcheck, bash -n, and bats gates
GitHub Actions workflow on pull_request and push to main / dev with two jobs: - lint: runs shellcheck at warning severity and bash -n on every .sh file in the repo - bats: installs bats jq curl python3 and runs the test suite Pinned ubuntu-24.04 runner. actions/checkout pinned to commit SHA 34e114876b0b11c390a56381ad16ebd13914f8d5 (v4.3.1) for supply-chain hygiene; persist-credentials false drops the GITHUB_TOKEN from local git after checkout. permissions: contents read at workflow level. 10-minute timeout per job. Verified locally by replicating the workflow steps inside a clean docker run --rm ubuntu:24.04 container; all 25 bats tests pass and shellcheck reports zero warnings.
1 parent 8a5a30e commit 2cab09d

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main, dev]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
lint:
13+
name: shellcheck + bash -n
14+
runs-on: ubuntu-24.04
15+
timeout-minutes: 10
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
19+
with:
20+
persist-credentials: false
21+
22+
- name: Install shellcheck
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y shellcheck
26+
27+
- name: Run shellcheck (warning severity)
28+
run: |
29+
find . -name '*.sh' -not -path './.git/*' -print0 \
30+
| xargs -0 shellcheck -S warning
31+
32+
- name: Run bash syntax check
33+
run: |
34+
find . -name '*.sh' -not -path './.git/*' -print0 \
35+
| xargs -0 -n1 bash -n
36+
37+
test:
38+
name: bats
39+
runs-on: ubuntu-24.04
40+
timeout-minutes: 10
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
44+
with:
45+
persist-credentials: false
46+
47+
- name: Install bats, jq, curl, python3
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y bats jq curl python3
51+
52+
- name: Run bats suite
53+
run: bats test/

0 commit comments

Comments
 (0)