Skip to content

Commit

Permalink
ci: Update workflows to cancel previous runs unless the branch is the…
Browse files Browse the repository at this point in the history
… main branch.
  • Loading branch information
nfelt14 committed Oct 21, 2023
1 parent e90148b commit 173b73f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tek-repo-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
run: echo codeql-analysis file does not exist!
# Check that all jobs passed
check-repo-lint-passed:
if: always()
if: ${{ !cancelled() }}
needs:
- check-for-codeowners-file
- check-for-readme-file
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Run tox
run: tox -v
- uses: actions/upload-artifact@v3
if: '!cancelled()'
if: ${{ !cancelled() }}
with:
name: artifact_${{ matrix.platform }}_${{ matrix.python-version }}_tests_and_linting
path: |
Expand All @@ -56,23 +56,23 @@ jobs:
- name: Test
run: tox -ve tests
- uses: actions/upload-artifact@v3
if: '!cancelled()'
if: ${{ !cancelled() }}
with:
name: artifact_${{ matrix.os_name }}_tests
path: |
.results_*/**
.coverage*
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: '!cancelled()'
if: ${{ !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./.coverage_tests.xml
name: codecov-${{ matrix.os_name }}
fail_ci_if_error: true
# Check that all jobs passed
check-tests-passed:
if: always()
if: ${{ !cancelled() }}
needs: [test-general, test-fast]
runs-on: ubuntu-latest
steps:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches: [main]
pull_request:
branches: [main]
# Cancel running jobs for the same workflow and branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
# IMPORTANT: Any new jobs need to be added to the check-docs-passed job to ensure they correctly gate code changes
jobs:
# Test building the docs (html, linkcheck, doctest, coverage)
Expand Down Expand Up @@ -32,19 +36,19 @@ jobs:
- name: Test
run: tox -ve ${{ matrix.tox_env }}
- uses: thedoctor0/[email protected]
if: '!cancelled()'
if: ${{ !cancelled() }}
with:
type: zip
filename: ${{ matrix.tox_env }}_results.zip
path: .results_${{ matrix.tox_env }}/
- uses: actions/upload-artifact@v3
if: '!cancelled()'
if: ${{ !cancelled() }}
with:
name: artifact_${{ matrix.tox_env }}
path: ${{ matrix.tox_env }}_results.zip
# Check that all jobs passed
check-docs-passed:
if: always()
if: ${{ !cancelled() }}
needs: [test-docs]
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 173b73f

Please sign in to comment.