Skip to content

Commit e83424f

Browse files
authored
Create ci.yml
1 parent 0be9f0e commit e83424f

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# .github/workflows/ci.yml
2+
name: CI
3+
4+
on:
5+
push:
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ci-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
shellcheck:
17+
name: ShellCheck
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v6 # :contentReference[oaicite:0]{index=0}
22+
- name: Run ShellCheck
23+
uses: ludeeus/action-shellcheck@2.0.0 # :contentReference[oaicite:1]{index=1}
24+
25+
bats:
26+
name: Bats (${{ matrix.os }})
27+
runs-on: ${{ matrix.os }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
os: [ubuntu-latest, macos-latest]
32+
defaults:
33+
run:
34+
shell: bash
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v6 # :contentReference[oaicite:2]{index=2}
38+
39+
- name: Setup Bats and bats libs
40+
id: setup-bats
41+
uses: bats-core/bats-action@3.0.1 # :contentReference[oaicite:3]{index=3}
42+
43+
- name: Run Bats tests
44+
env:
45+
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
46+
TERM: xterm
47+
run: |
48+
set -euo pipefail
49+
if [[ -d "test" || -d "tests" ]]; then
50+
args=()
51+
[[ -d "test" ]] && args+=("test")
52+
[[ -d "tests" ]] && args+=("tests")
53+
bats -r "${args[@]}"
54+
else
55+
echo "No ./test or ./tests directory found (expected Bats tests there)."
56+
exit 1
57+
fi

0 commit comments

Comments
 (0)