ReviewOS

also looking at this

zig-utils/zig-test-framework

ci: define and enforce the Zig toolchain policy

#16
Merged glennmichael123 wants to merge codex/issue-8-zig-toolchain-policy into main
9 files +97 -25
.github/workflows/ci.ymlmodified+51-6
Changes to .github/workflows/ci.yml
@@ -5,25 +5,31 @@ on:
55 branches: [main, develop]
66 pull_request:
77 branches: [main, develop]
8 schedule:
9 - cron: '17 6 * * 1'
10 workflow_dispatch:
811
912jobs:
1013 test:
11 name: Test on ${{ matrix.os }} with Zig ${{ matrix.zig-version }}
14 name: Test on ${{ matrix.os }} with supported Zig
1215 runs-on: ${{ matrix.os }}
1316 strategy:
1417 matrix:
1518 os: [ubuntu-latest, macos-latest]
16 zig-version: ['0.17.0-dev']
1719 fail-fast: false
1820
1921 steps:
2022 - name: Checkout code
2123 uses: actions/checkout@v6
2224
25 - name: Read supported Zig version
26 id: zig-version
27 run: echo "version=$(cat .zig-version)" >> "$GITHUB_OUTPUT"
28
2329 - name: Setup Zig
2430 uses: pantry-pm/pantry/packages/action@main
2531 with:
26 packages: zig@0.17.0-dev
32 packages: zig@${{ steps.zig-version.outputs.version }}
2733
2834 - name: Verify Zig installation
2935 run: zig version
@@ -45,10 +51,14 @@ jobs:
4551 - name: Checkout code
4652 uses: actions/checkout@v6
4753
54 - name: Read supported Zig version
55 id: zig-version
56 run: echo "version=$(cat .zig-version)" >> "$GITHUB_OUTPUT"
57
4858 - name: Setup Zig
4959 uses: pantry-pm/pantry/packages/action@main
5060 with:
51 packages: zig@0.17.0-dev
61 packages: zig@${{ steps.zig-version.outputs.version }}
5262
5363 - name: Check formatting
5464 run: zig fmt --check .
@@ -61,10 +71,14 @@ jobs:
6171 - name: Checkout code
6272 uses: actions/checkout@v6
6373
74 - name: Read supported Zig version
75 id: zig-version
76 run: echo "version=$(cat .zig-version)" >> "$GITHUB_OUTPUT"
77
6478 - name: Setup Zig
6579 uses: pantry-pm/pantry/packages/action@main
6680 with:
67 packages: zig@0.17.0-dev
81 packages: zig@${{ steps.zig-version.outputs.version }}
6882
6983 - name: Generate docs
7084 run: zig build-lib -femit-docs src/lib.zig
@@ -83,10 +97,14 @@ jobs:
8397 - name: Checkout code
8498 uses: actions/checkout@v6
8599
100 - name: Read supported Zig version
101 id: zig-version
102 run: echo "version=$(cat .zig-version)" >> "$GITHUB_OUTPUT"
103
86104 - name: Setup Zig
87105 uses: pantry-pm/pantry/packages/action@main
88106 with:
89 packages: zig@0.17.0-dev
107 packages: zig@${{ steps.zig-version.outputs.version }}
90108
91109 - name: Install kcov
92110 continue-on-error: true
@@ -121,3 +139,30 @@ jobs:
121139 - name: Coverage skipped
122140 if: steps.install-kcov.outcome != 'success'
123141 run: echo "kcov not available on this platform, skipping coverage"
142
143 latest-zig:
144 name: Compatibility with latest Zig 0.17.0-dev
145 if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
146 continue-on-error: true
147 runs-on: ubuntu-latest
148
149 steps:
150 - name: Checkout code
151 uses: actions/checkout@v6
152
153 - name: Setup latest Zig development build
154 uses: pantry-pm/pantry/packages/action@main
155 with:
156 packages: zig@0.17.0-dev
157
158 - name: Verify Zig installation
159 run: zig version
160
161 - name: Build framework
162 run: zig build
163
164 - name: Run tests
165 run: zig build test
166
167 - name: Run examples
168 run: zig build examples