Skip to content

Commit

Permalink
feat: add CI (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored Dec 13, 2024
1 parent 7b5c158 commit 66dfcbd
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Zig Build and Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
zig-build-test:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive # Ensures submodules are cloned
fetch-depth: 0 # Fetches the entire history for all branches

- name: Verify Submodules
run: |
git submodule update --init --recursive
ls -la blst
- name: Run blst/build.sh
run: |
cd blst
./build.sh
- name: Verify built blst
run: |
ls -la blst/libblst.a
- name: Install Zig
uses: mlugg/setup-zig@v1
with:
version: "0.13.0" # Set the required Zig version

- name: Build and Test
run: |
zig build test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
blst/
zig-out/
.zig-cache/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Zig wrapper for [supranational/blst](https://github.com/supranational/blst) native bindings, a highly performant BLS12-381 signature library.

# How to build
- clone hashtree to root: `git clone --recurse-submodules https://github.com/supranational/blst.git`
- clone blst to root: `git clone --recurse-submodules https://github.com/supranational/blst.git`
- `zig build`
- locate `zig-out/lib/libhashtree-z.dylib` (could be diffrerent name in other OSs) and continue the test below
- locate `zig-out/lib/libblst-z.dylib` (could be diffrerent name in other OSs) and continue the test below
1 change: 1 addition & 0 deletions blst
Submodule blst added at bef14c
2 changes: 2 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ pub fn build(b: *std.Build) !void {
});

lib_unit_tests.linkLibrary(lib);
// it's optional to do this on MacOS, but required in CI
lib_unit_tests.addObjectFile(b.path(blst_file_path));
lib_unit_tests.addIncludePath(b.path("blst/bindings"));

const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
Expand Down

0 comments on commit 66dfcbd

Please sign in to comment.