Skip to content

Commit

Permalink
add fmt build step
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexu committed Nov 18, 2024
1 parent ca20ee2 commit 98aade3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ jobs:
with:
version: master

- name: Fmt
run: zig fmt . --check
if: matrix.os == 'ubuntu-latest'

- name: Build
run: zig build

Expand Down
14 changes: 11 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,15 @@ pub fn build(b: *std.Build) !void {
break :modes chosen_opt_modes_buf[0..chosen_mode_index];
};

const tests_step = b.step("test", "Run all tests");
const test_step = b.step("test", "Run all tests");

const fmt_dirs: []const []const u8 = &.{ "build", "src", "test" };
b.step("fmt", "Modify source files in place to have conforming formatting")
.dependOn(&b.addFmt(.{ .paths = fmt_dirs }).step);

const test_fmt = b.step("test-fmt", "Check source files having conforming formatting");
test_fmt.dependOn(&b.addFmt(.{ .paths = fmt_dirs, .check = true }).step);
test_step.dependOn(test_fmt);

{
const unit_test_step = b.step("test-unit", "Run unit tests");
Expand All @@ -77,12 +85,12 @@ pub fn build(b: *std.Build) !void {
const run_unit_tests = b.addRunArtifact(unit_tests);
unit_test_step.dependOn(&run_unit_tests.step);
}
tests_step.dependOn(unit_test_step);
test_step.dependOn(unit_test_step);
}

try @import("test/cases.zig").addCaseTests(
b,
tests_step,
test_step,
optimization_modes,
target,
skip_translate,
Expand Down

0 comments on commit 98aade3

Please sign in to comment.