CI 2.0 - unified CI for C++, Go and RUST - PHASE1 #28
Workflow file for this run
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
name: C++/CUDA/GoLang & Examples | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-changed-files: | |
uses: ./.github/workflows/check-changed-files.yml | |
check-format: | |
name: Check Code Format | |
runs-on: ubuntu-22.04 | |
needs: check-changed-files | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check clang-format | |
if: needs.check-changed-files.outputs.cpp == 'true' | |
run: ./scripts/format_all.sh . --check --exclude "build|wrappers" | |
extract-cuda-backend-branch: | |
uses: ./.github/workflows/extract-backends.yml | |
with: | |
pr-number: ${{ github.event.pull_request.number }} | |
test-linux-curve: | |
name: Test curve on Linux | |
runs-on: [self-hosted, Linux, X64, icicle] | |
needs: [check-changed-files, check-format, extract-cuda-backend-branch] | |
strategy: | |
matrix: | |
curve: | |
- name: bn254 | |
build_args: -DG2=ON -DECNTT=ON | |
- name: bls12_381 | |
build_args: -DG2=ON -DECNTT=ON | |
- name: bls12_377 | |
build_args: -DG2=ON -DECNTT=ON | |
- name: bw6_761 | |
build_args: -DG2=ON -DECNTT=ON | |
- name: grumpkin | |
build_args: | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Checkout CUDA Backend | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: ingonyama-zk/icicle-cuda-backend | |
path: ./icicle/backend/cuda | |
ssh-key: ${{ secrets.CUDA_PULL_KEY }} | |
ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} | |
- name: Get CUDA Backend Commit SHA | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
working-directory: ./icicle/backend/cuda | |
id: extract-cuda-sha | |
run: | | |
CUDA_BACKEND_SHA=$(git rev-parse HEAD) | |
echo "CUDA Backend Commit SHA: $CUDA_BACKEND_SHA" | |
echo "cuda-backend-sha=$CUDA_BACKEND_SHA" >> $GITHUB_ENV | |
- name: Setup go | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.0' | |
- name: Set CUDA backend flag | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
id: cuda-flag | |
run: | | |
if [ "${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }}" == "main" ]; then | |
echo "CUDA_FLAG=" >> $GITHUB_OUTPUT | |
echo "CMAKE_INSTALL_PREFIX=" >> $GITHUB_OUTPUT | |
echo "ICICLE_BACKEND_INSTALL_DIR=/usr/local/lib" >> $GITHUB_OUTPUT | |
else | |
echo "CUDA_FLAG=-DCUDA_BACKEND=local" >> $GITHUB_OUTPUT | |
echo "CMAKE_INSTALL_PREFIX=-DCMAKE_INSTALL_PREFIX=/tmp/local/" >> $GITHUB_OUTPUT | |
echo "ICICLE_BACKEND_INSTALL_DIR=/tmp/local/lib" >> $GITHUB_OUTPUT | |
fi | |
- name: Build curve | |
working-directory: ./icicle | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
run: | | |
mkdir -p build && rm -rf build/* | |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DCURVE=${{ matrix.curve.name }} ${{ matrix.curve.build_args }} ${{ steps.cuda-flag.outputs.CUDA_FLAG }} ${{ steps.cuda-flag.outputs.CMAKE_INSTALL_PREFIX }} -S . -B build | |
cmake --build build --target install -j | |
- name: Run C++ curve Tests | |
working-directory: ./icicle/build/tests | |
if: needs.check-changed-files.outputs.cpp == 'true' | |
run: | | |
export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.ICICLE_BACKEND_INSTALL_DIR }} | |
ctest | |
- name: Run C++ examples | |
working-directory: ./examples/c++ | |
if: needs.check-changed-files.outputs.cpp == 'true' || needs.check-changed-files.outputs.examples == 'true' | |
run: | | |
CURVE=$(echo ${{ matrix.curve.name }} | sed -e 's/_//g') | |
export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.ICICLE_BACKEND_INSTALL_DIR }} | |
for dir in $(grep -l -r "\\-DCURVE=$CURVE" . | xargs -L1 dirname | sort -u); do | |
if [ -d "$dir" ]; then | |
echo "Running command in $dir" | |
cd $dir | |
./run.sh -d CUDA | |
cd - | |
fi | |
done | |
- name: Run Golang curve Tests | |
working-directory: ./wrappers/golang/curves | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
run: | | |
CURVE=$(echo ${{ matrix.curve.name }} | sed -e 's/_//g') | |
export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.ICICLE_BACKEND_INSTALL_DIR }} | |
go test ./$CURVE/tests -count=1 -failfast -p 2 -timeout 60m -v | |
test-linux-field: | |
name: Test field on Linux | |
runs-on: [self-hosted, Linux, X64, icicle] | |
needs: [check-changed-files, check-format, extract-cuda-backend-branch] | |
strategy: | |
matrix: | |
field: | |
- name: babybear | |
build_args: -DEXT_FIELD=ON | |
- name: stark252 | |
build_args: -DEXT_FIELD=OFF | |
- name: m31 | |
build_args: -DEXT_FIELD=ON | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Checkout CUDA Backend | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: ingonyama-zk/icicle-cuda-backend | |
path: ./icicle/backend/cuda | |
ssh-key: ${{ secrets.CUDA_PULL_KEY }} | |
ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} | |
- name: Get CUDA Backend Commit SHA | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
working-directory: ./icicle/backend/cuda | |
id: extract-cuda-sha | |
run: | | |
CUDA_BACKEND_SHA=$(git rev-parse HEAD) | |
echo "CUDA Backend Commit SHA: $CUDA_BACKEND_SHA" | |
echo "cuda-backend-sha=$CUDA_BACKEND_SHA" >> $GITHUB_ENV | |
- name: Setup go | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.0' | |
- name: Set CUDA backend flag | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
id: cuda-flag | |
run: | | |
if [ "${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }}" == "main" ]; then | |
echo "CUDA_FLAG=" >> $GITHUB_OUTPUT | |
echo "CMAKE_INSTALL_PREFIX=" >> $GITHUB_OUTPUT | |
echo "ICICLE_BACKEND_INSTALL_DIR=/usr/local/lib" >> $GITHUB_OUTPUT | |
else | |
echo "CUDA_FLAG=-DCUDA_BACKEND=local" >> $GITHUB_OUTPUT | |
echo "CMAKE_INSTALL_PREFIX=-DCMAKE_INSTALL_PREFIX=/tmp/local/" >> $GITHUB_OUTPUT | |
echo "ICICLE_BACKEND_INSTALL_DIR=/tmp/local/lib" >> $GITHUB_OUTPUT | |
fi | |
- name: Build field | |
working-directory: ./icicle | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
run: | | |
mkdir -p build && rm -rf build/* | |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DFIELD=${{ matrix.field.name }} ${{ matrix.field.build_args }} ${{ steps.cuda-flag.outputs.CUDA_FLAG }} ${{ steps.cuda-flag.outputs.CMAKE_INSTALL_PREFIX }} -S . -B build | |
cmake --build build --target install -j | |
- name: Run C++ field Tests | |
working-directory: ./icicle/build/tests | |
if: needs.check-changed-files.outputs.cpp == 'true' | |
run: | | |
export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.ICICLE_BACKEND_INSTALL_DIR }} | |
ctest --output-on-failure | |
- name: Run C++ examples | |
working-directory: ./examples/c++ | |
if: needs.check-changed-files.outputs.cpp == 'true' || needs.check-changed-files.outputs.examples == 'true' | |
run: | | |
FIELD=$(echo ${{ matrix.field.name }} | sed -e 's/_//g') | |
export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.ICICLE_BACKEND_INSTALL_DIR }} | |
for dir in $(grep -l -r "\\-DFIELD=$FIELD" . | xargs -L1 dirname | sort -u); do | |
if [ -d "$dir" ]; then | |
echo "Running command in $dir" | |
cd $dir | |
./run.sh -d CUDA | |
cd - | |
fi | |
done | |
- name: Run Golang field Tests (babybear only) | |
working-directory: ./wrappers/golang/fields | |
if: (needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true') && matrix.field.name == 'babybear' | |
# if: matrix.field.name == 'babybear' | |
run: | | |
FIELD=$(echo ${{ matrix.field.name }} | sed -e 's/_//g') | |
export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.ICICLE_BACKEND_INSTALL_DIR }} | |
go test ./$FIELD/tests -count=1 -failfast -p 2 -timeout 60m -v | |
test-linux-hash: | |
name: Build and test Go hash on Linux | |
runs-on: [self-hosted, Linux, X64, icicle] | |
needs: [check-changed-files, check-format, extract-cuda-backend-branch] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Checkout CUDA Backend | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: ingonyama-zk/icicle-cuda-backend | |
path: ./icicle/backend/cuda | |
ssh-key: ${{ secrets.CUDA_PULL_KEY }} | |
ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} | |
- name: Get CUDA Backend Commit SHA | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
working-directory: ./icicle/backend/cuda | |
id: extract-cuda-sha | |
run: | | |
CUDA_BACKEND_SHA=$(git rev-parse HEAD) | |
echo "CUDA Backend Commit SHA: $CUDA_BACKEND_SHA" | |
echo "cuda-backend-sha=$CUDA_BACKEND_SHA" >> $GITHUB_ENV | |
- name: Setup go | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.0' | |
- name: Set CUDA backend flag | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
id: cuda-flag | |
run: | | |
if [ "${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }}" == "main" ]; then | |
echo "CUDA_FLAG=" >> $GITHUB_OUTPUT | |
echo "CMAKE_INSTALL_PREFIX=" >> $GITHUB_OUTPUT | |
echo "ICICLE_BACKEND_INSTALL_DIR=/usr/local/lib" >> $GITHUB_OUTPUT | |
else | |
echo "CUDA_FLAG=-DCUDA_BACKEND=local" >> $GITHUB_OUTPUT | |
echo "CMAKE_INSTALL_PREFIX=-DCMAKE_INSTALL_PREFIX=/tmp/local/" >> $GITHUB_OUTPUT | |
echo "ICICLE_BACKEND_INSTALL_DIR=/tmp/local/lib" >> $GITHUB_OUTPUT | |
fi | |
- name: Build | |
working-directory: ./wrappers/golang | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
# builds the hash and merkle tree lib using a local copy of the CUDA backend | |
run: | | |
./build.sh -cuda_backend=local | |
- name: Test GoLang Hashes | |
working-directory: ./wrappers/golang/hash | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
run: | | |
export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.ICICLE_BACKEND_INSTALL_DIR }} | |
go test ./tests -count=1 -failfast -p 2 -timeout 60m -v | |
- name: Test GoLang Merkle Tree | |
working-directory: ./wrappers/golang/merkle-tree | |
if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' | |
run: | | |
export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.ICICLE_BACKEND_INSTALL_DIR }} | |
go test ./tests -count=1 -failfast -p 2 -timeout 60m -v |