diff options
| -rw-r--r-- | .github/workflows/main.yml | 5 | ||||
| -rw-r--r-- | build.zig | 29 |
2 files changed, 12 insertions, 22 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16b04c1..eb6d82d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml | |||
| @@ -10,6 +10,9 @@ jobs: | |||
| 10 | strategy: | 10 | strategy: |
| 11 | matrix: | 11 | matrix: |
| 12 | os: [ubuntu-latest, windows-latest] | 12 | os: [ubuntu-latest, windows-latest] |
| 13 | step: [examples, test] | ||
| 14 | compiler: [stage1=true, stage1=false] | ||
| 15 | release: [release-safe=false, release-safe=true, release-fast=true, release-small=true] | ||
| 13 | runs-on: ${{matrix.os}} | 16 | runs-on: ${{matrix.os}} |
| 14 | steps: | 17 | steps: |
| 15 | - uses: actions/checkout@v3 | 18 | - uses: actions/checkout@v3 |
| @@ -18,7 +21,7 @@ jobs: | |||
| 18 | - uses: goto-bus-stop/setup-zig@v2.0.1 | 21 | - uses: goto-bus-stop/setup-zig@v2.0.1 |
| 19 | with: | 22 | with: |
| 20 | version: master | 23 | version: master |
| 21 | - run: zig build | 24 | - run: zig build ${{ matrix.step }} -D${{ matrix.compiler }} -D${{ matrix.release }} |
| 22 | lint: | 25 | lint: |
| 23 | runs-on: ubuntu-latest | 26 | runs-on: ubuntu-latest |
| 24 | steps: | 27 | steps: |
| @@ -5,32 +5,19 @@ const Builder = std.build.Builder; | |||
| 5 | pub fn build(b: *Builder) void { | 5 | pub fn build(b: *Builder) void { |
| 6 | const mode = b.standardReleaseOptions(); | 6 | const mode = b.standardReleaseOptions(); |
| 7 | const target = b.standardTargetOptions(.{}); | 7 | const target = b.standardTargetOptions(.{}); |
| 8 | const stage1 = b.option(bool, "stage1", "Use the stage 1 compiler") orelse false; | ||
| 8 | 9 | ||
| 9 | const test_all_step = b.step("test", "Run all tests in all modes."); | 10 | const test_step = b.step("test", "Run all tests in all modes."); |
| 10 | for ([_]bool{ true, false }) |stage1| { | 11 | const tests = b.addTest("clap.zig"); |
| 11 | for (std.meta.tags(std.builtin.Mode)) |test_mode| { | 12 | tests.setBuildMode(mode); |
| 12 | const mode_str = @tagName(test_mode); | 13 | tests.setTarget(target); |
| 13 | const stage1_str = if (stage1) "stage1" else "stage2"; | 14 | tests.use_stage1 = stage1; |
| 14 | 15 | test_step.dependOn(&tests.step); | |
| 15 | const tests = b.addTest("clap.zig"); | ||
| 16 | tests.setBuildMode(test_mode); | ||
| 17 | tests.setTarget(target); | ||
| 18 | tests.use_stage1 = stage1; | ||
| 19 | |||
| 20 | const test_step = b.step( | ||
| 21 | b.fmt("test-{s}-{s}", .{ stage1_str, mode_str }), | ||
| 22 | b.fmt("Run all tests with {s} compiler in {s}.", .{ stage1_str, mode_str }), | ||
| 23 | ); | ||
| 24 | test_step.dependOn(&tests.step); | ||
| 25 | test_all_step.dependOn(test_step); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | 16 | ||
| 29 | const example_step = b.step("examples", "Build examples"); | 17 | const example_step = b.step("examples", "Build examples"); |
| 30 | inline for (.{ | 18 | inline for (.{ |
| 31 | "simple", | 19 | "simple", |
| 32 | "simple-ex", | 20 | "simple-ex", |
| 33 | //"simple-error", | ||
| 34 | "streaming-clap", | 21 | "streaming-clap", |
| 35 | "help", | 22 | "help", |
| 36 | "usage", | 23 | "usage", |
| @@ -49,7 +36,7 @@ pub fn build(b: *Builder) void { | |||
| 49 | readme_step.dependOn(readme); | 36 | readme_step.dependOn(readme); |
| 50 | 37 | ||
| 51 | const all_step = b.step("all", "Build everything and runs all tests"); | 38 | const all_step = b.step("all", "Build everything and runs all tests"); |
| 52 | all_step.dependOn(test_all_step); | 39 | all_step.dependOn(test_step); |
| 53 | all_step.dependOn(example_step); | 40 | all_step.dependOn(example_step); |
| 54 | all_step.dependOn(readme_step); | 41 | all_step.dependOn(readme_step); |
| 55 | 42 | ||