-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from NilFoundation/37-gh-actions-testing
Add tests workflow
- Loading branch information
Showing
1 changed file
with
112 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: Run tests | ||
|
||
on: | ||
# Triggers the workflow on pull request events but only for the master branch | ||
pull_request: | ||
branches: [ master ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
SUITE_REPO: "NilFoundation/crypto3" | ||
LIB_NAME: "blueprint" | ||
CACHE_NAME: "checkout-job-cache" | ||
|
||
jobs: | ||
checkout: | ||
runs-on: [self-hosted, tests-runner] | ||
steps: | ||
- name: Cleanup # TODO - move to scripts on runner | ||
run: | | ||
rm -rf ./* || true | ||
rm -rf ./.??* || true | ||
- name: Checkout suite | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ env.SUITE_REPO }} | ||
submodules: recursive | ||
|
||
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ./libs/${{ env.LIB_NAME }} | ||
submodules: recursive | ||
|
||
- name: Cmake and build | ||
env: | ||
CMAKE_ARGS: " | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DBUILD_SHARED_LIBS=FALSE | ||
-DBUILD_TESTS=TRUE | ||
-DBUILD_WITH_NUMA=FALSE | ||
-DBUILD_WITH_CUDA=FALSE | ||
-DBUILD_WITH_OPENCL=FALSE | ||
-DBUILD_WITH_SANITIZE=FALSE | ||
-DBUILD_WITH_DPDK=FALSE | ||
-DCRYPTO3_HASH_POSEIDON=FALSE | ||
-DBUILD_EXAMPLES=TRUE | ||
-DZK_PLACEHOLDER_PROFILING=TRUE | ||
" | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake ${{ env.CMAKE_ARGS }} .. | ||
- name: Archive build results | ||
run: | | ||
touch ${{ env.CACHE_NAME }}.tar.gz | ||
tar -czf ${{ env.CACHE_NAME }}.tar.gz --exclude=${{ env.CACHE_NAME }}.tar.gz . | ||
- name: Cache archived job output | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.CACHE_NAME }} | ||
path: ${{ env.CACHE_NAME }}.tar.gz | ||
retention-days: 1 | ||
|
||
|
||
run_tests: | ||
runs-on: [self-hosted] | ||
needs: [checkout] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: [ | ||
blueprint_hashes_plonk_sha256_process_test, | ||
blueprint_hashes_plonk_sha512_process_test, | ||
blueprint_non_native_plonk_non_native_demo_test, | ||
blueprint_non_native_plonk_non_native_range_test, | ||
blueprint_non_native_plonk_fixed_base_mul_test, | ||
blueprint_non_native_plonk_complete_addition_test, | ||
blueprint_non_native_plonk_var_base_mul_per_bit_test, | ||
blueprint_non_native_plonk_variable_base_multiplication_test, | ||
] # Tests to execute | ||
steps: | ||
- name: Cleanup # TODO - move to scripts on runner | ||
run: | | ||
rm -rf ./* || true | ||
rm -rf ./.??* || true | ||
- name: Upload checkout job cache | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ env.CACHE_NAME }} | ||
|
||
- name: Extract artifacts | ||
run: | | ||
tar -xf ${{ env.CACHE_NAME }}.tar.gz | ||
rm ${{ env.CACHE_NAME }}.tar.gz | ||
- name: Build | ||
working-directory: ./build | ||
run: cmake --build . -t ${{ matrix.target }} | ||
|
||
- name: Run test | ||
working-directory: ./build | ||
run: | | ||
cd libs/${{ env.LIB_NAME }}/test | ||
COLOR='\033[0;33m' | ||
echo -e "${COLOR}${{ matrix.target }}" | ||
./${{ matrix.target }} |