Skip to content

Commit

Permalink
only run get_tests if the tests or release should run
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Sep 6, 2024
1 parent 7a6828f commit 6346ba4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ env:
DFX_VERSION: 0.21.0
NODE_VERSION: 20
jobs:
get-tests:
determine-should-release:
if: ${{ contains(github.head_ref, 'release--') }}
name: Determine if this branch should release
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.determine_should_release.outputs.should_release }}
steps:
- uses: actions/checkout@v4

- id: determine_should_release
uses: ./.github/actions/should_release

get-tests:
needs: determine-should-release
if: ${{ contains(github.head_ref, 'release--') && needs.determine-should-release.outputs.should_release }}
name: Get tests
runs-on: ubuntu-latest
outputs:
Expand All @@ -25,18 +38,6 @@ jobs:
./examples
./tests
determine-should-release:
if: ${{ contains(github.head_ref, 'release--') }}
name: Determine if this branch should release
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.determine_should_release.outputs.should_release }}
steps:
- uses: actions/checkout@v4

- id: determine_should_release
uses: ./.github/actions/should_release

release:
name: Deploy release
# Only run this job if it's a release branch. This job will run instead of run-tests and will automatically publish another commit which will be tested
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,22 @@ env:
IS_RELEASE_BRANCH_PR: ${{ contains(github.head_ref, 'release--') }}
IS_FEATURE_BRANCH_PR: ${{ !contains(github.head_ref, 'release--') }}
jobs:
determine-should-run-tests:
name: Determine if tests should run
runs-on: ubuntu-latest
outputs:
# If the branch should release then it shouldn't run tests.
should_run_tests: ${{ steps.determine_should_run_tests.outputs.should_release == 'false' }}
steps:
- uses: actions/checkout@v4

- id: determine_should_run_tests
uses: ./.github/actions/should_release

get-tests:
name: Get tests
needs: determine-should-run-tests
if: ${{ needs.determine-should-run-tests.outputs.should_run_tests == 'true' }}
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.get_tests.outputs.tests }}
Expand All @@ -43,18 +57,6 @@ jobs:
./tests/property/candid_rpc/functional_api/stable_b_tree_map
') || '' }}
determine-should-run-tests:
name: Determine if tests should run
runs-on: ubuntu-latest
outputs:
# If the branch should release then it shouldn't run tests.
should_run_tests: ${{ steps.determine_should_run_tests.outputs.should_release == 'false' }}
steps:
- uses: actions/checkout@v4

- id: determine_should_run_tests
uses: ./.github/actions/should_release

run-test:
name: '${{matrix.tests.name}} | ${{matrix.tests.type}} | ${{matrix.tests.syntax}} | ${{matrix.tests.api}} | ${{matrix.azle_source}}'
needs:
Expand Down

0 comments on commit 6346ba4

Please sign in to comment.