-
Notifications
You must be signed in to change notification settings - Fork 77
ci: per-app build matrix with precise path triggers #1112
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
Open
msluszniak
wants to merge
13
commits into
main
Choose a base branch
from
@ms/ci-coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6e4cdb9
ci: add per-app build matrix with precise path triggers
msluszniak 471403f
ci: compact path filters with brace expansion
msluszniak 12385c0
ci: build workspace packages before running bare-rn jest
msluszniak ecbf706
ci: merge Android + iOS workflows into one with single filter block
msluszniak dd34770
test(bare-rn): mock native packages so smoke test can render
msluszniak c9d2a9f
ci: use generic iOS Simulator destination so build doesn't need a spe…
msluszniak 2c68b80
ci: add Metro bundle check matrix to catch JS errors before native build
msluszniak d1af2ed
ci: fail lint when source files aren't covered by build-apps filter
msluszniak 9aef7d0
ci: skip already-passing app builds via content-hash cache marker
msluszniak dbb8737
ci: bare-rn bundle prep, Pods cache, exclude workflow file from build…
msluszniak cfcd199
ci: rewrite filter-coverage and app-hash scripts in TypeScript
msluszniak bb64376
ci: cover pose_estimation and privacy_filter in build-apps filters
msluszniak cf4fdb9
ci: address review — dedupe prepare step, pin Pods cache to v5, justi…
msluszniak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| name: Build Android app | ||
| description: Build an Android demo app from this monorepo (with optional Expo prebuild) | ||
|
|
||
| inputs: | ||
| app-path: | ||
| description: Path to the app workspace, relative to the repo root (e.g. apps/llm) | ||
| required: true | ||
| expo-prebuild: | ||
| description: Whether to run `expo prebuild --platform android` before the Gradle build | ||
| required: false | ||
| default: "true" | ||
| filter-name: | ||
| description: dorny/paths-filter filter name for this app+platform (e.g. llm-android). Used as the content-hash cache key so a previously-passing build can be skipped if nothing relevant has changed. | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| cache: "yarn" | ||
|
|
||
| - name: Install root dependencies | ||
| shell: bash | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Compute build hash | ||
| id: hash | ||
| shell: bash | ||
| run: | | ||
| h=$(npx ts-node scripts/compute-app-hash.ts "${{ inputs.filter-name }}") | ||
| echo "key=build-${{ inputs.filter-name }}-$h" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Lookup pass marker | ||
| id: cache | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: ${{ runner.temp }}/ci-marker | ||
| key: ${{ steps.hash.outputs.key }} | ||
| lookup-only: true | ||
|
|
||
| - name: Skip notice | ||
| if: steps.cache.outputs.cache-hit == 'true' | ||
| shell: bash | ||
| run: echo "Skipping build — ${{ inputs.filter-name }} already passed at this content hash." | ||
|
|
||
| # ubuntu-latest ships with ~14 GB free, but a full Android build for any of | ||
| # the demo apps (Gradle cache + ExecuTorch native build + node_modules + | ||
| # third-party libs) regularly exceeds that and fails with "no space left on | ||
| # device". Reclaim ~10 GB by removing toolchains we don't use here. | ||
| - name: Free disk space | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| run: | | ||
| sudo rm -rf /usr/share/dotnet | ||
| sudo rm -rf /opt/ghc | ||
| sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
| sudo docker system prune -af | ||
|
|
||
| - name: Setup Java 17 | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: "zulu" | ||
| java-version: 17 | ||
| cache: "gradle" | ||
|
|
||
| - name: Install Expo CLI | ||
| if: steps.cache.outputs.cache-hit != 'true' && inputs.expo-prebuild == 'true' | ||
| shell: bash | ||
| run: | | ||
| npm install -g @expo/cli | ||
| echo "$(npm prefix -g)/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Generate native Android project | ||
| if: steps.cache.outputs.cache-hit != 'true' && inputs.expo-prebuild == 'true' | ||
| working-directory: ${{ inputs.app-path }} | ||
| shell: bash | ||
| run: | | ||
| rm -rf android | ||
| npx expo prebuild --platform android --no-install | ||
|
|
||
| - name: Cache Gradle | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| ${{ inputs.app-path }}/android/.gradle | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| - name: Build app | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| working-directory: ${{ inputs.app-path }}/android | ||
| shell: bash | ||
| run: | | ||
| ./gradlew assembleDebug \ | ||
| --build-cache \ | ||
| --parallel \ | ||
| --daemon \ | ||
| --configure-on-demand \ | ||
| -PreactNativeArchitectures=arm64-v8a \ | ||
| -Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError" \ | ||
| -Dorg.gradle.workers.max=4 | ||
|
|
||
| - name: Save pass marker | ||
| if: steps.cache.outputs.cache-hit != 'true' && success() | ||
| shell: bash | ||
| run: | | ||
| mkdir -p "${{ runner.temp }}/ci-marker" | ||
| touch "${{ runner.temp }}/ci-marker/passed" | ||
|
|
||
| - name: Cache pass marker | ||
| if: steps.cache.outputs.cache-hit != 'true' && success() | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: ${{ runner.temp }}/ci-marker | ||
| key: ${{ steps.hash.outputs.key }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| name: Build iOS app | ||
| description: Build an iOS demo app from this monorepo (with optional Expo prebuild) | ||
|
|
||
| inputs: | ||
| app-path: | ||
| description: Path to the app workspace, relative to the repo root (e.g. apps/llm) | ||
| required: true | ||
| expo-prebuild: | ||
| description: Whether to run `expo prebuild --platform ios` before pod install | ||
| required: false | ||
| default: "true" | ||
| filter-name: | ||
| description: dorny/paths-filter filter name for this app+platform (e.g. llm-ios). Used as the content-hash cache key so a previously-passing build can be skipped if nothing relevant has changed. | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| cache: "yarn" | ||
|
|
||
| - name: Install root dependencies | ||
| shell: bash | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Compute build hash | ||
| id: hash | ||
| shell: bash | ||
| run: | | ||
| h=$(npx ts-node scripts/compute-app-hash.ts "${{ inputs.filter-name }}") | ||
| echo "key=build-${{ inputs.filter-name }}-$h" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Lookup pass marker | ||
| id: cache | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: ${{ runner.temp }}/ci-marker | ||
| key: ${{ steps.hash.outputs.key }} | ||
| lookup-only: true | ||
|
|
||
| - name: Skip notice | ||
| if: steps.cache.outputs.cache-hit == 'true' | ||
| shell: bash | ||
| run: echo "Skipping build — ${{ inputs.filter-name }} already passed at this content hash." | ||
|
|
||
| - name: Setup Xcode | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| uses: maxim-lobanov/setup-xcode@v1 | ||
| with: | ||
| xcode-version: latest-stable | ||
|
|
||
| - name: Install Expo CLI | ||
| if: steps.cache.outputs.cache-hit != 'true' && inputs.expo-prebuild == 'true' | ||
| shell: bash | ||
| run: | | ||
| npm install -g @expo/cli | ||
| echo "$(npm prefix -g)/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Generate native iOS project | ||
| if: steps.cache.outputs.cache-hit != 'true' && inputs.expo-prebuild == 'true' | ||
| working-directory: ${{ inputs.app-path }} | ||
| shell: bash | ||
| run: | | ||
| rm -rf ios | ||
| npx expo prebuild --platform ios --no-install | ||
|
|
||
| - name: Cache CocoaPods | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: | | ||
| ~/Library/Caches/CocoaPods | ||
| ${{ inputs.app-path }}/ios/Pods | ||
| key: ${{ runner.os }}-pods-${{ inputs.filter-name }}-${{ hashFiles(format('{0}/ios/Podfile.lock', inputs.app-path)) }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pods-${{ inputs.filter-name }}- | ||
|
|
||
| - name: Install CocoaPods dependencies | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| working-directory: ${{ inputs.app-path }}/ios | ||
| shell: bash | ||
| run: pod install | ||
|
|
||
| - name: Build app | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| working-directory: ${{ inputs.app-path }}/ios | ||
| shell: bash | ||
| run: | | ||
| WORKSPACE=$(ls -d *.xcworkspace | head -n 1) | ||
| SCHEME="${WORKSPACE%.xcworkspace}" | ||
| set -o pipefail && xcodebuild \ | ||
| -workspace "$WORKSPACE" \ | ||
| -scheme "$SCHEME" \ | ||
| -sdk iphonesimulator \ | ||
| -configuration Debug \ | ||
| -destination 'generic/platform=iOS Simulator' \ | ||
| build \ | ||
| CODE_SIGNING_ALLOWED=NO \ | ||
| -jobs $(sysctl -n hw.ncpu) \ | ||
| COMPILER_INDEX_STORE_ENABLE=NO \ | ||
| ONLY_ACTIVE_ARCH=YES | xcbeautify | ||
|
|
||
| - name: Save pass marker | ||
| if: steps.cache.outputs.cache-hit != 'true' && success() | ||
| shell: bash | ||
| run: | | ||
| mkdir -p "${{ runner.temp }}/ci-marker" | ||
| touch "${{ runner.temp }}/ci-marker/passed" | ||
|
|
||
| - name: Cache pass marker | ||
| if: steps.cache.outputs.cache-hit != 'true' && success() | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: ${{ runner.temp }}/ci-marker | ||
| key: ${{ steps.hash.outputs.key }} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.