diff options
| author | 2025-05-07 15:11:59 +0200 | |
|---|---|---|
| committer | 2025-05-07 15:41:00 +0200 | |
| commit | cc5c6a5d71a317ed4b0ad776842d1d0655f72d0a (patch) | |
| tree | de6972e86893dad79e2d1eee88fc64d0dfdb4f06 | |
| parent | doc: Don't autogenerate the README (diff) | |
| download | zig-clap-cc5c6a5d71a317ed4b0ad776842d1d0655f72d0a.tar.gz zig-clap-cc5c6a5d71a317ed4b0ad776842d1d0655f72d0a.tar.xz zig-clap-cc5c6a5d71a317ed4b0ad776842d1d0655f72d0a.zip | |
chore: Update setup-zig to v2
| -rw-r--r-- | .github/workflows/docs.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/main.yml | 25 | ||||
| -rw-r--r-- | build.zig | 8 |
3 files changed, 21 insertions, 14 deletions
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 689ecdb..0432159 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml | |||
| @@ -20,7 +20,7 @@ jobs: | |||
| 20 | runs-on: ubuntu-latest | 20 | runs-on: ubuntu-latest |
| 21 | steps: | 21 | steps: |
| 22 | - uses: actions/checkout@v4 | 22 | - uses: actions/checkout@v4 |
| 23 | - uses: mlugg/setup-zig@v1 | 23 | - uses: mlugg/setup-zig@v2 |
| 24 | with: | 24 | with: |
| 25 | version: master | 25 | version: master |
| 26 | - name: Build | 26 | - name: Build |
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe832f7..ed75a67 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml | |||
| @@ -9,21 +9,28 @@ jobs: | |||
| 9 | test: | 9 | test: |
| 10 | strategy: | 10 | strategy: |
| 11 | matrix: | 11 | matrix: |
| 12 | os: [ubuntu-latest, windows-latest] | 12 | optimize: [Debug, ReleaseSmall, ReleaseSafe, ReleaseFast] |
| 13 | step: [examples, test] | 13 | runs-on: ubuntu-latest |
| 14 | optimize: [Debug, ReleaseSafe, ReleaseFast] | 14 | steps: |
| 15 | runs-on: ${{matrix.os}} | 15 | - uses: actions/checkout@v4 |
| 16 | - uses: mlugg/setup-zig@v2 | ||
| 17 | with: | ||
| 18 | version: master | ||
| 19 | cache-key: ${{ matrix.optimize }} | ||
| 20 | - run: zig test clap.zig -O${{ matrix.optimize }} | ||
| 21 | examples: | ||
| 22 | runs-on: ubuntu-latest | ||
| 16 | steps: | 23 | steps: |
| 17 | - uses: actions/checkout@v3 | 24 | - uses: actions/checkout@v4 |
| 18 | - uses: mlugg/setup-zig@v1 | 25 | - uses: mlugg/setup-zig@v2 |
| 19 | with: | 26 | with: |
| 20 | version: master | 27 | version: master |
| 21 | - run: zig build ${{ matrix.step }} -Doptimize=${{ matrix.optimize }} | 28 | - run: zig build examples |
| 22 | lint: | 29 | lint: |
| 23 | runs-on: ubuntu-latest | 30 | runs-on: ubuntu-latest |
| 24 | steps: | 31 | steps: |
| 25 | - uses: actions/checkout@v3 | 32 | - uses: actions/checkout@v4 |
| 26 | - uses: mlugg/setup-zig@v1 | 33 | - uses: mlugg/setup-zig@v2 |
| 27 | with: | 34 | with: |
| 28 | version: master | 35 | version: master |
| 29 | - run: zig fmt --check . | 36 | - run: zig fmt --check . |
| @@ -1,15 +1,15 @@ | |||
| 1 | pub fn build(b: *std.Build) void { | 1 | pub fn build(b: *std.Build) void { |
| 2 | const clap_mod = b.addModule("clap", .{ .root_source_file = b.path("clap.zig") }); | ||
| 3 | |||
| 4 | const optimize = b.standardOptimizeOption(.{}); | 2 | const optimize = b.standardOptimizeOption(.{}); |
| 5 | const target = b.standardTargetOptions(.{}); | 3 | const target = b.standardTargetOptions(.{}); |
| 6 | 4 | ||
| 7 | const test_step = b.step("test", "Run all tests in all modes."); | 5 | const clap_mod = b.addModule("clap", .{ |
| 8 | const tests = b.addTest(.{ | ||
| 9 | .root_source_file = b.path("clap.zig"), | 6 | .root_source_file = b.path("clap.zig"), |
| 10 | .target = target, | 7 | .target = target, |
| 11 | .optimize = optimize, | 8 | .optimize = optimize, |
| 12 | }); | 9 | }); |
| 10 | |||
| 11 | const test_step = b.step("test", "Run all tests in all modes."); | ||
| 12 | const tests = b.addTest(.{ .root_module = clap_mod }); | ||
| 13 | const run_tests = b.addRunArtifact(tests); | 13 | const run_tests = b.addRunArtifact(tests); |
| 14 | test_step.dependOn(&run_tests.step); | 14 | test_step.dependOn(&run_tests.step); |
| 15 | 15 | ||