From 6f5f9f98d36f9bfa74734e6305b68addc4b40615 Mon Sep 17 00:00:00 2001 From: Andrei Malashkin Date: Thu, 6 Jun 2024 23:29:22 +0200 Subject: [PATCH] handle syncwith separately --- .github/workflows/pull-request.yml | 48 +++++++++++++++++++++++++++ .github/workflows/run_tests_linux.yml | 26 ++++----------- .github/workflows/run_tests_mac.yml | 30 ++++------------- 3 files changed, 62 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..91cc638cf --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,48 @@ +name: PR Testing + +on: + pull_request: + 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: + handle-syncwith: + if: github.event_name == 'pull_request' + name: Call Reusable SyncWith Handler + uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1.2.1 + with: + ci-cd-ref: 'v1.1.2' + secrets: inherit + + test-linux: + name: Linux Crypto3 Testing + uses: ./.github/workflows/run_tests_linux.yml + needs: + - handle-syncwith + if: | + always() && !cancelled() && + (needs.handle-syncwith.result == 'success' || needs.handle-syncwith.result == 'skipped') + secrets: inherit + with: + submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }} + + test-mac: + name: macOS Crypto3 Testing + uses: ./.github/workflows/run_tests_mac.yml + needs: + - handle-syncwith + if: | + always() && !cancelled() && + (needs.handle-syncwith.result == 'success' || needs.handle-syncwith.result == 'skipped') + secrets: inherit + with: + submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }} diff --git a/.github/workflows/run_tests_linux.yml b/.github/workflows/run_tests_linux.yml index bf98e3454..4d1dc573e 100644 --- a/.github/workflows/run_tests_linux.yml +++ b/.github/workflows/run_tests_linux.yml @@ -1,32 +1,20 @@ -name: Run tests +name: Run linux tests on: - # Triggers the workflow on pull request events but only for the master branch - pull_request: - branches: [ master ] - push: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + workflow_call: + inputs: + submodules-refs: + type: string + description: "Lines with submodules' repo names and refs (e.g. `org/repo: ref`)" + required: false env: - SUITE_REPO: "NilFoundation/crypto3" LIB_NAME: "blueprint" CACHE_NAME: "blueprint-job-cache" TESTS_ARTIFACT_NAME: "test-results-linux" jobs: - handle-syncwith: - if: github.event_name == 'pull_request' - name: Call Reusable SyncWith Handler - uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1 - with: - ci-cd-ref: 'v1' - secrets: inherit - build-and-test: - needs: [ handle-syncwith ] name: "Build and test Linux" runs-on: ["self-hosted", "aws_autoscaling"] strategy: diff --git a/.github/workflows/run_tests_mac.yml b/.github/workflows/run_tests_mac.yml index b4842d794..0b970b73f 100644 --- a/.github/workflows/run_tests_mac.yml +++ b/.github/workflows/run_tests_mac.yml @@ -1,41 +1,25 @@ -name: Run tests +name: Run mac tests on: - # Triggers the workflow on pull request events but only for the master branch - pull_request: - branches: [ master ] - push: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + workflow_call: + inputs: + submodules-refs: + type: string + description: "Lines with submodules' repo names and refs (e.g. `org/repo: ref`)" + required: false env: - SUITE_REPO: "NilFoundation/crypto3" LIB_NAME: "blueprint" CACHE_NAME: "blueprint-job-cache" TESTS_ARTIFACT_NAME: "test-results-mac" jobs: - handle-syncwith: - if: github.event_name == 'pull_request' - name: Call Reusable SyncWith Handler - uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1 - with: - ci-cd-ref: 'v1' - secrets: inherit - build-and-test: - needs: [ handle-syncwith ] name: "Build and test macOS" runs-on: [macos-14] strategy: fail-fast: false steps: - # https://github.com/actions/checkout/issues/1552 - - name: Clean up after previous checkout - run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*; - - name: Checkout Blueprint uses: actions/checkout@v4 with: