From f1bafb28d98aa8f43000deb8439c48a78174fff9 Mon Sep 17 00:00:00 2001 From: Rd Date: Tue, 23 Jul 2024 11:03:26 +0530 Subject: [PATCH] Workflow cancellation with concurrency --- .github/workflows/build_tests.yml | 4 ++++ .github/workflows/main.yml | 4 ++++ .github/workflows/static_checks.yml | 4 ++++ .github/workflows/unit_tests.yml | 4 ++++ .github/workflows/workflow_canceller.yml | 23 ----------------------- 5 files changed, 16 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/workflow_canceller.yml diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 9e92486849b..1f293b1282b 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -10,6 +10,10 @@ on: # Push events on develop branch - develop +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: bazel_build_app: name: Build Binary with Bazel diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df9444d9da0..5d7fdc9cfd6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,10 @@ on: # Push events on develop branch - develop +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + # This workflow has the following jobs: # robolectric_tests: Robolectric tests for all modules except the app module # app_tests: Non-flaky Robolectric tests for the app module diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 7aaa1ee11ab..6f1d243ee14 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -9,6 +9,10 @@ on: branches: - develop +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: check_codeowners: name: Check CODEOWNERS & Repository files diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index fb8436dcc96..f1c3f259c3a 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -12,6 +12,10 @@ on: # Push events on develop branch - develop +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: bazel_compute_affected_targets: name: Compute affected tests diff --git a/.github/workflows/workflow_canceller.yml b/.github/workflows/workflow_canceller.yml deleted file mode 100644 index ece774a7e63..00000000000 --- a/.github/workflows/workflow_canceller.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Automatic Workflow Canceller - -# This workflow should be triggered in one of three situations: -# 1. Manual workflow dispatch via https://github.com/oppia/oppia-android/actions. -# 2. Upon creation of a PR & updates to that PR. -# -# Note that the action being used here automatically accounts for the current branch & the commit -# hash of the tip of the branch to ensure it doesn't cancel previous workflows that aren't related -# to the branch being evaluated. -on: - workflow_dispatch: - pull_request: - -jobs: - cancel: - name: Cancel Previous Runs - runs-on: ubuntu-20.04 - steps: - # See https://github.com/styfle/cancel-workflow-action for details on this workflow. - - uses: styfle/cancel-workflow-action@0.6.0 - with: - workflow_id: main.yml - access_token: ${{ github.token }}