From 639774662a2c03ca661da0e4f65620b291b5248f Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 23 Feb 2022 18:11:46 +0000 Subject: [PATCH] Add concurrency checks for unit tests, build and quality checks. --- .github/workflows/build.yml | 10 ++++++++++ .github/workflows/integration_tests.yml | 1 - .github/workflows/quality.yml | 15 +++++++++++++++ .github/workflows/tests.yml | 5 +++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91dc6d830b..1de7864a95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,11 @@ jobs: debug: name: Build debug APKs (${{ matrix.target }}) runs-on: ubuntu-latest + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('build-debug-develop-{0}', github.sha) || format('build-debug-{0}', github.ref) }} + cancel-in-progress: true if: github.ref != 'refs/heads/main' strategy: fail-fast: false @@ -42,6 +47,11 @@ jobs: release: name: Build unsigned GPlay APKs runs-on: ubuntu-latest + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('build-release-develop-{0}', github.sha) || format('build-release-{0}', github.ref) }} + cancel-in-progress: true if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 8a08dedb01..3f4fc5f779 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -1,4 +1,3 @@ -# no-op name: Integration Tests on: diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 69f17a3875..93e29bf394 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -18,6 +18,11 @@ jobs: ktlint: name: Kotlin Linter runs-on: ubuntu-latest + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('ktlint-develop-{0}', github.sha) || format('ktlint-{0}', github.ref) }} + cancel-in-progress: true steps: - uses: actions/checkout@v2 - name: Run ktlint @@ -87,6 +92,11 @@ jobs: android-lint: name: Android Linter runs-on: ubuntu-latest + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('android-lint-develop-{0}', github.sha) || format('android-lint-{0}', github.ref) }} + cancel-in-progress: true steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -111,6 +121,11 @@ jobs: apk-lint: name: Lint APK (${{ matrix.target }}) runs-on: ubuntu-latest + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('apk-lint-develop-{0}', github.sha) || format('apk-lint-{0}', github.ref) }} + cancel-in-progress: true if: github.ref != 'refs/heads/main' strategy: fail-fast: false diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 50195638de..13eb191680 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,6 +15,11 @@ jobs: unit-tests: name: Run Unit Tests runs-on: ubuntu-latest + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('test-unit-develop-{0}', github.sha) || format('test-unit-{0}', github.ref) }} + cancel-in-progress: true steps: - uses: actions/checkout@v2 - uses: actions/cache@v2