Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
Signed-off-by: emneo <emneo@kreog.com>
  • Loading branch information
emneo-dev committed Sep 8, 2024
1 parent 37026ae commit 6422bad
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,37 @@ on:
pull_request:

jobs:
nix_build:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: goto-bus-stop/setup-zig@v2
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix build
version: 0.13.0
- run: zig build -Doptimize=ReleaseSafe -Dbuild_all=true -Dversion=0.0.0-nightly --summary all
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: ./zig-out/bin/liskvork-*

test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
- run: zig build test --summary all

nix_flake_check:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: goto-bus-stop/setup-zig@v2
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix flake check
version: 0.13.0
- run: zig fmt --check .
17 changes: 7 additions & 10 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,12 @@ pub fn build(b: *std.Build) !void {

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

for (targets) |test_target| {
const unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = b.resolveTargetQuery(test_target),
.optimize = optimize,
});
const unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = std_target,
.optimize = optimize,
});

const run_unit_tests = b.addRunArtifact(unit_tests);
run_unit_tests.skip_foreign_checks = true;
test_step.dependOn(&run_unit_tests.step);
}
const run_unit_tests = b.addRunArtifact(unit_tests);
test_step.dependOn(&run_unit_tests.step);
}

0 comments on commit 6422bad

Please sign in to comment.