From 18eabd00a4483c6662b1d8489453fdd4c33237c7 Mon Sep 17 00:00:00 2001 From: Colin <70862826+ColinKYuen@users.noreply.github.com> Date: Thu, 20 Oct 2022 14:28:06 -0700 Subject: [PATCH] Cancel previous GitHub Action workflows on same branch with new commits (#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 --- .github/workflows/dotnet-tests.yml | 8 +++++++- .github/workflows/isolation-tests.yml | 8 +++++--- .github/workflows/jdbc-tests.yml | 8 +++++++- .github/workflows/major-version-upgrade.yml | 8 +++++++- .github/workflows/minor-version-upgrade.yml | 9 +++++++-- .github/workflows/odbc-tests.yml | 8 +++++++- .github/workflows/pg-hint-plan-tests.yml | 8 +++++++- .github/workflows/python-tests.yml | 8 +++++++- .github/workflows/singledb-version-upgrade.yml | 8 +++++++- .github/workflows/sql-validation-tests.yml | 8 +++++++- .github/workflows/upgrade-test.yml | 8 +++++++- 11 files changed, 75 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet-tests.yml b/.github/workflows/dotnet-tests.yml index 2ddfa997ba..9a29f5e736 100644 --- a/.github/workflows/dotnet-tests.yml +++ b/.github/workflows/dotnet-tests.yml @@ -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: diff --git a/.github/workflows/isolation-tests.yml b/.github/workflows/isolation-tests.yml index f40010a110..b5eefe41d2 100644 --- a/.github/workflows/isolation-tests.yml +++ b/.github/workflows/isolation-tests.yml @@ -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: diff --git a/.github/workflows/jdbc-tests.yml b/.github/workflows/jdbc-tests.yml index 9643225ebe..91ad0c3df8 100644 --- a/.github/workflows/jdbc-tests.yml +++ b/.github/workflows/jdbc-tests.yml @@ -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: diff --git a/.github/workflows/major-version-upgrade.yml b/.github/workflows/major-version-upgrade.yml index a2947f96c4..b2b4677d70 100644 --- a/.github/workflows/major-version-upgrade.yml +++ b/.github/workflows/major-version-upgrade.yml @@ -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: diff --git a/.github/workflows/minor-version-upgrade.yml b/.github/workflows/minor-version-upgrade.yml index a68ac803b3..1f3b57a802 100644 --- a/.github/workflows/minor-version-upgrade.yml +++ b/.github/workflows/minor-version-upgrade.yml @@ -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: diff --git a/.github/workflows/odbc-tests.yml b/.github/workflows/odbc-tests.yml index b11b1a66ed..774657bc4d 100644 --- a/.github/workflows/odbc-tests.yml +++ b/.github/workflows/odbc-tests.yml @@ -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: diff --git a/.github/workflows/pg-hint-plan-tests.yml b/.github/workflows/pg-hint-plan-tests.yml index 64b4407fda..0838943160 100644 --- a/.github/workflows/pg-hint-plan-tests.yml +++ b/.github/workflows/pg-hint-plan-tests.yml @@ -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: diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 858eca296f..62b1c9f67d 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -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: diff --git a/.github/workflows/singledb-version-upgrade.yml b/.github/workflows/singledb-version-upgrade.yml index 4cb9bbb188..1025267cdf 100644 --- a/.github/workflows/singledb-version-upgrade.yml +++ b/.github/workflows/singledb-version-upgrade.yml @@ -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: diff --git a/.github/workflows/sql-validation-tests.yml b/.github/workflows/sql-validation-tests.yml index 25930248fe..cf0fc79d54 100644 --- a/.github/workflows/sql-validation-tests.yml +++ b/.github/workflows/sql-validation-tests.yml @@ -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: diff --git a/.github/workflows/upgrade-test.yml b/.github/workflows/upgrade-test.yml index c8809be341..f3fa78293a 100644 --- a/.github/workflows/upgrade-test.yml +++ b/.github/workflows/upgrade-test.yml @@ -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: