Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
3cbb6fb
build(deps): bootstrap repo with TypeScript, vitest, ESLint, prettier…
guysenpai May 9, 2026
17ff83d
feat(version): add version parser, comparator and tarball naming
guysenpai May 9, 2026
1eadb41
feat(cache): add deterministic cache key generation helpers
guysenpai May 9, 2026
b429625
feat(minisign): port Ed25519+BLAKE2b verification from mlugg/setup-zig
guysenpai May 9, 2026
bf52ba6
feat(resolve): add version resolution with index.json, ZON parsing, r…
guysenpai May 9, 2026
aefad5a
feat(action): add main and post orchestration entry points
guysenpai May 9, 2026
c83df9d
feat(action): add action.yml manifest with 8 inputs, 1 output, node24…
guysenpai May 9, 2026
914ce78
build(deps): bundle dist/ via ncc and switch to .js import extensions
guysenpai May 9, 2026
ff09343
ci: add GitHub Actions matrix, lint, and Forgejo test workflows
guysenpai May 9, 2026
3cedaf7
docs: add README and three usage examples (minimal, monorepo, matrix)
guysenpai May 9, 2026
7bd26bb
chore(lint): fix eslint and prettier issues, rebuild dist/
guysenpai May 10, 2026
0ede4be
docs(brief): close M01
guysenpai May 10, 2026
d8b0996
test(minisign): cover bad trusted header, unsupported algo, raw Ed mode
guysenpai May 10, 2026
34c411f
ci(release): auto-tag and create GitHub Release on main when Lint passes
guysenpai May 10, 2026
6e2fc75
fix(resolve): accept ziglang.org index.json shape (no .version on tag…
guysenpai May 10, 2026
48722fd
fix(build): rebuild dist/ on Linux and disable git CRLF normalization…
guysenpai May 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .forgejo/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test (Forgejo)

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
zig-version:
name: resolve and run Zig 0.16.0 on default Codeberg runner
runs-on: codeberg-tiny-lazy
steps:
- uses: actions/checkout@v4

- name: Setup Zig
id: setup
uses: ./
with:
version: 0.16.0

- name: Verify zig version
shell: bash
run: |
v="${{ steps.setup.outputs.zig-version }}"
if [[ "$v" != "0.16.0" ]]; then
echo "Expected 0.16.0, got '$v'"; exit 1
fi
zig version

version-file:
name: resolve from tests/fixtures/build.zig.zon
runs-on: codeberg-tiny-lazy
steps:
- uses: actions/checkout@v4

- name: Setup Zig from version-file
id: setup
uses: ./
with:
version-file: tests/fixtures/build.zig.zon

- name: Verify resolved version
shell: bash
run: |
v="${{ steps.setup.outputs.zig-version }}"
if [[ "$v" != "0.16.0" ]]; then
echo "Expected 0.16.0, got '$v'"; exit 1
fi
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* text=auto eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf

dist/* linguist-generated=true
dist/* -diff
dist/* -text
package-lock.json -diff
57 changes: 57 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Lint

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
lint:
name: typecheck, eslint, prettier, dist reproducibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- run: npm ci

- run: npm run typecheck

- run: npm run lint

- run: npm run format:check

- name: Verify committed dist/ matches a fresh rebuild
shell: bash
run: |
mv dist dist.committed
npm run build
if ! diff -r dist dist.committed > /dev/null; then
echo "::error::Committed dist/ differs from a fresh rebuild. Run 'npm run build' before pushing."
diff -r dist dist.committed | head -50 || true
exit 1
fi
echo "dist/ is reproducible — matches the freshly-built output."

test:
name: vitest unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- run: npm ci

- run: npm test
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release

on:
workflow_run:
workflows: [Lint]
types: [completed]
branches: [main]

permissions:
contents: write

jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0

- name: Read version from package.json
id: version
shell: bash
run: |
v=$(node -p "require('./package.json').version")
if [[ -z "$v" || "$v" == "undefined" ]]; then
echo "::error::Could not read .version from package.json"; exit 1
fi
echo "value=$v" >> "$GITHUB_OUTPUT"
echo "tag=v$v" >> "$GITHUB_OUTPUT"

- name: Check whether the tag already exists
id: check
shell: bash
run: |
tag="${{ steps.version.outputs.tag }}"
if git rev-parse --verify "refs/tags/$tag" >/dev/null 2>&1; then
echo "::notice::Tag $tag already exists; skipping release."
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Create annotated tag
if: steps.check.outputs.exists == 'false'
shell: bash
env:
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
tag="${{ steps.version.outputs.tag }}"
git tag -a "$tag" -m "Release $tag"
git push origin "$tag"

- name: Create GitHub Release
if: steps.check.outputs.exists == 'false'
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
tag="${{ steps.version.outputs.tag }}"
gh release create "$tag" \
--title "$tag" \
--generate-notes \
--verify-tag
139 changes: 139 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Test

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
matrix:
name: ${{ matrix.os }} / ${{ matrix.version }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, macos-latest, windows-latest]
version: [master, latest, 0.14.1, 0.15.1, 0.16.0]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Setup Zig
id: setup
uses: ./
with:
version: ${{ matrix.version }}

- name: Run zig version
run: zig version

- name: Verify zig-version output is non-empty
shell: bash
run: |
v="${{ steps.setup.outputs.zig-version }}"
if [[ -z "$v" ]]; then
echo "zig-version output was empty"; exit 1
fi
echo "Action reported Zig version: $v"

cache-hit:
name: tarball cache hit verification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Zig (warmup)
uses: ./
with:
version: 0.16.0
cache-key: cache-hit-test

- name: Setup Zig (second run, expect tarball cache hit)
uses: ./
with:
version: 0.16.0
cache-key: cache-hit-test

version-file:
name: version-file input resolves from build.zig.zon
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Zig from tests/fixtures/build.zig.zon
id: setup
uses: ./
with:
version-file: tests/fixtures/build.zig.zon

- name: Verify resolved version matches the fixture's minimum_zig_version
shell: bash
run: |
v="${{ steps.setup.outputs.zig-version }}"
if [[ "$v" != "0.16.0" ]]; then
echo "Expected 0.16.0, got '$v'"; exit 1
fi

enforce-version-range-success:
name: enforce-version-range matches resolved version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./
with:
version: 0.16.0
enforce-version-range: '0.16'

- run: zig version

enforce-version-range-failure:
name: enforce-version-range rejects mismatched version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Zig (expected to fail)
id: bad
continue-on-error: true
uses: ./
with:
version: 0.15.1
enforce-version-range: '0.16'

- name: Verify the action failed with the expected error
shell: bash
run: |
if [[ "${{ steps.bad.outcome }}" != "failure" ]]; then
echo "Expected the action to fail; got outcome '${{ steps.bad.outcome }}'"
exit 1
fi

custom-mirror:
name: custom mirror is used preferentially
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./
with:
version: 0.16.0
mirror: 'https://pkg.machengine.org/zig'

- run: zig version

custom-source:
name: custom source query string is sent
runs-on: ubuntu-latest
env:
ACTIONS_STEP_DEBUG: 'true'
steps:
- uses: actions/checkout@v4

- uses: ./
with:
version: 0.16.0
source: github-test-foobar
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules/
coverage/
dist-tmp/
*.log
.env
.env.*
.DS_Store
.vscode/
.idea/
*.tsbuildinfo
.claude/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.15.0
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/
dist-tmp/
node_modules/
coverage/
briefs/
package-lock.json
.claude/
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"endOfLine": "lf"
}
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
MIT License

Copyright (c) 2026 Guy Gouri

This software is a reimplementation based on mlugg/setup-zig
(https://codeberg.org/mlugg/setup-zig), Copyright (c) Matthew Lugg,
also licensed under the MIT License.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading