refactor: extract inline bash into testable scripts with CI pipeline #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| shellcheck: | |
| name: Shellcheck | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Run shellcheck on all scripts | |
| run: find scripts/ -name '*.sh' -exec shellcheck --severity=warning {} + | |
| test: | |
| name: Bash Tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install bats and helpers | |
| run: | | |
| sudo npm install -g bats | |
| git clone --depth 1 https://github.com/bats-core/bats-support.git tests/test_helper/bats-support | |
| git clone --depth 1 https://github.com/bats-core/bats-assert.git tests/test_helper/bats-assert | |
| - name: Run tests | |
| run: bats tests/*.bats | |
| validate-action: | |
| name: Validate Action Structure | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Verify all referenced scripts exist | |
| run: | | |
| grep -oP 'github\.action_path \}\}/\K[^ "]+' action.yml | while read -r script; do | |
| if [[ ! -f "$script" ]]; then | |
| echo "::error::Script referenced in action.yml does not exist: $script" | |
| exit 1 | |
| fi | |
| done | |
| - name: Verify scripts are executable | |
| run: | | |
| find scripts/ -name '*.sh' | while read -r script; do | |
| if [[ ! -x "$script" ]]; then | |
| echo "::error::Script is not executable: $script" | |
| exit 1 | |
| fi | |
| done |