From 43c125ed32b6aafa67cef948988593bb8c6dd5a3 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 23 Feb 2022 22:16:24 +0000 Subject: [PATCH] Use matrix.target to fix build group. Use env vars to clean up. --- .github/workflows/build.yml | 13 ++++++------- .github/workflows/integration_tests.yml | 17 +++++++---------- .github/workflows/quality.yml | 18 +++++++++--------- .github/workflows/tests.yml | 9 +++++---- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1de7864a95..7935344232 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,15 +10,16 @@ env: CI_GRADLE_ARG_PROPERTIES: > -Porg.gradle.jvmargs=-Xmx2g -Porg.gradle.parallel=false - + CI_ANY_MAIN: ${{ github.ref == 'refs/heads/main' && format('main-{0}', github.sha) }} + CI_ANY_DEVELOP: ${{ github.ref == 'refs/heads/develop' && format('develop-{0}', github.sha) }} + CI_ONE_PR: ${{ format('build-debug-{0}-{1}', matrix.target, github.ref) }} + CI_GROUP_SUFFIX: ${{ CI_ANY_MAIN || CI_ANY_DEVELOP || CI_ONE_PR }} 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) }} + group: ${{ format('build-debug-{0}-{1}', matrix.target, CI_GROUP_SUFFIX) }} cancel-in-progress: true if: github.ref != 'refs/heads/main' strategy: @@ -48,9 +49,7 @@ jobs: 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) }} + group: ${{ format('build-release-{0}-{1}', matrix.target, CI_GROUP_SUFFIX) }} cancel-in-progress: true if: github.ref == 'refs/heads/main' steps: diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 8a08dedb01..ca024b7be1 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -1,4 +1,3 @@ -# no-op name: Integration Tests on: @@ -11,6 +10,10 @@ env: CI_GRADLE_ARG_PROPERTIES: > -Porg.gradle.jvmargs=-Xmx2g -Porg.gradle.parallel=false + CI_ANY_MAIN: ${{ github.ref == 'refs/heads/main' && format('main-{0}', github.sha) }} + CI_ANY_DEVELOP: ${{ github.ref == 'refs/heads/develop' && format('develop-{0}', github.sha) }} + CI_ONE_PR: ${{ format('build-debug-{0}-{1}', matrix.target, github.ref) }} + CI_GROUP_SUFFIX: ${{ CI_ANY_MAIN || CI_ANY_DEVELOP || CI_ONE_PR }} jobs: # Build Android Tests [Matrix SDK] @@ -18,9 +21,7 @@ jobs: name: Matrix SDK - Build Android 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-matrix-sdk-develop-{0}', github.sha) || format('test-matrix-sdk-{0}', github.ref) }} + group: ${{ format('test-matrix-sdk-{0}', CI_GROUP_SUFFIX) }} cancel-in-progress: true steps: - uses: actions/checkout@v2 @@ -40,9 +41,7 @@ jobs: name: App - Build Android 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-app-develop-{0}', github.sha) || format('test-app-{0}', github.ref) }} + group: ${{ format('test-app-{0}', CI_GROUP_SUFFIX) }} cancel-in-progress: true steps: - uses: actions/checkout@v2 @@ -62,9 +61,7 @@ jobs: name: Matrix SDK - Running Integration 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('integration-tests-develop-{0}', github.sha) || format('integration-tests-{0}', github.ref) }} + group: ${{ format('integration-tests-{0}', CI_GROUP_SUFFIX) }} cancel-in-progress: true strategy: fail-fast: false diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 93e29bf394..6cfb0d7f05 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -5,6 +5,12 @@ on: push: branches: [ main, develop ] +env: + CI_ANY_MAIN: ${{ github.ref == 'refs/heads/main' && format('main-{0}', github.sha) }} + CI_ANY_DEVELOP: ${{ github.ref == 'refs/heads/develop' && format('develop-{0}', github.sha) }} + CI_ONE_PR: ${{ format('build-debug-{0}-{1}', matrix.target, github.ref) }} + CI_GROUP_SUFFIX: ${{ CI_ANY_MAIN || CI_ANY_DEVELOP || CI_ONE_PR }} + jobs: check: name: Project Check Suite @@ -19,9 +25,7 @@ jobs: 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) }} + group: ${{ format('klint-{0}', CI_GROUP_SUFFIX) }} cancel-in-progress: true steps: - uses: actions/checkout@v2 @@ -93,9 +97,7 @@ jobs: 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) }} + group: ${{ format('android-lint-{0}', CI_GROUP_SUFFIX) }} cancel-in-progress: true steps: - uses: actions/checkout@v2 @@ -122,9 +124,7 @@ jobs: 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) }} + group: ${{ format('apk-lint-{0}', CI_GROUP_SUFFIX) }} cancel-in-progress: true if: github.ref != 'refs/heads/main' strategy: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13eb191680..2ae26e32dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,15 +10,16 @@ env: CI_GRADLE_ARG_PROPERTIES: > -Porg.gradle.jvmargs=-Xmx2g -Porg.gradle.parallel=false - + CI_ANY_MAIN: ${{ github.ref == 'refs/heads/main' && format('main-{0}', github.sha) }} + CI_ANY_DEVELOP: ${{ github.ref == 'refs/heads/develop' && format('develop-{0}', github.sha) }} + CI_ONE_PR: ${{ format('build-debug-{0}-{1}', matrix.target, github.ref) }} + CI_GROUP_SUFFIX: ${{ CI_ANY_MAIN || CI_ANY_DEVELOP || CI_ONE_PR }} 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) }} + group: ${{ format('unit-tests-{0}', CI_GROUP_SUFFIX) }} cancel-in-progress: true steps: - uses: actions/checkout@v2