From f1bafb28d98aa8f43000deb8439c48a78174fff9 Mon Sep 17 00:00:00 2001 From: Rd Date: Tue, 23 Jul 2024 11:03:26 +0530 Subject: [PATCH 01/20] 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 }} From 1bd7dc0a308e9f890706f8bb6a63091bb855ef06 Mon Sep 17 00:00:00 2001 From: Rd Date: Tue, 23 Jul 2024 11:45:33 +0530 Subject: [PATCH 02/20] Trigger #1 Triggering CI builds to check workflow cancellations with concurrency --- scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt | 1 + .../src/main/java/org/oppia/android/util/math/MathTokenizer.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt b/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt index 8c3c546f026..8c51ec7f768 100644 --- a/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt +++ b/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt @@ -241,3 +241,4 @@ private fun String.findOccurrencesOf(needle: String): List { } return indexes } + diff --git a/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt b/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt index 3f378f5de7f..3bfcd5c32bd 100644 --- a/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt +++ b/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt @@ -439,3 +439,4 @@ class MathTokenizer private constructor() { } } } + From 9ea4511e0d35a333f473183cea1b288f17a3e9dd Mon Sep 17 00:00:00 2001 From: Rd Date: Tue, 23 Jul 2024 11:53:40 +0530 Subject: [PATCH 03/20] Trigger #2 Triggering CI builds #1 worked as expected with 75% of workflows ran and 25% in progress and every in progress got cancelled on Trigger #1 --- scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt | 1 + .../src/main/java/org/oppia/android/util/math/MathTokenizer.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt b/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt index 8c51ec7f768..d0abda6ca0f 100644 --- a/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt +++ b/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt @@ -242,3 +242,4 @@ private fun String.findOccurrencesOf(needle: String): List { return indexes } + diff --git a/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt b/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt index 3bfcd5c32bd..a529864c5cd 100644 --- a/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt +++ b/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt @@ -440,3 +440,4 @@ class MathTokenizer private constructor() { } } + From c215fdc24c5ce10edc26ccab1cbd19ca151fd100 Mon Sep 17 00:00:00 2001 From: Rd Date: Tue, 23 Jul 2024 12:01:40 +0530 Subject: [PATCH 04/20] Trigger #3 Triggering CI builds #2 worked as expected with 20% of workflows ran and 80% in progress and every in progress got cancelled on Trigger #2 --- .../src/java/org/oppia/android/scripts/common/BazelClient.kt | 2 -- .../src/main/java/org/oppia/android/util/math/MathTokenizer.kt | 2 -- 2 files changed, 4 deletions(-) diff --git a/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt b/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt index d0abda6ca0f..8c3c546f026 100644 --- a/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt +++ b/scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt @@ -241,5 +241,3 @@ private fun String.findOccurrencesOf(needle: String): List { } return indexes } - - diff --git a/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt b/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt index a529864c5cd..3f378f5de7f 100644 --- a/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt +++ b/utility/src/main/java/org/oppia/android/util/math/MathTokenizer.kt @@ -439,5 +439,3 @@ class MathTokenizer private constructor() { } } } - - From dc1ab3b1e9800e4e8f8b4848aad6a9e02782092b Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 12:22:15 +0530 Subject: [PATCH 05/20] Trigger Build to observe how Non-app module checks gets cut off From ef9f571f32e6adc2cc49119e8d47f3fd5fca2bb1 Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 12:31:31 +0530 Subject: [PATCH 06/20] Triggering at Utility Build stage after Build Apps step is over From 3398359b6d5d0c82489d46638d2e1bbba2ef6cc3 Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 12:37:05 +0530 Subject: [PATCH 07/20] Trigger Build before Build App stage Triggering build after Build App at Utility test stage had the same behaviour of delaying the cut off and it even started the Data tests stage and stopped there From 0ee5f801651459af544c500980c4c208202651f3 Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 14:09:27 +0530 Subject: [PATCH 08/20] Triggering instance to see if always is causing the delay From 2118891d3a988e9fe8b201402a69abb2d3ac2bd3 Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 14:09:49 +0530 Subject: [PATCH 09/20] Triggering to see if always is causing the delay with Static Checks From e9c3d60b49ef4459de97a70a44df53ebaff10b5a Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 15:03:47 +0530 Subject: [PATCH 10/20] Replacing always with !cancelled to not get affected by success and failure cases but still consider cancellations --- .github/workflows/static_checks.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 6f1d243ee14..8bc5d8db7dc 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -155,39 +155,39 @@ jobs: shell: bash - name: Regex Patterns Validation Check - if: always() + if: ${{ !cancelled() }} run: | bazel run //scripts:regex_pattern_validation_check -- $(pwd) - name: XML Syntax Validation Check - if: always() + if: ${{ !cancelled() }} run: | bazel run //scripts:xml_syntax_check -- $(pwd) - name: Testfile Presence Check - if: always() + if: ${{ !cancelled() }} run: | bazel run //scripts:test_file_check -- $(pwd) - name: Accessibility label Check - if: always() + if: ${{ !cancelled() }} run: | bazel run //scripts:accessibility_label_check -- $(pwd) scripts/assets/accessibility_label_exemptions.pb app/src/main/AndroidManifest.xml - name: KDoc Validation Check - if: always() + if: ${{ !cancelled() }} run: | bazel run //scripts:kdoc_validity_check -- $(pwd) scripts/assets/kdoc_validity_exemptions.pb - name: Todo Check - if: always() + if: ${{ !cancelled() }} env: GITHUB_TOKEN: ${{ github.token }} run: | bazel run //scripts:todo_open_check -- $(pwd) scripts/assets/todo_open_exemptions.pb - name: String Resource Validation Check - if: always() + if: ${{ !cancelled() }} run: | bazel run //scripts:string_resource_validation_check -- $(pwd) @@ -206,16 +206,16 @@ jobs: version: 6.5.0 - name: Maven Repin Check - if: always() + if: ${{ !cancelled() }} run: | REPIN=1 bazel run @unpinned_maven//:pin - name: Maven Dependencies Update Check - if: always() + if: ${{ !cancelled() }} run: | bazel run //scripts:maven_dependencies_list_check -- $(pwd) third_party/maven_install.json scripts/assets/maven_dependencies.pb - name: License Texts Check - if: always() + if: ${{ !cancelled() }} run: | bazel run //scripts:license_texts_check -- $(pwd)/app/src/main/res/values/third_party_dependencies.xml From 6f54fd08d1c9acecfbf8bc18e391a23cf55dc564 Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 15:04:24 +0530 Subject: [PATCH 11/20] Triggering immediately after replacing always with !cancelled to see if they are getting properly cancelled From 11a0560766df052aeec14d7e7813962a4acde66e Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 15:09:42 +0530 Subject: [PATCH 12/20] Adding !cancelled to unit tests Check Results job while having a forced failure for TestFileCheck This should fail the test and eventually call the Check Result job inspite of the failure. If it does then the !cancelled is working as intended replacing always --- .github/workflows/unit_tests.yml | 2 +- .../java/org/oppia/android/scripts/testfile/TestFileCheck.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index f1c3f259c3a..c5668f21ed9 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -324,7 +324,7 @@ jobs: check_test_results: name: Check Bazel Test Results needs: [bazel_compute_affected_targets, bazel_run_test] - if: ${{ always() }} + if: ${{ !cancelled() }} runs-on: ubuntu-20.04 steps: # This step will be skipped if there are no tests to run, so the overall job should pass. diff --git a/scripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt b/scripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt index c14ac3dcf78..1858adde8b6 100644 --- a/scripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt +++ b/scripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt @@ -75,7 +75,7 @@ class TestFileCheck( if (matchedFiles.isNotEmpty()) { throw Exception("TEST FILE CHECK FAILED") } else { - println("TEST FILE CHECK PASSED") + println("TEST FILE CHECK PASED") } } } From 5eabb1d172b8d8e1b0002df768e94a0e9deac742 Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 15:10:35 +0530 Subject: [PATCH 13/20] Triggering after the TestFileCheck failure run From 20d94502684909a1f7ed2dedacc25861b9a49179 Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 15:22:24 +0530 Subject: [PATCH 14/20] Replacing all always expressions with !cancelled since the unit test Check Results calls did get triggered even after failure cases --- .github/workflows/main.yml | 20 +++++++++---------- .../android/scripts/testfile/TestFileCheck.kt | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d7fdc9cfd6..63e3ee56209 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,45 +58,45 @@ jobs: run: sudo ./gradlew --full-stacktrace assembleDebug -Dorg.gradle.java.home=$JAVA_HOME - name: Utility tests - if: always() + if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :utility:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME - name: Upload Utility Test Reports uses: actions/upload-artifact@v2 - if: ${{ always() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status with: name: utility reports path: utility/build/reports - name: Data tests - if: always() + if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :data:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME - name: Upload Data Test Reports uses: actions/upload-artifact@v2 - if: ${{ always() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status with: name: data reports path: data/build/reports - name: Domain tests - if: always() + if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :domain:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME - name: Upload Domain Test Reports uses: actions/upload-artifact@v2 - if: ${{ always() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status with: name: domain reports path: domain/build/reports - name: Testing tests - if: always() + if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :testing:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME - name: Upload Testing Test Reports uses: actions/upload-artifact@v2 - if: ${{ always() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status with: name: testing reports path: testing/build/reports @@ -137,7 +137,7 @@ jobs: sudo ./gradlew --full-stacktrace :app:testDebugUnitTest --${{ matrix.shard }} -Dorg.gradle.java.home=$JAVA_HOME - name: Upload App Test Reports uses: actions/upload-artifact@v2 - if: ${{ always() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status with: name: app reports ${{ matrix.shard }} path: app/build/reports @@ -145,7 +145,7 @@ jobs: app_tests: name: App Module Robolectric Tests needs: run_app_module_test - if: ${{ always() }} + if: ${{ !cancelled() }} runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/scripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt b/scripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt index 1858adde8b6..c14ac3dcf78 100644 --- a/scripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt +++ b/scripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt @@ -75,7 +75,7 @@ class TestFileCheck( if (matchedFiles.isNotEmpty()) { throw Exception("TEST FILE CHECK FAILED") } else { - println("TEST FILE CHECK PASED") + println("TEST FILE CHECK PASSED") } } } From 125d30e1f0816efbde4199514c19a508b437254c Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 15:24:04 +0530 Subject: [PATCH 15/20] Triggering immediately after replacing every always expression to confirm the Non-app module steps too does work in the way it is desired to be From 10778b98276ccd67127078515b8eb7673ca44fe0 Mon Sep 17 00:00:00 2001 From: Rd Date: Sun, 28 Jul 2024 15:37:40 +0530 Subject: [PATCH 16/20] Triggering to confirm every job is getting cancelled immediately without delay From 6e5112f0705f8d27c35f80c998e6576c45a4a751 Mon Sep 17 00:00:00 2001 From: Rd Date: Mon, 29 Jul 2024 02:45:49 +0530 Subject: [PATCH 17/20] Added in-line comments for explaining the introduction of if: {{ !cancelled() }} --- .github/workflows/main.yml | 20 +++++++++++++++----- .github/workflows/static_checks.yml | 20 ++++++++++++++++++++ .github/workflows/unit_tests.yml | 2 ++ 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63e3ee56209..9a48bb731e0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,45 +58,53 @@ jobs: run: sudo ./gradlew --full-stacktrace assembleDebug -Dorg.gradle.java.home=$JAVA_HOME - name: Utility tests + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :utility:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME - name: Upload Utility Test Reports uses: actions/upload-artifact@v2 - if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of success or failure status with: name: utility reports path: utility/build/reports - name: Data tests + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :data:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME - name: Upload Data Test Reports uses: actions/upload-artifact@v2 - if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of success or failure status with: name: data reports path: data/build/reports - name: Domain tests + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :domain:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME - name: Upload Domain Test Reports uses: actions/upload-artifact@v2 - if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of success or failure status with: name: domain reports path: domain/build/reports - name: Testing tests + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :testing:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME - name: Upload Testing Test Reports uses: actions/upload-artifact@v2 - if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of success or failure status with: name: testing reports path: testing/build/reports @@ -137,7 +145,7 @@ jobs: sudo ./gradlew --full-stacktrace :app:testDebugUnitTest --${{ matrix.shard }} -Dorg.gradle.java.home=$JAVA_HOME - name: Upload App Test Reports uses: actions/upload-artifact@v2 - if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of status + if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of success or failure status with: name: app reports ${{ matrix.shard }} path: app/build/reports @@ -145,6 +153,8 @@ jobs: app_tests: name: App Module Robolectric Tests needs: run_app_module_test + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} runs-on: ${{ matrix.os }} strategy: diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 8bc5d8db7dc..4fd3d2d27f4 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -155,31 +155,43 @@ jobs: shell: bash - name: Regex Patterns Validation Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | bazel run //scripts:regex_pattern_validation_check -- $(pwd) - name: XML Syntax Validation Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | bazel run //scripts:xml_syntax_check -- $(pwd) - name: Testfile Presence Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | bazel run //scripts:test_file_check -- $(pwd) - name: Accessibility label Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | bazel run //scripts:accessibility_label_check -- $(pwd) scripts/assets/accessibility_label_exemptions.pb app/src/main/AndroidManifest.xml - name: KDoc Validation Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | bazel run //scripts:kdoc_validity_check -- $(pwd) scripts/assets/kdoc_validity_exemptions.pb - name: Todo Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} env: GITHUB_TOKEN: ${{ github.token }} @@ -187,6 +199,8 @@ jobs: bazel run //scripts:todo_open_check -- $(pwd) scripts/assets/todo_open_exemptions.pb - name: String Resource Validation Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | bazel run //scripts:string_resource_validation_check -- $(pwd) @@ -206,16 +220,22 @@ jobs: version: 6.5.0 - name: Maven Repin Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | REPIN=1 bazel run @unpinned_maven//:pin - name: Maven Dependencies Update Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | bazel run //scripts:maven_dependencies_list_check -- $(pwd) third_party/maven_install.json scripts/assets/maven_dependencies.pb - name: License Texts Check + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} run: | bazel run //scripts:license_texts_check -- $(pwd)/app/src/main/res/values/third_party_dependencies.xml diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c5668f21ed9..5cd5280a7c7 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -324,6 +324,8 @@ jobs: check_test_results: name: Check Bazel Test Results needs: [bazel_compute_affected_targets, bazel_run_test] + # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows if: ${{ !cancelled() }} runs-on: ubuntu-20.04 steps: From e73ae048477ffebe99da719a449554fe04d41b7e Mon Sep 17 00:00:00 2001 From: Rd Date: Mon, 29 Jul 2024 02:58:37 +0530 Subject: [PATCH 18/20] Added missed out period at the end of the in line comments --- .github/workflows/main.yml | 10 +++++----- .github/workflows/static_checks.yml | 20 ++++++++++---------- .github/workflows/unit_tests.yml | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a48bb731e0..ed6cd752264 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: - name: Utility tests # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :utility:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME @@ -72,7 +72,7 @@ jobs: - name: Data tests # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :data:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME @@ -85,7 +85,7 @@ jobs: - name: Domain tests # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :domain:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME @@ -98,7 +98,7 @@ jobs: - name: Testing tests # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} # We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 run: sudo ./gradlew --full-stacktrace :testing:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME @@ -154,7 +154,7 @@ jobs: name: App Module Robolectric Tests needs: run_app_module_test # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} runs-on: ${{ matrix.os }} strategy: diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 4fd3d2d27f4..1f9500c1dfc 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -156,42 +156,42 @@ jobs: - name: Regex Patterns Validation Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | bazel run //scripts:regex_pattern_validation_check -- $(pwd) - name: XML Syntax Validation Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | bazel run //scripts:xml_syntax_check -- $(pwd) - name: Testfile Presence Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | bazel run //scripts:test_file_check -- $(pwd) - name: Accessibility label Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | bazel run //scripts:accessibility_label_check -- $(pwd) scripts/assets/accessibility_label_exemptions.pb app/src/main/AndroidManifest.xml - name: KDoc Validation Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | bazel run //scripts:kdoc_validity_check -- $(pwd) scripts/assets/kdoc_validity_exemptions.pb - name: Todo Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} env: GITHUB_TOKEN: ${{ github.token }} @@ -200,7 +200,7 @@ jobs: - name: String Resource Validation Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | bazel run //scripts:string_resource_validation_check -- $(pwd) @@ -221,21 +221,21 @@ jobs: - name: Maven Repin Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | REPIN=1 bazel run @unpinned_maven//:pin - name: Maven Dependencies Update Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | bazel run //scripts:maven_dependencies_list_check -- $(pwd) third_party/maven_install.json scripts/assets/maven_dependencies.pb - name: License Texts Check # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} run: | bazel run //scripts:license_texts_check -- $(pwd)/app/src/main/res/values/third_party_dependencies.xml diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 5cd5280a7c7..f59a5b9bee7 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -325,7 +325,7 @@ jobs: name: Check Bazel Test Results needs: [bazel_compute_affected_targets, bazel_run_test] # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, - # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows + # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. if: ${{ !cancelled() }} runs-on: ubuntu-20.04 steps: From 076687e087c061141f8d8bbd900690949b600586 Mon Sep 17 00:00:00 2001 From: Rd Date: Mon, 29 Jul 2024 03:03:49 +0530 Subject: [PATCH 19/20] Triggering since a Run app module job was failing From e9ebf2958bc35e2f6e168cfe23e2079371bda637 Mon Sep 17 00:00:00 2001 From: Rd Date: Mon, 29 Jul 2024 03:13:01 +0530 Subject: [PATCH 20/20] Triggering once again inbetween the previous check to confirm they get cancelled in progress properly