-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (92 loc) · 4.14 KB
/
cmake.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# 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" ]
pull_request:
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/') }}
CUDA_VERSION: 12.3.0
steps:
- name: Cache CUDA toolkit
id: cuda-cache
uses: actions/cache@v3
with:
path: /usr/local/cuda-${{ env.CUDA_VERSION }}
key: ${{ runner.os }}-cuda-${{ env.CUDA_VERSION }}
- uses: Jimver/[email protected]
id: cuda-toolkit
if: steps.cuda-cache.outputs.cache-hit != 'true'
with:
cuda: '${{ env.CUDA_VERSION }}'
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'
run: ./build_gmp.sh host && sudo apt install libgtest-dev nasm
- name: Configure cpp wrapper
working-directory: wrappers/cpp
if: env.CPP_CHANGES == 'true'
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCURVE=BN254
- name: Build cpp wrapper
working-directory: wrappers/cpp
if: env.CPP_CHANGES == 'true'
run: cmake --build build --config ${{env.BUILD_TYPE}}
- name: Check Go formatting
working-directory: wrappers/go
if: env.GO_CHANGES == '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'
run: go build -v ./...
- uses: moonrepo/setup-rust@v1
name: Setup Rust Toolchain
if: env.RUST_CHANGES == 'true'
with:
components: rustfmt
cache: false
- name: Check Rust Format
working-directory: wrappers/rust
if: env.RUST_CHANGES == 'true'
run: cargo fmt --check
- name: Build Rust wrapper
working-directory: wrappers/rust
if: env.RUST_CHANGES == 'true'
run: cargo build