Skip to content

Commit 18bc422

Browse files
authored
Merge pull request #132 from Staffbase/refactor/extract-scripts-and-tests
refactor: extract inline bash into testable scripts with CI pipeline
2 parents cf4adf5 + 8e6fd8d commit 18bc422

19 files changed

Lines changed: 1482 additions & 312 deletions

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
name: Shellcheck
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19+
20+
- name: Install mise
21+
uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2
22+
23+
- name: Run shellcheck
24+
run: mise run lint
25+
26+
test:
27+
name: Bash Tests
28+
runs-on: ubuntu-24.04
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+
33+
- name: Install mise
34+
uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2
35+
36+
- name: Run tests
37+
run: mise run test
38+
39+
validate-action:
40+
name: Validate Action Structure
41+
runs-on: ubuntu-24.04
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45+
46+
- name: Verify all referenced scripts exist
47+
run: |
48+
grep -oP 'github\.action_path \}\}/\K[^ "]+' action.yml | while read -r script; do
49+
if [[ ! -f "$script" ]]; then
50+
echo "::error::Script referenced in action.yml does not exist: $script"
51+
exit 1
52+
fi
53+
done
54+
55+
- name: Verify scripts are executable
56+
run: |
57+
find scripts/ -name '*.sh' | while read -r script; do
58+
if [[ ! -x "$script" ]]; then
59+
echo "::error::Script is not executable: $script"
60+
exit 1
61+
fi
62+
done

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
# Intellij
22
.idea/*
3+
4+
# Node
5+
node_modules/
6+
package.json
7+
package-lock.json
8+
9+
# Test helper libraries (installed during CI/local setup)
10+
tests/test_helper/bats-support/
11+
tests/test_helper/bats-assert/
12+
13+
# Test artifacts
14+
headers.txt

.shellcheckrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shell=bash
2+
external-sources=true

0 commit comments

Comments
 (0)