test: make Bats tests self-contained (no external helpers) #11
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: lint | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # allow git-describe etc. to work later | |
| - name: Install ShellCheck | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y shellcheck | |
| - name: Run ShellCheck | |
| run: | | |
| # Lint only POSIX‑compatible shell scripts; ShellCheck | |
| # doesn’t understand pure zsh files. | |
| sh_files=$(git ls-files '*.sh') | |
| if [ -n "$sh_files" ]; then | |
| shellcheck $sh_files | |
| else | |
| echo "No .sh files to lint" | |
| fi | |
| - name: Set up Bats | |
| uses: mig4/setup-bats@v1 | |
| - name: Run Bats tests | |
| run: bats test |