diff --git a/.github/workflows/reusable-zsh-ci.yml b/.github/workflows/reusable-zsh-ci.yml new file mode 100644 index 000000000..780c091de --- /dev/null +++ b/.github/workflows/reusable-zsh-ci.yml @@ -0,0 +1,44 @@ +--- +name: Reusable Zsh CI + +"on": + workflow_call: {} + +jobs: + zsh-ci: + runs-on: ubuntu-latest + steps: + - name: ⤵️ Check out code from GitHub + uses: actions/checkout@v4.2.2 + + - name: ⚡ Install Zsh + run: sudo apt update && sudo apt-get install -yq zsh + + - name: ⚡ zsh -n on all .zsh files + run: | + set -euo pipefail + mapfile -d '' files < <( + find . -type d -name 'doc' -prune -o -type f -name '*.zsh' -print0 + ) + if [ "${#files[@]}" -eq 0 ]; then + echo "ERROR: No .zsh files found to validate." >&2 + exit 1 + fi + for file in "${files[@]}"; do + zsh -n "${file}" + done + + - name: ⚡ zcompile all .zsh files + run: | + set -euo pipefail + mapfile -d '' files < <( + find . -type d -name 'doc' -prune -o -type f -name '*.zsh' -print0 + ) + if [ "${#files[@]}" -eq 0 ]; then + echo "ERROR: No .zsh files found to compile." >&2 + exit 1 + fi + for file in "${files[@]}"; do + zsh -fc 'zcompile -- "$1"' zsh "${file}" + ls -al "${file}.zwc" + done diff --git a/.github/workflows/zsh-n.yml b/.github/workflows/zsh-n.yml index 0995718fd..50a485ea5 100644 --- a/.github/workflows/zsh-n.yml +++ b/.github/workflows/zsh-n.yml @@ -1,6 +1,7 @@ --- name: "✅ Zsh" on: + workflow_call: {} push: paths: - "**/*.zsh"