From d27ed3722b9d3053eef8250c10fa87837b08fb69 Mon Sep 17 00:00:00 2001 From: Austin Shalit Date: Sun, 27 Feb 2022 20:13:58 -0800 Subject: [PATCH] [ci] Set actions workflow concurrency (#4060) This sets the workflow concurrency to 1 for all workflows. For PRs this means if you push an additional commit older jobs will be cancelled. The documentation workflow already only runs on tags or merges to main. For this, we cancel previous runs if they are to the same destination (tag or main) but still prevent 2 jobs from running at once if they are spawned from different refs. --- .github/workflows/cmake.yml | 4 ++++ .github/workflows/documentation.yml | 5 +++++ .github/workflows/gazebo.yml | 4 ++++ .github/workflows/gradle-wrapper-validation.yml | 4 ++++ .github/workflows/gradle.yml | 4 ++++ .github/workflows/lint-format.yml | 4 ++++ .github/workflows/sanitizers.yml | 4 ++++ 7 files changed, 29 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c0c0be7f66..1b9804c81d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -2,6 +2,10 @@ name: CMake on: [pull_request, push] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: build: strategy: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index ab59b0f5fe..4d23eea6d5 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -2,6 +2,10 @@ name: Documentation on: [push, workflow_dispatch] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: BASE_PATH: allwpilib/docs @@ -10,6 +14,7 @@ jobs: name: "Documentation - Publish" runs-on: ubuntu-latest if: github.repository_owner == 'wpilibsuite' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + concurrency: ci-docs-publish steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/gazebo.yml b/.github/workflows/gazebo.yml index 53948fbda0..d08f6ad638 100644 --- a/.github/workflows/gazebo.yml +++ b/.github/workflows/gazebo.yml @@ -2,6 +2,10 @@ name: Gazebo on: [pull_request, push] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: build: name: "Build" diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index c16f58f680..c433132e0c 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -1,6 +1,10 @@ name: "Validate Gradle Wrapper" on: [pull_request, push] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: validation: name: "Validation" diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e05b3e6a70..e3aedab516 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -2,6 +2,10 @@ name: Gradle on: [pull_request, push] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: build-docker: strategy: diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 6d806f77a0..91bff89a1a 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -6,6 +6,10 @@ on: branches-ignore: - main +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: wpiformat: name: "wpiformat" diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index 8c0e516c3f..c5f79518d8 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -2,6 +2,10 @@ name: Sanitizers on: [pull_request, push] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: build: strategy: