Update CI and prepush hooks

This commit is contained in:
Jeremy Felder
2023-12-12 20:41:40 +02:00
parent 401ec5afac
commit 0df6262961
7 changed files with 31 additions and 15 deletions

View File

@@ -2,13 +2,12 @@ golang:
- goicicle/**/*.go'
- go.mod
rust:
- src/**/*.rs
- build.rs
- Cargo.toml
- wrappers/rust
cpp:
- icicle/**/*.cu
- icicle/**/*.cuh
- icicle/**/*.cpp
- icicle/**/*.hpp
- icicle/**/*.c
- icicle/**/*.h
- icicle/**/*.h
- icicle/CMakeLists.txt

View File

@@ -46,7 +46,9 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Build Rust
working-directory: ./wrappers/rust
if: needs.check-changed-files.outputs.rust == 'true' || needs.check-changed-files.outputs.cpp_cuda == 'true'
# Building from the root workspace will build all members of the workspace by default
run: cargo build --release --verbose
build-rust-windows:
@@ -65,9 +67,11 @@ jobs:
# https://docs.nvidia.com/cuda/archive/12.0.0/cuda-installation-guide-microsoft-windows/index.html
sub-packages: '["cudart", "nvcc", "thrust", "visual_studio_integration"]'
- name: Build Rust Targets
working-directory: ./wrappers/rust
if: needs.check-changed-files.outputs.rust == 'true' || needs.check-changed-files.outputs.cpp_cuda == 'true'
env:
CUDA_PATH: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}
# Building from the root workspace will build all members of the workspace by default
run: cargo build --release --verbose
build-golang-linux:

View File

@@ -13,6 +13,7 @@ jobs:
formatting-rust:
name: Check Rust Code Formatting
runs-on: ubuntu-22.04
working-directory: ./wrappers/rust
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -37,5 +38,4 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Check clang-format
run: unformatted_files=$(find ./ -path ./icicle/build -prune -o -path ./target -prune -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format --dry-run -ferror-limit=1 -style=file >&2); if [[ $unformatted_files ]]; then echo $unformatted_files; echo "Please run clang-format"; exit 1; fi
run: if [[ $(find ./ \( -path ./icicle/build -prune -o -path ./**/target -prune \) -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format --dry-run -ferror-limit=1 -style=file 2>&1) ]]; then echo "Please run clang-format"; exit 1; fi

View File

@@ -46,13 +46,19 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run Rust Tests
working-directory: ./wrappers/rust
if: needs.check-changed-files.outputs.rust == 'true' || needs.check-changed-files.outputs.cpp_cuda == 'true'
# Running tests from the root workspace will run all workspace members' tests by default
#TODO: remove test-threads once thread safety is finalized
run: cargo test --release --verbose -- --test-threads=1
test-cpp-linux:
name: Test C++ on Linux
runs-on: [self-hosted, Linux, X64, icicle]
needs: check-changed-files
strategy:
matrix:
curve: [bn254, bls12_381, bls12_377, bw6_671]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
@@ -61,7 +67,7 @@ jobs:
if: needs.check-changed-files.outputs.cpp_cuda == 'true'
run: |
mkdir -p build
cmake -DBUILD_TESTS=ON -S . -B build
cmake -DBUILD_TESTS=ON -DCURVE=${{ matrix.curve }} -S . -B build
cmake --build build
- name: Run C++ Tests
working-directory: ./icicle/build

View File

@@ -3,15 +3,15 @@
status=0
# Run clang-format on CUDA, C, and CPP files
# clang-format writes to stderr in dry-run mode. In order to capture the output to detect if there are changes needed we redirect stderr to stdin
# to print list of files
unformatted_files=$(find ./ -path ./icicle/build -prune -o -path ./target -prune -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format --dry-run -ferror-limit=1 -style=file 2>&1)
if [[ $unformatted_files ]];
if [[ $(find ./ \( -path ./icicle/build -prune -o -path ./**/target -prune \) -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format --dry-run -ferror-limit=1 -style=file 2>&1) ]];
then
echo "🚨 There are files in Icicle Core that need formatting."
echo $unformatted_files
echo ""
echo "Please format all .c, .cpp, .h, .cu, .cuh files using the following command:"
echo "find ./ -path ./icicle/build -prune -o -path ./target -prune -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format -i -style=file"
echo "find ./ \( -path ./icicle/build -prune -o -path ./**/target -prune \) -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format -i -style=file"
echo ""
echo "If you only want to see what formatting is required please run:"
echo "find ./ \( -path ./icicle/build -prune -o -path ./**/target -prune \) -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format --dry-run -style=file"
status=1
fi
@@ -24,10 +24,11 @@ then
fi
# Run cargo fmt on Rust files
cd wrappers/rust
if [[ $(cargo fmt --check) ]];
then
echo "🚨 There are Rust files that need formatting."
echo "Please format the Rust files using 'cargo fmt'"
echo "Please format the Rust files using 'cargo fmt' from the wrappers/rust directory"
status=1
fi

View File

@@ -1,3 +1,7 @@
[workspace]
resolver = "2"
members = ["icicle-cuda-runtime", "icicle-core", "icicle-curves/icicle-bn254"]
members = [
"icicle-cuda-runtime",
"icicle-core",
"icicle-curves/icicle-bn254"
]

View File

@@ -0,0 +1,2 @@
// Empty mod file - This is necessary for cargo fmt to operate correctly in CI
// All content in this file will be overwritten when building the crate