Skip to content

Commit

Permalink
Cancel previous GitHub Action workflows on same branch with new commi…
Browse files Browse the repository at this point in the history
…ts (babelfish-for-postgresql#667)

Description
Changes
Cancels previous GH Action workflows in the same branch when there is a new commit to it.
Pushes to PR only run the actions once rather than twice (Push & PR), clarification: this is more for forked repositories with write access.

Benefits
Reduce wait time for actions to run if there are multiple commits to the same branch
Reduces costs of using Github Action minutes

Note
It runs on whenever a PR is created / has a new push (to the same branch)
It runs whenever a branch with the following prefix BABEL_* is pushed to, this is to have it still run on default branch.

Signed-off-by: Colin Yuen yuenhcol@amazon.com
  • Loading branch information
ColinKYuen authored Oct 20, 2022
1 parent 73ff7b5 commit 18eabd0
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 14 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/dotnet-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Dotnet Framework Tests
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-babelfish-dotnet-tests:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/isolation-tests.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Babelfish Smoke Tests
on:
push:
branches:
pull_request:
branches:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
isolation-tests:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/jdbc-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: JDBC Tests
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-babelfish-jdbc-tests:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/major-version-upgrade.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Major Version Upgrade Tests for empty database
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-babelfish-mvu-tests:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/minor-version-upgrade.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Minor Version Upgrade Tests for empty database
on: [push, pull_request]

on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
extension-tests:
env:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/odbc-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: ODBC Tests
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-babelfish-odbc-tests:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pg-hint-plan-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: pg-hint-plan Tests
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-pg-hint-plan-tests:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Python Tests
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-babelfish-python-tests:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/singledb-version-upgrade.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Major Version Upgrade Tests for singledb mode
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-babelfish-mvu-tests-singledb:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/sql-validation-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Validate Installation/Upgrade Scripts
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-sql-validation-tests:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/upgrade-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Version Upgrade Test Framework
on: [push, pull_request]
on:
pull_request:
push:
branches: [ 'BABEL_*' ]
concurrency: # Cancel previous runs in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
generate-version-upgrade-tests:
Expand Down

0 comments on commit 18eabd0

Please sign in to comment.