From 3c3b3bae877e4a783a5e91ef2c1cd05edb861c4e Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Fri, 25 Feb 2022 11:15:23 +0100 Subject: [PATCH] Cancel the workflows in progress in newer build is about to start (#32) --- templates/github/workflows/bench.yml | 5 +++++ templates/github/workflows/cloc.yml | 6 ++++++ templates/github/workflows/golangci-lint.yml | 6 ++++++ templates/github/workflows/gorelease.yml | 6 ++++++ templates/github/workflows/test-integration.yml | 6 ++++++ templates/github/workflows/test-unit.yml | 6 ++++++ 6 files changed, 35 insertions(+) diff --git a/templates/github/workflows/bench.yml b/templates/github/workflows/bench.yml index 152d4a6..d4b3952 100644 --- a/templates/github/workflows/bench.yml +++ b/templates/github/workflows/bench.yml @@ -12,6 +12,11 @@ on: description: 'New Ref' required: true +# Cancel the workflow in progress in newer build is about to start. +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + env: GO111MODULE: "on" CACHE_BENCHMARK: "off" # Enables benchmark result reuse between runs, may skew latency results. diff --git a/templates/github/workflows/cloc.yml b/templates/github/workflows/cloc.yml index 7002b22..d6ff20d 100644 --- a/templates/github/workflows/cloc.yml +++ b/templates/github/workflows/cloc.yml @@ -2,6 +2,12 @@ name: cloc on: pull_request: + +# Cancel the workflow in progress in newer build is about to start. +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: cloc: runs-on: ubuntu-latest diff --git a/templates/github/workflows/golangci-lint.yml b/templates/github/workflows/golangci-lint.yml index a5c9b47..ab81105 100644 --- a/templates/github/workflows/golangci-lint.yml +++ b/templates/github/workflows/golangci-lint.yml @@ -8,6 +8,12 @@ on: - master - main pull_request: + +# Cancel the workflow in progress in newer build is about to start. +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: golangci: name: golangci-lint diff --git a/templates/github/workflows/gorelease.yml b/templates/github/workflows/gorelease.yml index 94c6966..f8169e6 100644 --- a/templates/github/workflows/gorelease.yml +++ b/templates/github/workflows/gorelease.yml @@ -2,6 +2,12 @@ name: gorelease on: pull_request: + +# Cancel the workflow in progress in newer build is about to start. +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + env: GO_VERSION: 1.17.x jobs: diff --git a/templates/github/workflows/test-integration.yml b/templates/github/workflows/test-integration.yml index aab2e5b..5574fd5 100644 --- a/templates/github/workflows/test-integration.yml +++ b/templates/github/workflows/test-integration.yml @@ -6,6 +6,12 @@ on: - master - main pull_request: + +# Cancel the workflow in progress in newer build is about to start. +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + env: GO111MODULE: "on" RUN_BASE_COVERAGE: "on" # Runs test for PR base in case base test coverage is missing. diff --git a/templates/github/workflows/test-unit.yml b/templates/github/workflows/test-unit.yml index 6442393..036e70b 100644 --- a/templates/github/workflows/test-unit.yml +++ b/templates/github/workflows/test-unit.yml @@ -6,6 +6,12 @@ on: - master - main pull_request: + +# Cancel the workflow in progress in newer build is about to start. +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + env: GO111MODULE: "on" RUN_BASE_COVERAGE: "on" # Runs test for PR base in case base test coverage is missing.