Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2711 & part of #5343: Workflow cancellation support in CI using concurrency #5466

Merged
merged 21 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f1bafb2
Workflow cancellation with concurrency
Rd4dev Jul 23, 2024
1bd7dc0
Trigger #1 Triggering CI builds to check workflow cancellations with …
Rd4dev Jul 23, 2024
9ea4511
Trigger #2 Triggering CI builds #1 worked as expected with 75% of wor…
Rd4dev Jul 23, 2024
c215fdc
Trigger #3 Triggering CI builds #2 worked as expected with 20% of wor…
Rd4dev Jul 23, 2024
66816be
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Jul 24, 2024
dc1ab3b
Trigger Build to observe how Non-app module checks gets cut off
Rd4dev Jul 28, 2024
ef9f571
Triggering at Utility Build stage after Build Apps step is over
Rd4dev Jul 28, 2024
3398359
Trigger Build before Build App stage
Rd4dev Jul 28, 2024
0ee5f80
Triggering instance to see if always is causing the delay
Rd4dev Jul 28, 2024
2118891
Triggering to see if always is causing the delay with Static Checks
Rd4dev Jul 28, 2024
e9c3d60
Replacing always with !cancelled to not get affected by success and f…
Rd4dev Jul 28, 2024
6f54fd0
Triggering immediately after replacing always with !cancelled to see …
Rd4dev Jul 28, 2024
11a0560
Adding !cancelled to unit tests Check Results job while having a forc…
Rd4dev Jul 28, 2024
5eabb1d
Triggering after the TestFileCheck failure run
Rd4dev Jul 28, 2024
20d9450
Replacing all always expressions with !cancelled since the unit test …
Rd4dev Jul 28, 2024
125d30e
Triggering immediately after replacing every always expression to con…
Rd4dev Jul 28, 2024
10778b9
Triggering to confirm every job is getting cancelled immediately with…
Rd4dev Jul 28, 2024
6e5112f
Added in-line comments for explaining the introduction of if: {{ !can…
Rd4dev Jul 28, 2024
e73ae04
Added missed out period at the end of the in line comments
Rd4dev Jul 28, 2024
076687e
Triggering since a Run app module job was failing
Rd4dev Jul 28, 2024
e9ebf29
Triggering once again inbetween the previous check to confirm they ge…
Rd4dev Jul 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 24 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -54,45 +58,53 @@ jobs:
run: sudo ./gradlew --full-stacktrace assembleDebug -Dorg.gradle.java.home=$JAVA_HOME

- name: Utility tests
if: always()
# 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: ${{ always() }} # 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
if: always()
# 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: ${{ always() }} # 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
if: always()
# 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: ${{ always() }} # 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
if: always()
# 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: ${{ always() }} # 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
Expand Down Expand Up @@ -133,15 +145,17 @@ 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 success or failure status
with:
name: app reports ${{ matrix.shard }}
path: app/build/reports

app_tests:
name: App Module Robolectric Tests
needs: run_app_module_test
if: ${{ always() }}
# 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:
matrix:
Expand Down
44 changes: 34 additions & 10 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -151,39 +155,53 @@ jobs:
shell: bash

- name: Regex Patterns Validation Check
if: always()
# 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() }}
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
run: |
bazel run //scripts:regex_pattern_validation_check -- $(pwd)

- name: XML Syntax Validation Check
if: always()
# 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
if: always()
# 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
if: always()
# 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
if: always()
# 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
if: always()
# 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 }}
run: |
bazel run //scripts:todo_open_check -- $(pwd) scripts/assets/todo_open_exemptions.pb

- name: String Resource Validation Check
if: always()
# 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)

Expand All @@ -202,16 +220,22 @@ jobs:
version: 6.5.0

- name: Maven Repin Check
if: always()
# 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
if: always()
# 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
if: always()
# 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
8 changes: 7 additions & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -320,7 +324,9 @@ jobs:
check_test_results:
name: Check Bazel Test Results
needs: [bazel_compute_affected_targets, bazel_run_test]
if: ${{ always() }}
# 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:
# This step will be skipped if there are no tests to run, so the overall job should pass.
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/workflow_canceller.yml

This file was deleted.

Loading