From b0a6b46535f0d590d60142b126a536ef71c15b4a Mon Sep 17 00:00:00 2001 From: MALASHKIN Andrei Date: Wed, 15 May 2024 21:41:23 +0200 Subject: [PATCH] use nix-based CI and cm_add_test_subdirectory --- .github/workflows/publish-results.yml | 13 ----- .github/workflows/pull-request-action.yml | 43 --------------- .github/workflows/pull-request.yml | 64 ++++++++++++++++------- CMakeLists.txt | 7 +-- 4 files changed, 46 insertions(+), 81 deletions(-) delete mode 100644 .github/workflows/publish-results.yml delete mode 100644 .github/workflows/pull-request-action.yml diff --git a/.github/workflows/publish-results.yml b/.github/workflows/publish-results.yml deleted file mode 100644 index fe59679b1..000000000 --- a/.github/workflows/publish-results.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Needed to publish test results in fork -name: Testing Callback - -on: - workflow_run: - workflows: ["PR Testing"] - types: - - completed - -jobs: - call-reusable-workflow: - name: Call Reusable Testing Callback Workflow - uses: NilFoundation/ci-cd/.github/workflows/reusable-crypto3-publish-result.yml@v1.2.0 diff --git a/.github/workflows/pull-request-action.yml b/.github/workflows/pull-request-action.yml deleted file mode 100644 index 9408431cb..000000000 --- a/.github/workflows/pull-request-action.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Reusable PR testing for mac and linux - -on: - workflow_call: - inputs: - targets: - type: string - description: "Make and CTest targets. If not specified, everything is tested" - required: false - -jobs: - handle-syncwith: - name: Call Reusable SyncWith Handler - uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1.2.1 - with: - ci-cd-ref: 'v1.2.0' - secrets: inherit - - matrix-test-linux: - name: Linux Reusable Crypto3 Testing - needs: - - handle-syncwith - uses: NilFoundation/ci-cd/.github/workflows/reusable-crypto3-testing-linux.yml@v1.2.1 - - secrets: inherit - with: - submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }} - - targets: ${{ inputs.targets }} - - matrix-test-mac: - name: Mac Reusable Crypto3 Testing - needs: - - handle-syncwith - uses: NilFoundation/ci-cd/.github/workflows/reusable-crypto3-testing-mac.yml@v1.2.1 - - secrets: inherit - with: - submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }} - - # TODO(martun): fix this sometime soon. All the targets must work on mac. - targets: crypto3_zk_math_expression_test # ${{ inputs.targets }} - diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b8b05fec4..cb6f27f8f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -2,28 +2,52 @@ name: PR Testing on: pull_request: - types: - - opened - - synchronize + push: + branches: + - master + +concurrency: + # In master we want to run for every commit, in other branches — only for the last one + group: ${{ + ( github.ref == 'refs/heads/master' && format('{0}/{1}/{2}', github.workflow, github.ref, github.sha) ) + || + format('{0}/{1}', github.workflow, github.ref) }} + cancel-in-progress: true jobs: - run-pull-request-actions: - name: Reusable Crypto3 Testing - uses: ./.github/workflows/pull-request-action.yml + handle-syncwith: + name: Call Reusable SyncWith Handler + uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1.2.1 + with: + ci-cd-ref: 'v1.2.1' + secrets: inherit + + test-linux: + name: Linux Reusable Crypto3 Testing + needs: + - handle-syncwith + uses: NilFoundation/crypto3/.github/workflows/reusable-submodule-testing-linux.yml@3de0775395bf06c0e4969ff7f921cc7523904269 secrets: inherit with: - targets: | - crypto3_zk_commitment_fold_polynomial_test - crypto3_zk_commitment_fri_test - crypto3_zk_commitment_lpc_test - crypto3_zk_commitment_kzg_test - crypto3_zk_systems_plonk_placeholder_placeholder_test - crypto3_zk_commitment_powers_of_tau_test - crypto3_zk_commitment_proof_of_knowledge_test - crypto3_zk_commitment_r1cs_gg_ppzksnark_mpc_test - crypto3_zk_math_expression_test - crypto3_zk_systems_plonk_plonk_constraint_test - crypto3_zk_commitment_proof_of_knowledge_test - crypto3_zk_transcript_transcript_test - crypto3_zk_commitment_proof_of_work_test + submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }} + check-names: | + zk-clang + + # test-mac: + # name: Mac Reusable Crypto3 Testing + # needs: + # - handle-syncwith + # uses: NilFoundation/crypto3/.github/workflows/reusable-submodule-testing-mac.yml@3de0775395bf06c0e4969ff7f921cc7523904269 + + # secrets: inherit + # with: + # submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }} + # check-names: | + # hash-clang + + publish-results: + name: Publish JUnit results + needs: + - test-linux + uses: NilFoundation/crypto3/.github/workflows/reusable-publish-result.yml@3de0775395bf06c0e4969ff7f921cc7523904269 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fcf95299..e5f5c94e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,8 +50,6 @@ cm_find_package(CM) include(CMDeploy) include(FindPkgConfig) -option(BUILD_TESTS "Build unit tests" FALSE) - cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}) add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE) @@ -81,6 +79,5 @@ cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} NAMESPACE ${CMAKE_WORKSPACE_NAME}::) -if(BUILD_TESTS) - add_subdirectory(test) -endif() +include(CMTest) +cm_add_test_subdirectory(test)