Merge pull request #116 from okx/dev-dumi #76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. | |
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml | |
name: CMake Cuda Build | |
on: | |
push: | |
branches: [ "master", "dev", "ci" ] | |
pull_request: | |
workflow_dispatch: # Add this to enable manual triggers | |
inputs: | |
trigger_cpp: | |
description: 'Cpp Wrapper' | |
required: false | |
type: boolean | |
default: true | |
trigger_go: | |
description: 'Go Wrapper' | |
required: false | |
type: boolean | |
default: true | |
trigger_rust: | |
description: 'Rust Wrapper' | |
required: false | |
type: boolean | |
default: true | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-latest | |
env: | |
CPP_CHANGES: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.files.*.path, 'wrappers/cpp/') || github.event_name == 'push' && contains(github.event.commits.*.modified, 'wrappers/cpp/') }} | |
GO_CHANGES: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.files.*.path, 'wrappers/go/') || github.event_name == 'push' && contains(github.event.commits.*.modified, 'wrappers/go/') }} | |
RUST_CHANGES: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.files.*.path, 'wrappers/rust/') || github.event_name == 'push' && contains(github.event.commits.*.modified, 'wrappers/rust/') }} | |
steps: | |
- uses: Jimver/[email protected] | |
id: cuda-toolkit | |
with: | |
cuda: '12.3.0' | |
method: 'network' | |
sub-packages: '["nvcc", "cudart", "toolkit"]' | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build blst | |
working-directory: native/depends/blst | |
run: ./build.sh | |
- name: Configure default goldilocks | |
working-directory: native | |
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build default and install | |
working-directory: native | |
run: sudo cmake --build build --config ${{env.BUILD_TYPE}} --target install | |
- name: Configure bn254 & MSM | |
working-directory: native | |
run: cmake -B build-bn254 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_MSM=ON -DCURVE=BN254 | |
- name: Build bn254 & MSM | |
working-directory: native | |
run: cmake --build build-bn254 --config ${{env.BUILD_TYPE}} | |
- name: Install dependencies for cpp wrapper | |
working-directory: wrappers/cpp | |
if: env.CPP_CHANGES == 'true' || inputs.trigger_cpp == true | |
run: ./build_gmp.sh host && sudo apt install libgtest-dev nasm | |
- name: Configure cpp wrapper | |
working-directory: wrappers/cpp | |
if: env.CPP_CHANGES == 'true' || inputs.trigger_cpp == true | |
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCURVE=BN254 -DBUILD_MSM=ON | |
- name: Build cpp wrapper | |
working-directory: wrappers/cpp | |
if: env.CPP_CHANGES == 'true' || inputs.trigger_cpp == true | |
run: cmake --build build --config ${{env.BUILD_TYPE}} | |
- name: Check Go formatting | |
working-directory: wrappers/go | |
if: env.GO_CHANGES == 'true' || inputs.trigger_go == true | |
run: | | |
if [ -n "$(gofmt -l .)" ]; then | |
echo "Go code is not properly formatted:" | |
gofmt -l . | |
exit 1 | |
fi | |
- name: Build Go wrapper | |
working-directory: wrappers/go | |
if: env.GO_CHANGES == 'true' || inputs.trigger_go == true | |
run: go build -v ./... | |
- uses: moonrepo/setup-rust@v1 | |
name: Setup Rust Toolchain | |
if: env.RUST_CHANGES == 'true' || inputs.trigger_rust == true | |
with: | |
components: rustfmt | |
cache: false | |
- name: Build Rust wrapper | |
working-directory: wrappers/rust | |
if: env.RUST_CHANGES == 'true' || inputs.trigger_rust == true | |
run: cargo build | |
- name: Check Rust Format | |
working-directory: wrappers/rust | |
if: env.RUST_CHANGES == 'true' || inputs.trigger_rust == true | |
run: cargo fmt --check |