Skip to content

Commit

Permalink
add github action (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnite authored Sep 21, 2024
1 parent 8162457 commit 2e705d8
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
target: [
native,
x86_64-linux-gnu,
x86_64-linux-musl,
x86_64-windows,
aarch64-macos,
aarch64-linux-gnu,
aarch64-linux-musl
# TODO: bsd
]
optimize: [
Debug,
ReleaseSafe,
ReleaseFast,
ReleaseSmall
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0

- name: Build
run: zig build -Dtarget=${{ matrix.target }} -Doptimize=${{ matrix.optimize }}
test:
strategy:
fail-fast: false
matrix:
os: [windows-latest, linux-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0

- name: Test
run: zig build test
5 changes: 5 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ pub fn build(b: *Build) void {
mbedtls.installHeadersDirectory(mbedtls_dep.path("include/psa"), "psa", .{});
b.installArtifact(mbedtls);

if (target.result.os.tag == .windows) {
mbedtls.linkSystemLibrary("bcrypt");
}

const selftest = b.addExecutable(.{
.name = "selftest",
.target = target,
Expand All @@ -36,6 +40,7 @@ pub fn build(b: *Build) void {
.flags = &.{},
});
selftest.linkLibrary(mbedtls);
b.getInstallStep().dependOn(&selftest.step);

const selftest_run = b.addRunArtifact(selftest);
const test_step = b.step("test", "Run Tests");
Expand Down

0 comments on commit 2e705d8

Please sign in to comment.