Skip to content

Go bindings

Go bindings #67

Workflow file for this run

name: test
on: [pull_request, workflow_dispatch]
jobs:
build:
name: Library - ${{ matrix.settings.name }}
runs-on: ${{ matrix.settings.runner }}
strategy:
fail-fast: false
matrix:
settings:
- name: MacOS arm64
target: aarch64-apple-darwin
runner: macos-latest
- name: Linux x86
target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- name: Linux arm64
target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
- name: Linux x86 using clang
target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
cc: clang
- name: Linux arm64 using clang
target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
cc: clang
- name: Windows x86
target: x86_64-pc-windows-msvc
runner: windows-latest
- name: Windows arm64
target: aarch64-pc-windows-msvc
runner: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cross-Compile Build
if: ${{ matrix.settings.cc != '' }}
run: CC=${{ matrix.settings.cc }} make all
- name: Build
if: ${{ !matrix.settings.cc }}
run: make all
- name: Run tests
run: ./build/test
go-bindings:
name: Go Bindings - ${{ matrix.settings.name }}
runs-on: ${{ matrix.settings.runner }}
strategy:
fail-fast: false
matrix:
go-version: [ '1.21', '1.22.x' ]
settings:
- name: MacOS arm64
target: aarch64-apple-darwin
runner: macos-latest
- name: Linux x86
target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- name: Linux arm64
target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
- name: Linux x86 using clang
target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
cc: clang
- name: Linux arm64 using clang
target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
cc: clang
- name: Windows x86
target: x86_64-pc-windows-msvc
runner: windows-latest
- name: Windows arm64
target: aarch64-pc-windows-msvc
runner: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cross-Compile Build
if: ${{ matrix.settings.cc != '' }}
run: CC=${{ matrix.settings.cc }} make go_bindings
- name: Build
if: ${{ !matrix.settings.cc }}
run: make go_bindings
- name: Run tests
run: go test .
- name: Run benchmarks
run: go test -bench=.
rust-bindings:
name: Rust Bindings - ${{ matrix.settings.name }}
runs-on: ${{ matrix.settings.runner }}
strategy:
fail-fast: false
matrix:
settings:
- name: MacOS arm64
target: aarch64-apple-darwin
runner: macos-latest
- name: Linux x86
target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- name: Linux arm64
target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
use-docker: true
- name: Windows x86
target: x86_64-pc-windows-msvc
runner: windows-latest
# - name: Windows arm64
# target: aarch64-pc-windows-msvc
# runner: windows-latest
# use-docker: true
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up QEMU
if: ${{ matrix.settings.use-docker && matrix.settings.runner == 'ubuntu-latest' }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build in docker
if: ${{ matrix.settings.use-docker }}
run: |
docker buildx build \
--build-arg TARGET=${{ matrix.settings.target }} \
--platform linux/arm64 \
-t ${{ matrix.settings.target }} \
.
- name: install rustup
if: ${{ !matrix.settings.use-docker }}
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
sh rustup-init.sh -y --default-toolchain none
rustup target add ${{ matrix.settings.target }}
- name: Build and Test
if: ${{ !matrix.settings.use-docker }}
run: |
cargo build --release --target ${{ matrix.settings.target }}
cargo test --target ${{ matrix.settings.target }}
nim:
name: nim
runs-on: ubuntu-latest
steps:
- uses: jiro4989/setup-nim-action@v1
- uses: actions/checkout@v3
- name: Run Nim test
run: nim c -r tests/test_hashtree_abi.nim