From 8519c87491ff3bdcef6f71299b43cf01a7a84134 Mon Sep 17 00:00:00 2001 From: Sal Date: Fri, 28 Aug 2026 02:13:10 +0100 Subject: [PATCH 1/3] ci(branching): migrate src to trunk on main (#192) --- .github/dependabot.yml | 1 - .github/renovate.json | 3 +-- .github/workflows/check-linux.yml | 7 ++---- .github/workflows/check-macos.yml | 7 ++---- .github/workflows/main-branch-guard.yml | 30 ------------------------- .github/workflows/zsh-lint.yml | 8 ++----- AGENTS.md | 14 +++++++++++- 7 files changed, 20 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/main-branch-guard.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fe5084b..d70a0b8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,7 +2,6 @@ version: 2 updates: - package-ecosystem: "github-actions" directory: "/" - target-branch: "next" schedule: interval: "weekly" day: "monday" diff --git a/.github/renovate.json b/.github/renovate.json index 7419125..fc1528e 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -4,6 +4,5 @@ "local>z-shell/.github:renovate-config", ":dependencyDashboardApproval", ":disableVulnerabilityAlerts" - ], - "baseBranchPatterns": ["next"] + ] } diff --git a/.github/workflows/check-linux.yml b/.github/workflows/check-linux.yml index 0b74f1a..7c027d3 100644 --- a/.github/workflows/check-linux.yml +++ b/.github/workflows/check-linux.yml @@ -10,11 +10,6 @@ on: - ".github/workflows/check-linux.yml" pull_request: branches: [main] - paths: - - "public/sh/**" - - "public/zsh/**" - - "tests/**" - - ".github/workflows/check-linux.yml" workflow_dispatch: permissions: @@ -26,6 +21,7 @@ concurrency: jobs: shellcheck: + name: Linux ShellCheck runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -37,6 +33,7 @@ jobs: scandir: "./public/sh" build: + name: Linux Installer and Loader runs-on: ubuntu-latest timeout-minutes: 30 needs: [shellcheck] diff --git a/.github/workflows/check-macos.yml b/.github/workflows/check-macos.yml index 81e87d2..21b410c 100644 --- a/.github/workflows/check-macos.yml +++ b/.github/workflows/check-macos.yml @@ -11,11 +11,6 @@ on: - ".github/workflows/check-macos.yml" pull_request: branches: [main] - paths: - - "public/sh/**" - - "public/zsh/**" - - "tests/**" - - ".github/workflows/check-macos.yml" workflow_dispatch: permissions: @@ -27,6 +22,7 @@ concurrency: jobs: shellcheck: + name: macOS ShellCheck runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -38,6 +34,7 @@ jobs: scandir: "./public/sh" build: + name: macOS Installer and Loader runs-on: macos-latest timeout-minutes: 30 needs: [shellcheck] diff --git a/.github/workflows/main-branch-guard.yml b/.github/workflows/main-branch-guard.yml deleted file mode 100644 index 4f1468e..0000000 --- a/.github/workflows/main-branch-guard.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: Main Branch Source Guard - -on: - pull_request: - branches: [main] - types: [opened, reopened, synchronize, edited] - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true - -jobs: - guard: - name: Guard main branch source - runs-on: ubuntu-latest - steps: - - name: Verify pull request source branch - env: - HEAD_REF: ${{ github.head_ref }} - run: | - if [[ "${HEAD_REF}" == "next" || "${HEAD_REF}" == hotfix-* ]]; then - echo "Head branch '${HEAD_REF}' is allowed to target main." - exit 0 - fi - echo "::error::Pull requests into main must come from 'next' or a 'hotfix-*' branch (got '${HEAD_REF}'). See ADR-0008 (z-shell/.github) for the branching model." - exit 1 diff --git a/.github/workflows/zsh-lint.yml b/.github/workflows/zsh-lint.yml index e5da31e..155831f 100644 --- a/.github/workflows/zsh-lint.yml +++ b/.github/workflows/zsh-lint.yml @@ -3,17 +3,13 @@ name: Zsh Lint on: push: - branches: [next, main] + branches: [main] paths: - "public/zsh/init.zsh" - ".github/workflows/zsh-lint.yml" - "zsh-lint.json" pull_request: - branches: [next, main] - paths: - - "public/zsh/init.zsh" - - ".github/workflows/zsh-lint.yml" - - "zsh-lint.json" + branches: [main] workflow_dispatch: {} permissions: diff --git a/AGENTS.md b/AGENTS.md index 794e7fb..cc8df9b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,18 @@ This project follows the organization-wide [Z-Shell Organization Guidelines](htt ## What this is -`src` contains the core Zi loader scripts, installer mechanisms, CDN assets, and sync utilities. +`src` contains the core Zi loader scripts, installer mechanisms, CDN assets, +and sync utilities. + +## Branching + +- This repository uses trunk-based development on `main` per organization ADR + 0019. Create short-lived branches from `main` and target pull requests to + `main`. +- Use the organization branch names `feature-`, `bug-`, or + `hotfix-`. +- Keep `main` deployable; deployment remains a separately verified workflow + result after merge. ## Conventions & Testing @@ -14,6 +25,7 @@ This project follows the organization-wide [Z-Shell Organization Guidelines](htt and, for Zsh files, the [Zsh Scripting Standard](https://github.com/z-shell/.github/blob/main/.github/instructions/zsh-scripting.instructions.md). - Verify installer and loader behavior with the repository test suite: + ```sh sh ./tests/installers.sh ``` From 9d9772db3715c622041b33f70bc21501a592bd0f Mon Sep 17 00:00:00 2001 From: Sal Date: Fri, 28 Aug 2026 02:25:17 +0100 Subject: [PATCH 2/3] fix(installer): support zpmod CMake builds --- public/checksum.txt | 2 +- public/sh/install_zpmod.sh | 46 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/public/checksum.txt b/public/checksum.txt index 899313f..8476b1e 100644 --- a/public/checksum.txt +++ b/public/checksum.txt @@ -1,4 +1,4 @@ -0140801e80b2d8767e95d215850b6feab3642ee2b6fd70fbf4aab09afcfe7fca public/sh/install_zpmod.sh +4e9c5dd538feea312c094a00a826c5949b74e555450f42ab0e0d370e76d6e1c5 public/sh/install_zpmod.sh 6ee1ced1b73ab9d6f8a17e26505dd5de588b2a0af2832603ae04eb2866763ed9 public/sh/install.sh 08cc893ceb982fc99d17db1966c6c30790cc571e16e4f5392352d995f5252952 public/sh/sync-init.sh 424d66dca9bc26dd225afa45ccf15e42c8cf1f9e5e68fa51b469969bb5d51901 public/zsh/init.zsh diff --git a/public/sh/install_zpmod.sh b/public/sh/install_zpmod.sh index 9cda7df..bcaa027 100755 --- a/public/sh/install_zpmod.sh +++ b/public/sh/install_zpmod.sh @@ -53,8 +53,10 @@ setup_zpmod_repository() { cd "${MOD_HOME}" || exit 1 git pull -q origin main else - git clone --depth 10 -q https://github.com/z-shell/zpmod.git "${MOD_HOME}" + git clone --depth 10 --recurse-submodules --shallow-submodules -q \ + https://github.com/z-shell/zpmod.git "${MOD_HOME}" fi + git -C "${MOD_HOME}" submodule update --init --recursive -q } build_zpmod_module() { @@ -70,8 +72,48 @@ build_zpmod_module() { ( printf '%s\n' "${col_info2}-- Zsh version ${ZSH_CURRENT} --${col_rst}" cd "${MOD_HOME}" || exit 1 - printf '%s\n' "${col_pname}== Building module ZPMOD, running: a make clean, then ./configure and then make ==${col_rst}" printf '%s\n' "${col_pname}== The module sources are located at: ${MOD_HOME} ==${col_rst}" + if test -f CMakeLists.txt; then + printf '%s\n' "${col_pname}== Building module ZPMOD with CMake ==${col_rst}" + _clean_arg="" + if [ "${1-}" = "--clean" ]; then + _clean_arg="--clean" + fi + # shellcheck disable=SC2086 + zsh ./scripts/cmake.configure.zsh \ + --generator make --build-type Release -j 4 ${_clean_arg} + + _staged_file="" + for _candidate in \ + build-cmake/stage/lib/zsh/site-modules/zpmod.so \ + build-cmake/stage/lib/zsh/site-modules/zpmod.bundle \ + build-cmake/stage/lib/zsh/site-modules/zpmod.dylib \ + build-cmake/stage/lib/zsh/site-modules/zpmod.dll \ + build-cmake/out/lib/zpmod.so \ + build-cmake/out/lib/zpmod.bundle \ + build-cmake/out/lib/zpmod.dylib \ + build-cmake/out/lib/zpmod.dll + do + if test -f "${_candidate}"; then + _staged_file="${_candidate}" + break + fi + done + if [ -z "${_staged_file}" ]; then + printf '%s\n' "${col_error}Module artifact was not produced.${col_rst}" + exit 1 + fi + + mkdir -p Src/zi + cp -f "${_staged_file}" Src/zi/zpmod.so + cp -f "${_staged_file}" Src/zi/zpmod.bundle + cp -f "${_staged_file}" zpmod.so + date +%s > COMPILED_AT + printf '%s\n' "${col_info2}-- Module built successfully --${col_rst}" + exit 0 + fi + + printf '%s\n' "${col_pname}== Building module ZPMOD, running: a make clean, then ./configure and then make ==${col_rst}" if test -f Makefile; then if [ "${1-}" = "--clean" ]; then printf '%s\n' "${col_info2}-- make distclean --${col_rst}" From e7a5de9c5bc478ab6dda8a20659810b112bf2199 Mon Sep 17 00:00:00 2001 From: Sal Date: Fri, 28 Aug 2026 02:31:47 +0100 Subject: [PATCH 3/3] fix(ci): provision zpmod CMake prerequisites --- .github/workflows/check-macos.yml | 2 +- public/checksum.txt | 2 +- public/sh/install_zpmod.sh | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-macos.yml b/.github/workflows/check-macos.yml index 21b410c..74517a5 100644 --- a/.github/workflows/check-macos.yml +++ b/.github/workflows/check-macos.yml @@ -43,7 +43,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: ⚙️ Prepare dependencies run: | - brew install zsh + brew install autoconf zsh - name: "⚙️ Generate checksums" run: sh ./public/sh/generate-checksums.sh - name: "⚙️ Check: unit fixtures" diff --git a/public/checksum.txt b/public/checksum.txt index 8476b1e..2957c73 100644 --- a/public/checksum.txt +++ b/public/checksum.txt @@ -1,4 +1,4 @@ -4e9c5dd538feea312c094a00a826c5949b74e555450f42ab0e0d370e76d6e1c5 public/sh/install_zpmod.sh +6de66efba021ebcf462e7672577d9f6876f13db55691f04e7009ff7e78d658b8 public/sh/install_zpmod.sh 6ee1ced1b73ab9d6f8a17e26505dd5de588b2a0af2832603ae04eb2866763ed9 public/sh/install.sh 08cc893ceb982fc99d17db1966c6c30790cc571e16e4f5392352d995f5252952 public/sh/sync-init.sh 424d66dca9bc26dd225afa45ccf15e42c8cf1f9e5e68fa51b469969bb5d51901 public/zsh/init.zsh diff --git a/public/sh/install_zpmod.sh b/public/sh/install_zpmod.sh index bcaa027..4b1b3b1 100755 --- a/public/sh/install_zpmod.sh +++ b/public/sh/install_zpmod.sh @@ -74,6 +74,12 @@ build_zpmod_module() { cd "${MOD_HOME}" || exit 1 printf '%s\n' "${col_pname}== The module sources are located at: ${MOD_HOME} ==${col_rst}" if test -f CMakeLists.txt; then + for _required_command in autoconf cc cmake make; do + if ! command -v "${_required_command}" >/dev/null 2>&1; then + printf '%s\n' "${col_error}Required build command not found: ${_required_command}.${col_rst}" + exit 1 + fi + done printf '%s\n' "${col_pname}== Building module ZPMOD with CMake ==${col_rst}" _clean_arg="" if [ "${1-}" = "--clean" ]; then