From 4ad6838f339883dfb63fc8b4d3e3ac7affde4c24 Mon Sep 17 00:00:00 2001 From: Jon C Date: Sat, 3 Aug 2024 16:13:37 +0200 Subject: [PATCH] CI: Add build and fmt job --- .github/workflows/main.yml | 24 ++++++++++++++++++++++++ .gitignore | 2 +- build.zig.zon | 2 +- src/root.zig | 4 ++++ 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e97cf8b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,24 @@ +name: Build and test library + +on: [pull_request, push] + +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{matrix.os}} + steps: + - uses: actions/checkout@v2 + - uses: goto-bus-stop/setup-zig@v2 + with: + version: 0.12.0 + - run: zig build test --summary all + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: goto-bus-stop/setup-zig@v2 + with: + version: 0.12.0 + - run: zig fmt --check . diff --git a/.gitignore b/.gitignore index 4a0641e..e73c965 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ zig-cache/ -zig-out/ \ No newline at end of file +zig-out/ diff --git a/build.zig.zon b/build.zig.zon index e890f4c..1313a14 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -14,7 +14,7 @@ // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. // Once all dependencies are fetched, `zig build` no longer requires // internet connectivity. - .dependencies = .{ }, + .dependencies = .{}, // Specifies the set of files and directories that are included in this package. // Only files and directories listed here are included in the `hash` that diff --git a/src/root.zig b/src/root.zig index db9918a..237d47e 100644 --- a/src/root.zig +++ b/src/root.zig @@ -266,6 +266,10 @@ pub fn write(writer: anytype, data: anytype) !void { @compileError("Serializing '" ++ @typeName(T) ++ "' is unsupported."); } +test { + std.testing.refAllDecls(@This()); +} + test "borsh: serialize and deserialize" { var buffer = std.ArrayList(u8).init(testing.allocator); defer buffer.deinit();