Skip to content

Commit b003a25

Browse files
committed
ci: update workflows and trunk configuration
- Bump actions/checkout to v6.0.2 and shellcheck to 2.0.0 - Add lib/zsh/** and tests/** to push/PR path triggers - Add permissions: contents: read and timeout-minutes: 10 - Use github.ref in concurrency group - Replace ~/.zi hard-coded paths with XDG_DATA_HOME equivalents - Add unit-fixture step calling tests/installers.sh - Remove wrangler deploy job; update trunk linter config
1 parent d8eabf7 commit b003a25

7 files changed

Lines changed: 127 additions & 50 deletions

File tree

.github/workflows/check-linux.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,34 @@ on:
55
branches: [main]
66
paths:
77
- "lib/sh/**"
8+
- "lib/zsh/**"
9+
- "tests/**"
10+
- ".github/workflows/check-linux.yml"
811
pull_request:
912
branches: [main]
1013
paths:
1114
- "lib/sh/**"
15+
- "lib/zsh/**"
16+
- "tests/**"
17+
- ".github/workflows/check-linux.yml"
1218
workflow_dispatch:
1319

20+
permissions:
21+
contents: read
22+
1423
concurrency:
15-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24+
group: ${{ github.workflow }}-${{ github.ref }}
1625
cancel-in-progress: true
1726

1827
jobs:
1928
shellcheck:
2029
runs-on: ubuntu-latest
30+
timeout-minutes: 10
2131
steps:
2232
- name: ⤵️ Check out code from GitHub
23-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
33+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2434
- name: ☑️ ShellCheck
25-
uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca
35+
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
2636
with:
2737
scandir: "./lib/sh"
2838

@@ -32,24 +42,26 @@ jobs:
3242
needs: [shellcheck]
3343
steps:
3444
- name: ⤵️ Check out code from GitHub
35-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
45+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3646
- name: ⚙️ Prepare dependencies
3747
run: |
3848
sudo apt-get update
3949
sudo apt-get install -y zsh
50+
- name: "⚙️ Check: unit fixtures"
51+
run: sh ./tests/installers.sh
4052
- name: "⚙️ Check: install.sh -- -i skip"
41-
run: sh -x ./lib/sh/install.sh -- -i skip; command rm -rf ~/.zi
42-
- name: "⚙️ Check: install.sh -- -i annex"
43-
run: sh -x ./lib/sh/install.sh -- -a annex; command rm -rf ~/.zi
44-
- name: "⚙️ Check: install.sh -- -i loader"
45-
run: sh -x ./lib/sh/install.sh -- -a loader; command rm -rf ~/.zi
46-
- name: "⚙️ Check: install.sh -- -i zunit"
47-
run: sh -x ./lib/sh/install.sh -- -a zunit; command rm -rf ~/.zi
53+
run: sh -x ./lib/sh/install.sh -- -i skip; command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" ~/.zi
54+
- name: "⚙️ Check: install.sh -- -a annex"
55+
run: sh -x ./lib/sh/install.sh -- -a annex; command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" ~/.zi
56+
- name: "⚙️ Check: install.sh -- -a loader"
57+
run: sh -x ./lib/sh/install.sh -- -a loader; command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" ~/.zi
58+
- name: "⚙️ Check: install.sh -- -a zunit"
59+
run: sh -x ./lib/sh/install.sh -- -a zunit; command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" ~/.zi
4860
- name: "⚙️ Check: install_zpmod.sh"
4961
run: sh -x ./lib/sh/install_zpmod.sh
5062
- name: ⚙️ Load zpmod module
5163
run: |
52-
module_path+=( "$HOME/.zi/zmodules/zpmod/Src" )
64+
module_path+=( "${XDG_DATA_HOME:-$HOME/.local/share}/zi/zmodules/zpmod/Src" )
5365
zmodload zi/zpmod
5466
zpmod source-study -l
5567
shell: zsh {0}

.github/workflows/check-macos.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,62 @@ on:
66
branches: [main]
77
paths:
88
- "lib/sh/**"
9+
- "lib/zsh/**"
10+
- "tests/**"
11+
- ".github/workflows/check-macos.yml"
912
pull_request:
1013
branches: [main]
1114
paths:
1215
- "lib/sh/**"
16+
- "lib/zsh/**"
17+
- "tests/**"
18+
- ".github/workflows/check-macos.yml"
1319
workflow_dispatch:
1420

21+
permissions:
22+
contents: read
23+
1524
concurrency:
16-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
25+
group: ${{ github.workflow }}-${{ github.ref }}
1726
cancel-in-progress: true
1827

1928
jobs:
2029
shellcheck:
2130
runs-on: ubuntu-latest
31+
timeout-minutes: 10
2232
steps:
2333
- name: ⤵️ Check out code from GitHub
24-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
34+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2535
- name: ☑️ ShellCheck
26-
uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca
36+
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
2737
with:
2838
scandir: "./lib/sh"
2939

3040
build:
31-
runs-on: ubuntu-latest
41+
runs-on: macos-latest
3242
timeout-minutes: 30
3343
needs: [shellcheck]
3444
steps:
3545
- name: ⤵️ Check out code from GitHub
36-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
46+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3747
- name: ⚙️ Prepare dependencies
3848
run: |
3949
brew install zsh
50+
- name: "⚙️ Check: unit fixtures"
51+
run: sh ./tests/installers.sh
4052
- name: "⚙️ Check: install.sh -- -i skip"
41-
run: sh -x ./lib/sh/install.sh -- -i skip; command rm -rf ~/.zi
42-
- name: "⚙️ Check: install.sh -- -i annex"
43-
run: sh -x ./lib/sh/install.sh -- -a annex; command rm -rf ~/.zi
44-
- name: "⚙️ Check: install.sh -- -i loader"
45-
run: sh -x ./lib/sh/install.sh -- -a loader; command rm -rf ~/.zi
46-
- name: "⚙️ Check: install.sh -- -i zunit"
47-
run: sh -x ./lib/sh/install.sh -- -a zunit; command rm -rf ~/.zi
53+
run: sh -x ./lib/sh/install.sh -- -i skip; command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" ~/.zi
54+
- name: "⚙️ Check: install.sh -- -a annex"
55+
run: sh -x ./lib/sh/install.sh -- -a annex; command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" ~/.zi
56+
- name: "⚙️ Check: install.sh -- -a loader"
57+
run: sh -x ./lib/sh/install.sh -- -a loader; command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" ~/.zi
58+
- name: "⚙️ Check: install.sh -- -a zunit"
59+
run: sh -x ./lib/sh/install.sh -- -a zunit; command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" ~/.zi
4860
- name: "⚙️ Check: install_zpmod.sh"
4961
run: sh -x ./lib/sh/install_zpmod.sh
5062
- name: ⚙️ Load zpmod module
5163
run: |
52-
module_path+=( "$HOME/.zi/zmodules/zpmod/Src" )
64+
module_path+=( "${XDG_DATA_HOME:-$HOME/.local/share}/zi/zmodules/zpmod/Src" )
5365
zmodload zi/zpmod
5466
zpmod source-study -l
5567
shell: zsh {0}

.github/workflows/checksum.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,30 @@ name: "🆗 Checksum"
33
on:
44
push:
55
paths:
6-
- "lib/**"
6+
- "lib/sh/install_zpmod.sh"
7+
- "lib/sh/install.sh"
8+
- "lib/sh/sync-init.sh"
9+
- "lib/zsh/init.zsh"
10+
- ".github/workflows/checksum.yml"
711
workflow_dispatch: {}
812

13+
permissions:
14+
contents: write
15+
916
jobs:
1017
checksum:
18+
if: github.repository == 'z-shell/zi-src'
1119
runs-on: ubuntu-latest
20+
timeout-minutes: 10
1221
steps:
13-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1423
- name: "🆗 Generate checksum"
15-
uses: jmgilman/actions-generate-checksum@521a903edf511407d8bd5535d257402fd9bb5db0
24+
uses: jmgilman/actions-generate-checksum@3ea6dc9bf8eecf28e2ecc982fab683484a1a8561 # v1.0.1
1625
with:
1726
patterns: |
1827
lib/sh/install_zpmod.sh
1928
lib/sh/install.sh
29+
lib/sh/sync-init.sh
2030
lib/zsh/init.zsh
2131
- run: mv checksum.txt lib/
2232
- name: "🆗 Commit"

.github/workflows/deploy-gh-pages.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,35 @@ on:
88
tags: ["v*.*.*"]
99
paths:
1010
- "lib/**"
11+
- ".github/workflows/deploy-gh-pages.yml"
12+
13+
permissions:
14+
contents: write
1115

1216
jobs:
1317
deploy:
18+
if: github.repository == 'z-shell/zi-src'
1419
environment:
1520
name: github-pages
1621
runs-on: ubuntu-latest
22+
timeout-minutes: 15
1723
concurrency:
1824
group: ${{ github.workflow }}-${{ github.ref }}
1925
steps:
2026
- name: ⤵️ Check out code from GitHub
21-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
- name: "🏷 Prepare deployment metadata"
29+
id: prepare_deploy
30+
run: |
31+
commit_message="$(jq -r '.head_commit.message // empty' "$GITHUB_EVENT_PATH")"
32+
if [ -z "$commit_message" ]; then
33+
commit_message="Deploy ${GITHUB_REF_NAME}"
34+
fi
35+
{
36+
echo "commit_message<<DEPLOY_MESSAGE"
37+
printf '%s\n' "$commit_message"
38+
echo "DEPLOY_MESSAGE"
39+
} >> "$GITHUB_OUTPUT"
2240
- name: "🏷 Prepare tag"
2341
id: prepare_tag
2442
if: startsWith(github.ref, 'refs/tags/')
@@ -34,6 +52,6 @@ jobs:
3452
publish_dir: ./lib
3553
user_name: ${{ secrets.ACTIONS_USER }}
3654
user_email: ${{ secrets.ACTIONS_MAIL }}
37-
commit_message: ${{ github.event.head_commit.message }}
55+
commit_message: ${{ steps.prepare_deploy.outputs.commit_message }}
3856
tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
3957
tag_message: "Deployment ${{ steps.prepare_tag.outputs.tag_name }}"

.github/workflows/rclone-action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ on:
55
branches: [main]
66
paths:
77
- "lib/**"
8+
- ".github/workflows/rclone-action.yml"
89
workflow_dispatch: {}
910

11+
permissions:
12+
contents: read
13+
1014
concurrency:
1115
group: ${{ github.workflow }}-${{ github.ref }}
1216
cancel-in-progress: true
@@ -15,14 +19,15 @@ jobs:
1519
sync:
1620
if: github.repository == 'z-shell/zi-src'
1721
runs-on: ubuntu-latest
22+
timeout-minutes: 15
1823
env:
1924
local_path: "lib"
2025
remote_path: "r2:r2-store/src"
2126
steps:
2227
- name: "⤵️ Check out code from GitHub"
23-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2429
- name: "⏫ Run rclone/r2-store"
25-
uses: z-shell/.github/actions/rclone@v1
30+
uses: z-shell/.github/actions/rclone@91068ee88e8788deff439d6ee36b77329edeb98a # v1.0.8
2631
with:
2732
config: ${{ secrets.R2_STORE }}
2833
args: "copy --check-first ${{ env.local_path }} ${{ env.remote_path }}"

.github/workflows/win-install.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,28 @@ on:
55
pull_request:
66
paths:
77
- "lib/sh/**"
8+
- "lib/zsh/**"
9+
- "tests/**"
810
- ".github/workflows/win-install.yml"
911
push:
1012
paths:
1113
- "lib/sh/**"
14+
- "lib/zsh/**"
15+
- "tests/**"
1216
- ".github/workflows/win-install.yml"
1317
workflow_dispatch: {}
1418

19+
permissions:
20+
contents: read
21+
1522
jobs:
1623
shellcheck:
1724
runs-on: ubuntu-latest
25+
timeout-minutes: 10
1826
steps:
19-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2028
- name: ☑️ ShellCheck
21-
uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca
29+
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
2230
with:
2331
scandir: "./lib/sh"
2432
run-install:
@@ -33,21 +41,22 @@ jobs:
3341
run: |
3442
git config --global core.autocrlf input
3543
git config --global --add safe.directory /cygdrive/d/a/zi-src/zi-src
36-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
44+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3745
- name: 🪟 Dependencies (Windows)
38-
uses: egor-tensin/setup-cygwin@d2c752bab416d4b0662591bd366fc2686297c82d # v4
46+
uses: egor-tensin/setup-cygwin@d2c752bab416d4b0662591bd366fc2686297c82d # v4.0.1
3947
with:
4048
platform: x64
4149
packages: curl git zsh
4250
- name: 🪟 Run Install
4351
run: |
52+
sh ./tests/installers.sh
4453
sh -x ./lib/sh/install.sh -- -i skip
45-
command rm -rf /home/runneradmin/.zi
54+
command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" /home/runneradmin/.zi
4655
sh -x ./lib/sh/install.sh -- -a annex
47-
command rm -rf /home/runneradmin/.zi
56+
command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" /home/runneradmin/.zi
4857
sh -x ./lib/sh/install.sh -- -a loader
49-
command rm -rf /home/runneradmin/.zi
58+
command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" /home/runneradmin/.zi
5059
sh -x ./lib/sh/install.sh -- -a zunit
51-
command rm -rf /home/runneradmin/.zi
60+
command rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zi" /home/runneradmin/.zi
5261
sh -x ./lib/sh/install.sh -- -a zpmod
5362
shell: C:\tools\cygwin\bin\bash.exe --login -o igncr '{0}'

.trunk/trunk.yaml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
version: 0.1
22
cli:
3-
version: 1.22.11
3+
version: 1.25.0
44
plugins:
55
sources:
66
- id: trunk
7-
ref: v1.6.7
7+
ref: v1.10.0
88
uri: https://github.com/trunk-io/plugins
99
repo:
1010
repo:
1111
host: github.com
1212
owner: z-shell
1313
name: zi-src
1414
lint:
15+
definitions:
16+
- name: shfmt
17+
commands:
18+
- name: format
19+
output: shfmt
20+
run: shfmt -w -s -ln=bash -i 2 ${target}
21+
success_codes: [0, 1]
22+
cache_results: true
23+
formatter: true
24+
batch: true
25+
in_place: true
1526
disabled:
1627
- yamllint
1728
- trufflehog
@@ -20,13 +31,13 @@ lint:
2031
- trivy
2132
enabled:
2233
- git-diff-check@SYSTEM
23-
- actionlint@1.7.7
24-
- gitleaks@8.24.0
25-
- markdownlint@0.44.0
26-
- prettier@3.5.3
27-
- shellcheck@0.10.0
34+
- actionlint@1.7.12
35+
- gitleaks@8.30.1
36+
- markdownlint@0.48.0
37+
- prettier@3.8.3
38+
- shellcheck@0.11.0
2839
- shfmt@3.6.0
29-
- taplo@0.9.3
40+
- taplo@0.10.0
3041
actions:
3142
enabled:
3243
- trunk-announce
@@ -36,6 +47,6 @@ actions:
3647
- trunk-cache-prune
3748
runtimes:
3849
enabled:
39-
- python@3.10.8
50+
- python@3.14.4
4051
- go@1.21.0
41-
- node@18.20.5
52+
- node@22.16.0

0 commit comments

Comments
 (0)