Skip to content

Commit 658473b

Browse files
authored
feat: verifier binding c and go (#377)
1 parent e2023a5 commit 658473b

19 files changed

Lines changed: 1267 additions & 47 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release bindings
2+
3+
on:
4+
pull_request:
5+
release:
6+
types: [published]
7+
workflow_dispatch:
8+
inputs:
9+
tag_name:
10+
description: Existing release tag to attach artifacts to, for example v0.9.1
11+
required: true
12+
type: string
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
17+
18+
env:
19+
CARGO_TERM_COLOR: always
20+
21+
jobs:
22+
build:
23+
name: build-${{ matrix.target }}
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- os: ubuntu-latest
30+
target: x86_64-unknown-linux-gnu
31+
archive: libere_verifier_c.linux-amd64.tar.gz
32+
- os: ubuntu-latest
33+
target: aarch64-unknown-linux-gnu
34+
archive: libere_verifier_c.linux-arm64.tar.gz
35+
- os: macos-latest
36+
target: x86_64-apple-darwin
37+
archive: libere_verifier_c.darwin-amd64.tar.gz
38+
- os: macos-latest
39+
target: aarch64-apple-darwin
40+
archive: libere_verifier_c.darwin-arm64.tar.gz
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v6
44+
45+
- name: Install Rust toolchain
46+
uses: dtolnay/rust-toolchain@master
47+
with:
48+
toolchain: nightly-2026-05-01
49+
50+
- name: Cache dependencies
51+
uses: Swatinem/rust-cache@v2
52+
53+
- name: Install zig
54+
uses: mlugg/setup-zig@v2
55+
with:
56+
version: 0.16.0
57+
58+
- name: Install cargo-zigbuild
59+
uses: taiki-e/install-action@v2
60+
with:
61+
tool: cargo-zigbuild
62+
63+
- name: Build and package
64+
run: bash bindings/scripts/build.sh "${{ matrix.target }}" "${{ matrix.archive }}"
65+
66+
- name: Upload artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: ${{ matrix.target }}
70+
path: ${{ matrix.archive }}
71+
if-no-files-found: error
72+
73+
upload:
74+
name: upload-release-assets
75+
needs: build
76+
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
77+
runs-on: ubuntu-latest
78+
permissions:
79+
contents: write
80+
steps:
81+
- name: Download artifacts
82+
uses: actions/download-artifact@v4
83+
with:
84+
path: artifacts
85+
86+
- name: Attach artifacts to release
87+
uses: softprops/action-gh-release@v2
88+
with:
89+
tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.event.release.tag_name }}
90+
files: artifacts/**/*
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Test bindings
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
pull_request:
12+
13+
env:
14+
CARGO_TERM_COLOR: always
15+
16+
jobs:
17+
test:
18+
name: Test bindings
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- os: ubuntu-latest
25+
target: x86_64-unknown-linux-gnu
26+
- os: ubuntu-24.04-arm
27+
target: aarch64-unknown-linux-gnu
28+
- os: macos-latest
29+
target: aarch64-apple-darwin
30+
- os: macos-13
31+
target: x86_64-apple-darwin
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v6
35+
36+
- name: Install Rust toolchain
37+
uses: dtolnay/rust-toolchain@master
38+
with:
39+
toolchain: nightly-2026-05-01
40+
41+
- name: Cache dependencies
42+
uses: Swatinem/rust-cache@v2
43+
44+
- name: Install zig
45+
uses: mlugg/setup-zig@v2
46+
with:
47+
version: 0.16.0
48+
49+
- name: Install cargo-zigbuild
50+
uses: taiki-e/install-action@v2
51+
with:
52+
tool: cargo-zigbuild
53+
54+
- name: Install Go
55+
uses: actions/setup-go@v6
56+
with:
57+
go-version-file: bindings/golang/go.mod
58+
59+
- name: Run C binding tests
60+
run: cargo test --release -p ere-verifier-c
61+
62+
- name: Build the static library
63+
run: bash bindings/scripts/build.sh ${{ matrix.target }} libere_verifier_c.tar.gz
64+
65+
- name: Run Go binding tests
66+
shell: bash
67+
run: |
68+
LIBDIR="$(mktemp -d)"
69+
tar -xzf libere_verifier_c.tar.gz -C "$LIBDIR"
70+
cd bindings/golang
71+
CGO_CFLAGS="-I$LIBDIR" CGO_LDFLAGS="-L$LIBDIR" go test ./...

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ target
22
notes.md
33
dory_srs_*_variables.srs
44
.vscode
5-
.DS_Store
5+
.DS_Store
6+
*.tar.gz

0 commit comments

Comments
 (0)