Skip to content

Commit 6239d64

Browse files
committed
ci: Add Zsh CI workflow
This commit adds a new GitHub Actions workflow named "Zsh" to perform continuous integration for Zsh files in the repository. The workflow is triggered on push events to the "main" branch and for tags following the "v*.*.*" pattern. It also runs on pull requests that modify Zsh files or files in the "functions" directory. The workflow consists of two jobs: 1. "zsh-matrix": This job sets up a matrix of Zsh files based on the files in the repository. It uses the `find` command combined with `jq` to identify and set the Zsh files for the matrix. 2. "zsh-n": This job runs the Zsh linter (`zsh -n`) and the Zsh compiler (`zcompile`) for each file in the matrix created by the previous job. This new workflow will help ensure the quality and correctness of Zsh files in the repository, providing early feedback on potential issues. It will promote better code reliability and maintainability in Zsh scripts. Signed-off-by: Salvydas Lukosius <ss-o@users.noreply.github.com>
1 parent dec393f commit 6239d64

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/check_zsh.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: "✅ Zsh"
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*.*.*"]
7+
paths:
8+
- "*.zsh"
9+
- "*.lzui"
10+
- "functions/*"
11+
pull_request:
12+
paths:
13+
- "*.zsh"
14+
- "*.lzui"
15+
- "functions/*"
16+
workflow_dispatch: {}
17+
18+
jobs:
19+
zsh-matrix:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
output1: ${{ steps.set-matrix.outputs.files }}
23+
steps:
24+
- name: "⤵️ Check out code from GitHub"
25+
uses: actions/checkout@v4
26+
- name: "Set matrix output"
27+
id: set-matrix
28+
run: |
29+
MATRIX="$(find . -type d -name 'doc' -prune -o -type f \( -iname '*.zsh' -o -iname '*.lzui' -o -iname 'zui-*' -o -iname '-zui-*' \) -print | jq -ncR '{"include": [{"file": inputs}]}')"
30+
echo "files=${MATRIX}" >> $GITHUB_OUTPUT
31+
32+
zsh-n:
33+
runs-on: ubuntu-latest
34+
needs: zsh-matrix
35+
strategy:
36+
fail-fast: false
37+
matrix: ${{ fromJSON(needs.zsh-matrix.outputs.output1) }}
38+
steps:
39+
- name: ⤵️ Check out code from GitHub
40+
uses: actions/checkout@v4
41+
- name: "⚡ Install dependencies"
42+
run: sudo apt update && sudo apt-get install -yq zsh
43+
- name: "⚡ zsh -n: ${{ matrix.file }}"
44+
env:
45+
ZSH_FILE: ${{ matrix.file }}
46+
run: |
47+
zsh -n "${ZSH_FILE}"
48+
- name: "⚡ zcompile ${{ matrix.file }}"
49+
env:
50+
ZSH_FILE: ${{ matrix.file }}
51+
run: |
52+
zsh -fc "zcompile ${ZSH_FILE}"; rc=$?
53+
ls -al "${ZSH_FILE}.zwc"; exit "$rc"

0 commit comments

Comments
 (0)