-
Notifications
You must be signed in to change notification settings - Fork 36
[DON-2137] Spike: Parallelize CI build workflow #2522
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
Changes from 5 commits
26f4a05
dbc28ae
5b6b422
0fe9373
743d137
28151c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,54 @@ env: | |
|
|
||
| jobs: | ||
|
|
||
| Build: | ||
| name: Build | ||
| # ============================================ | ||
| # PARALLEL JOB GROUP 1: Static Analysis & Tests | ||
| # These jobs run independently and in parallel | ||
| # ============================================ | ||
|
|
||
| StaticAnalysis: | ||
| name: DetektAndLint | ||
| runs-on: ubuntu-24.04-16cores-public | ||
| timeout-minutes: 30 | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up JDK | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'adopt' | ||
| cache: gradle | ||
|
|
||
| - name: Detekt check | ||
| run: ./gradlew detekt -PdisablePreDex | ||
|
|
||
| - name: Lint check | ||
| run: ./gradlew lint${{ env.flavour }}${{ env.config }} -PdisablePreDex | ||
|
|
||
| UnitTests: | ||
| name: Unit Tests | ||
| runs-on: ubuntu-24.04-16cores-public | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up JDK | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'adopt' | ||
| cache: gradle | ||
|
|
||
| - name: Unit Tests | ||
| run: ./gradlew test${{ env.flavour }}${{ env.config }}UnitTest -PdisablePreDex | ||
|
|
||
| BuildAndTokens: | ||
| name: Build & Tokens | ||
| runs-on: ubuntu-24.04-16cores-public | ||
| timeout-minutes: 20 | ||
| permissions: | ||
| statuses: write | ||
| pull-requests: write | ||
|
|
@@ -96,14 +140,10 @@ jobs: | |
| git diff-index --quiet HEAD || git commit -m "Update tokens" | ||
| git push | ||
|
|
||
| - name: Detekt check | ||
| run: ./gradlew detekt -PdisablePreDex | ||
|
|
||
| - name: Lint check | ||
| run: ./gradlew lint${{ env.flavour }}${{ env.config }} -PdisablePreDex | ||
|
|
||
| - name: Unit Tests | ||
| run: ./gradlew test${{ env.flavour }}${{ env.config }}UnitTest -PdisablePreDex | ||
| # ============================================ | ||
| # PARALLEL JOB GROUP 2: Instrumented Tests | ||
| # These jobs also run in parallel with Group 1 | ||
| # ============================================ | ||
|
|
||
| Android: | ||
| name: Android tests | ||
|
|
@@ -169,13 +209,59 @@ jobs: | |
|
|
||
| ./gradlew :Backpack:connected${{ env.config }}AndroidTest :backpack-compose:connected${{ env.config }}AndroidTest :backpack-common:connected${{ env.config }}AndroidTest && killall -INT crashpad_handler || true | ||
|
|
||
| # ============================================ | ||
| # Screenshot Tests - Parallelized by Variant | ||
| # Each variant runs independently to reduce wall-clock time | ||
| # Using matrix strategy to eliminate duplication | ||
| # ============================================ | ||
|
|
||
| Screenshots: | ||
| name: Screenshots tests | ||
| name: Screenshots (${{ matrix.variant.name }}) | ||
| runs-on: ubuntu-24.04-16cores-public | ||
| timeout-minutes: 10 | ||
| strategy: | ||
| matrix: | ||
| variant: | ||
| - name: default | ||
| flag: default | ||
| - name: dark mode | ||
| flag: dm | ||
| - name: RTL | ||
| flag: rtl | ||
| - name: themed | ||
| flag: themed | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a blocker
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is possible to extract variant from
My recommendation: |
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up JDK | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'adopt' | ||
| cache: gradle | ||
|
|
||
| - name: Screenshot Tests - ${{ matrix.variant.name }} | ||
| run: | | ||
| set -e | ||
| rm -rf app/screenshots/oss | ||
peterInTown marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ./gradlew app:recordRoborazziOssDebug -Dvariant=${{ matrix.variant.flag }} | ||
|
|
||
| - name: Upload Screenshots | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: screenshots-${{ matrix.variant.flag }} | ||
| path: app/screenshots/ | ||
| retention-days: 1 | ||
|
|
||
| Screenshots-Collect: | ||
| name: Collect & commit screenshots | ||
| runs-on: ubuntu-24.04-16cores-public | ||
| needs: Screenshots | ||
| permissions: | ||
| pull-requests: write | ||
| contents: write | ||
| timeout-minutes: 20 | ||
| timeout-minutes: 5 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we confident about dropping the timeout to 5 minutes? That’s a pretty aggressive reduction (20 → 5). If we’re confident that, after splitting, each job will consistently finish within 5 minutes, then I’m happy to keep it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why 5 minutes should be sufficient:
Why it was safe to reduce:
|
||
| steps: | ||
| - uses: actions/create-github-app-token@v2 | ||
| id: app-token | ||
|
|
@@ -188,18 +274,28 @@ jobs: | |
| with: | ||
| token: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| - name: Set up JDK | ||
| uses: actions/setup-java@v5 | ||
| - name: Download all screenshot artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'adopt' | ||
| cache: gradle | ||
| path: screenshot-artifacts | ||
|
|
||
| - name: Screenshot Tests | ||
| id: screenshotTests | ||
| - name: Merge screenshot results | ||
peterInTown marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| id: mergeScreenshots | ||
| run: | | ||
| set -e | ||
| ./scripts/record_screenshot_tests.sh | ||
| rm -rf app/screenshots/oss | ||
| mkdir -p app/screenshots/oss | ||
|
|
||
| # Copy all screenshots from artifacts with error checking | ||
| for variant in default dm rtl themed; do | ||
| artifact_dir="screenshot-artifacts/screenshots-$variant/oss" | ||
| if [ -d "$artifact_dir" ] && compgen -G "$artifact_dir/*" > /dev/null; then | ||
| echo "Copying screenshots for variant: $variant" | ||
| cp -r "$artifact_dir"/* app/screenshots/oss/ | ||
| else | ||
| echo "Warning: No screenshots found for variant: $variant" | ||
| fi | ||
| done | ||
|
|
||
| changedFiles=`git status --porcelain` && echo "CHANGED_FILES=${changedFiles//$'\n'/'%0A'}" >> $GITHUB_OUTPUT | ||
|
|
||
|
|
@@ -209,7 +305,7 @@ jobs: | |
| run: ./scripts/check-no-changes.sh | ||
|
|
||
| - name: Commit changes | ||
| if: ${{ github.event_name == 'pull_request' && steps.screenshotTests.outputs.CHANGED_FILES != '' }} | ||
| if: ${{ github.event_name == 'pull_request' && steps.mergeScreenshots.outputs.CHANGED_FILES != '' }} | ||
| run: | | ||
| git config --local user.email "197108191+skyscanner-backpack-bot[bot]@users.noreply.github.com" | ||
| git config --local user.name "skyscanner-backpack-bot[bot]" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.