Skip to content

Commit

Permalink
Merge pull request #2 from hendriknielaender/setup-ci
Browse files Browse the repository at this point in the history
chore(ci): setup basic build, test & fmt jobs
  • Loading branch information
hendriknielaender authored Sep 6, 2023
2 parents 1666129 + f25ddbf commit bfea3cd
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 78 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/zig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Zig

on:
pull_request:
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

permissions:
contents: read

jobs:
build:
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.11.0
- run: zig build test
build-examples-stable:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0
- run: zig build examples
build-examples-master:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: goto-bus-stop/setup-zig@v2
with:
version: master
- run: zig build examples
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: goto-bus-stop/setup-zig@v2
- run: zig fmt --check zbench.zig util/*.zig
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ zig-out

# libs
libs

.DS_Store
19 changes: 18 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
// Creates a step for unit testing. This only builds the test executable
// but does not run it.
const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = .{ .path = "zbench.zig" },
.target = target,
.optimize = optimize,
});
Expand All @@ -40,4 +40,21 @@ pub fn build(b: *std.Build) void {
// running the unit tests.
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);

const zbench_mod = b.addModule("zbench", .{ .source_file = .{ .path = "zbench.zig" } });

const example_step = b.step("examples", "Build examples");
// Add new examples here
for ([_][]const u8{"basic"}) |example_name| {
const example = b.addExecutable(.{
.name = example_name,
.root_source_file = .{ .path = b.fmt("examples/{s}.zig", .{example_name}) },
.target = target,
.optimize = optimize,
});
const install_example = b.addInstallArtifact(example, .{});
example.addModule("zbench", zbench_mod);
example_step.dependOn(&example.step);
example_step.dependOn(&install_example.step);
}
}
File renamed without changes.
77 changes: 0 additions & 77 deletions examples/basic/build.zig

This file was deleted.

0 comments on commit bfea3cd

Please sign in to comment.