Skip to content

Commit e53c4fb

Browse files
authored
Refactor installer scripts and update CI workflows (#160)
* chore: remove deprecated files and configs Remove obsolete cspell word lists, editorconfig, vscode settings, and retired workflows (rebase, stale, sync-labels, wrangler). Drop legacy installer scripts i.sh and install_alpha.sh. * 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 * feat: add sync-init.sh and tests/installers.sh sync-init.sh verifies (and optionally replaces) the local lib/zsh/init.zsh against the canonical GitHub raw main copy. Supports --write, --local, --remote, --checksum-url and --no-checksum flags. tests/installers.sh provides a POSIX sh test suite covering: - script syntax validation (sh -n / zsh -n) - checksum integrity checks - loader install with XDG path and branch-override assertions - standalone zpmod delegation test - sync-init fixture round-trip test * refactor: migrate installer scripts to XDG paths and harden POSIX install.sh: - Add set -eu; use WORKDIR=$(mktemp -d) with safe trap cleanup - Replace ~/.zi with XDG_DATA_HOME-aware path - Fix sed command for ZI[STREAM] substitution - Correct cd fallback from return to exit 1 - Guard branch pull with BOPT; add exit 1 on failed clone - Fix .zshrc loader snippet variable quoting install_zpmod.sh: - Add set -eu, file header and WORKDIR trap - Add pure-POSIX _zi_ver_ge() replacing expr string comparison - Honour XDG_DATA_HOME for ZI_HOME default - Replace exit 255 with exit 1 throughout lib/zsh/init.zsh: - Update default branch to use ZI[STREAM] parameter - Align loader paths with XDG layout * chore: update gitignore, checksums, and docs - Exclude AI agent instruction files from git tracking (AGENTS.md, CLAUDE.md, GEMINI.md, .github/copilot-instructions.md) - Add .geminiignore - Regenerate lib/checksum.txt to reflect updated scripts - Document sync-init.sh usage in docs/README.md - Remove deprecated git.io short URLs from README * ci(check-linux): add init.zsh sync-drift detection step * fix(install.sh): verify zi.zsh exists after clone, not just directory * ci: add concurrency to checksum.yml; add smoke-test to win-install.yml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: rename repo references from zi-src to src Update all internal references to reflect the repository rename: - .trunk/trunk.yaml repo name - workflow repository guards (checksum, rclone-action, deploy-gh-pages) - win-install safe.directory path - docs/README.md VSCode and jsDelivr URLs * ci: add org project tracker scripts (label sync + workflow rollout) * fix(ci): continue label sync after repo failures * chore: fix lint issues and syntax errors reported by trunk --------- Co-authored-by: Salvydas Lukosius <ss-o@users.noreply.github.com>
1 parent 97d66b0 commit e53c4fb

31 files changed

Lines changed: 1541 additions & 1564 deletions

.cspell/project-words.txt

Lines changed: 0 additions & 45 deletions
This file was deleted.

.editorconfig

Lines changed: 0 additions & 60 deletions
This file was deleted.

.geminiignore

Whitespace-only changes.

.github/.cspell/project-ignored.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/.cspell/project-usernames.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/.cspell/project-words.txt

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/check-linux.yml

Lines changed: 26 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,28 @@ 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}
68+
- name: "⚙️ Check: init.zsh sync drift"
69+
run: sh lib/sh/sync-init.sh

.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: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,34 @@ 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+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: false
19+
920
jobs:
1021
checksum:
22+
if: github.repository == 'z-shell/src'
1123
runs-on: ubuntu-latest
24+
timeout-minutes: 10
1225
steps:
13-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1427
- name: "🆗 Generate checksum"
15-
uses: jmgilman/actions-generate-checksum@521a903edf511407d8bd5535d257402fd9bb5db0
28+
uses: jmgilman/actions-generate-checksum@3ea6dc9bf8eecf28e2ecc982fab683484a1a8561 # v1.0.1
1629
with:
1730
patterns: |
1831
lib/sh/install_zpmod.sh
1932
lib/sh/install.sh
33+
lib/sh/sync-init.sh
2034
lib/zsh/init.zsh
2135
- run: mv checksum.txt lib/
2236
- 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/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 }}"

0 commit comments

Comments
 (0)