Skip to content

Commit

Permalink
handle syncwith separately
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyMlashkin committed Jun 6, 2024
1 parent 0c4cd33 commit 31965a3
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 42 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}
26 changes: 7 additions & 19 deletions .github/workflows/run_tests_linux.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
30 changes: 7 additions & 23 deletions .github/workflows/run_tests_mac.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 31965a3

Please sign in to comment.