ci: add shellcheck linting for shell scripts

Add shellcheck to CI pipeline to ensure shell scripts follow best practices
and catch common errors. Fix existing shellcheck warnings in test scripts
to pass the new linting requirements.
This commit is contained in:
Bryan Lee
2025-07-10 23:16:23 +08:00
parent 1172332621
commit cbb3f6f64f
6 changed files with 42 additions and 7 deletions

View File

@@ -31,6 +31,7 @@ jobs:
- prettier
- alejandra
- typos
- shellcheck
- translations
- blueprint-compiler
- test-pkg-linux
@@ -778,6 +779,40 @@ jobs:
- name: typos check
run: nix develop -c typos
shellcheck:
if: github.repository == 'ghostty-org/ghostty'
runs-on: namespace-profile-ghostty-xsm
timeout-minutes: 60
env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Cache
uses: namespacelabs/nscloud-cache-action@449c929cd5138e6607e7e78458e88cc476e76f89 # v1.2.8
with:
path: |
/nix
/zig
- uses: cachix/install-nix-action@cebd211ec2008b83bda8fb0b21c3c072f004fe04 # v31.5.0
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
with:
name: ghostty
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
skipPush: true
useDaemon: false # sometimes fails on short jobs
- name: shellcheck
run: |
nix develop -c shellcheck \
--check-sourced \
--color=always \
--severity=warning \
--shell=bash \
--external-sources \
$(find . \( -name "*.sh" -o -name "*.bash" \) -type f ! -path "./zig-out/*" ! -path "./macos/build/*" ! -path "./.git/*" | sort)
translations:
if: github.repository == 'ghostty-org/ghostty'
runs-on: namespace-profile-ghostty-xsm