-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
1,332 additions
and
2,658 deletions.
There are no files selected for viewing
This file contains 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,28 @@ | ||
name: 'Install Maestro' | ||
description: 'Install Maestro' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Maestro | ||
shell: bash | ||
run: | | ||
retries=0 | ||
maestro_executable_path="$HOME/.maestro/bin/maestro" | ||
# Loop until the maestro binary exists or retries exceed the limit | ||
while [ ! -f "$maestro_executable_path" ]; do | ||
if [ "$retries" -gt 5 ]; then | ||
echo "Error: Reached max retry limit. Unable to install maestro." | ||
exit 1 | ||
fi | ||
echo "Maestro not found at $maestro_executable_path. Installing..." | ||
# Run the installation command | ||
curl -fsSL "https://get.maestro.mobile.dev" | bash | ||
# Increment retries | ||
retries=$((retries + 1)) | ||
done | ||
echo "Maestro installed successfully!" |
This file contains 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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
name: 'Install' | ||
description: 'Install and pre-build' | ||
|
||
description: 'Install and build packages' | ||
inputs: | ||
workspace-focus: | ||
required: false | ||
description: 'Only install and build a specific workspace (and its dependencies)' | ||
type: string | ||
runs: | ||
using: composite | ||
steps: | ||
|
@@ -22,14 +26,24 @@ runs: | |
shell: bash | ||
run: corepack enable && corepack prepare [email protected] --activate | ||
|
||
- name: Cache node_modules | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: node_modules | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-${{ env.cache-name }}${{ inputs.workspace-focus && format('-{0}', inputs.workspace-focus) || '' }}-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.cache-name }}${{ inputs.workspace-focus && format('-{0}', inputs.workspace-focus) || '' }}- | ||
- name: Install Dependencies | ||
shell: bash | ||
run: yarn install | ||
run: ${{ inputs.workspace-focus && format('yarn workspaces focus vxrn-monorepo {0}', inputs.workspace-focus) || 'yarn install'}} | ||
|
||
- name: Clean Build | ||
shell: bash | ||
run: yarn clean:build | ||
run: ${{ inputs.workspace-focus && format('yarn workspaces foreach -Rpt --from "{0}" run clean:build', inputs.workspace-focus) || 'yarn clean:build'}} | ||
|
||
- name: Build | ||
shell: bash | ||
run: yarn build | ||
run: ${{ inputs.workspace-focus && format('yarn workspaces foreach -Rpt --from "{0}" run build', inputs.workspace-focus) || 'yarn build'}} |
This file contains 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,221 @@ | ||
name: Build iOS Test Development Container App | ||
env: | ||
# Relative path from the monorepo root to the app | ||
test_app_path: tests/test | ||
# Package name in the monorepo | ||
test_app_package_name: test-app | ||
# Used for cache keys, must be unique among all workflows | ||
app_identifier: ios-test-app | ||
# Should match the name of "ios/<app_name>.xcworkspace" | ||
app_name: OneTestApp | ||
on: | ||
workflow_call: | ||
inputs: | ||
configuration: | ||
required: true | ||
type: string | ||
description: "Either 'Debug' or 'Release'." | ||
outputs: | ||
build-hash: | ||
description: "A hash to identify the build." | ||
value: ${{ jobs.build-ios.outputs.build-hash }} | ||
built-app-cache-key: | ||
description: "The cache key of the built .app." | ||
value: ${{ jobs.build-ios.outputs.built-app-cache-key }} | ||
built-app-path: | ||
description: "The path to the built .app relative to the repository root." | ||
value: ${{ jobs.build-ios.outputs.built-app-path }} | ||
|
||
jobs: | ||
build-ios: | ||
name: Build | ||
runs-on: macos-13 | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
timeout-minutes: 60 | ||
outputs: | ||
build-hash: ${{ steps.caculate-build-hash.outputs.build_hash }} | ||
built-app-cache-key: ${{ steps.check-previous-build.outputs.cache-primary-key || steps.pre-check-previous-build.outputs.cache-primary-key }} | ||
built-app-path: ${{ steps.get-built-app-path.outputs.built_app_path }} | ||
defaults: | ||
run: | ||
working-directory: ${{ env.test_app_path }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get Built App Path | ||
id: get-built-app-path | ||
env: | ||
BUILT_APP_PATH: ${{ env.test_app_path }}/build/Build/Products/${{ inputs.configuration }}-iphonesimulator/${{ env.app_name }}.app | ||
run: | | ||
echo "Built app path: $BUILT_APP_PATH" | ||
echo "built_app_path=$BUILT_APP_PATH" >> $GITHUB_OUTPUT | ||
- name: Caculate Pre-Build Hash | ||
id: caculate-pre-build-hash | ||
env: | ||
# A hash that can save us more time if we can already know that the build hash will not change. | ||
# | ||
# Calculating the build_hash relies on generated files, for example, `Podfile.lock`, and it’ll take some time to run `yarn install`, `expo prebuild` and `pod install` in order to get that. But if `yarn.lock` didn’t change, there’s no likely that `Podfile.lock` will change - we can leverage that and skip some installation steps. | ||
# | ||
# This hash MUST be different if the build_hash will be different. | ||
# | ||
# This hash can be different if the build_hash remains the same. For example, if `yarn.lock` changes, `Podfile.lock` may not change if the updated package contains no native code. | ||
PRE_BUILD_HASH: ${{ hashFiles(format('{0}/yarn.lock', env.test_app_path), format('{0}/app.json', env.test_app_path), 'packages/vxrn/expo-plugin.cjs') }} | ||
run: | | ||
if [ -z "$PRE_BUILD_HASH" ]; then | ||
echo '[ERROR] Failed to calculate pre-build hash.' | ||
fi | ||
echo "Pre-build hash: $PRE_BUILD_HASH" | ||
echo "pre_build_hash=$PRE_BUILD_HASH" >> $GITHUB_OUTPUT | ||
- name: Get Pre-Build Hash Mapping Key | ||
id: get-pre-build-hash-mapping-key | ||
env: | ||
PRE_BUILD_HASH_MAPPING_KEY: ${{ env.app_identifier }}-${{ inputs.configuration }}-pre-build-hash-to-hash-mapping-${{ steps.caculate-pre-build-hash.outputs.pre_build_hash }} | ||
BUILD_HASH_MAPPING_FILE_PATH: ${{ env.test_app_path }}/build-hash.txt | ||
run: | | ||
echo "Pre-build hash mapping key: $PRE_BUILD_HASH_MAPPING_KEY" | ||
echo "pre_build_hash_mapping_key=$PRE_BUILD_HASH_MAPPING_KEY" >> $GITHUB_OUTPUT | ||
echo "Build hash mapping file path: $BUILD_HASH_MAPPING_FILE_PATH" | ||
echo "build_hash_mapping_file_path=$BUILD_HASH_MAPPING_FILE_PATH" >> $GITHUB_OUTPUT | ||
- name: Get Pre-Build Hash Mapping | ||
uses: actions/cache/restore@v4 | ||
with: | ||
key: ${{ steps.get-pre-build-hash-mapping-key.outputs.pre_build_hash_mapping_key }} | ||
path: ${{ steps.get-pre-build-hash-mapping-key.outputs.build_hash_mapping_file_path }} | ||
|
||
- name: Read Build Hash from Mapping | ||
id: read-build-hash | ||
run: | | ||
if [ -f build-hash.txt ]; then | ||
BUILD_HASH=$(tr -d '[:space:]' < build-hash.txt) | ||
echo "Build hash: $BUILD_HASH" | ||
echo "build_hash=$BUILD_HASH" >> $GITHUB_OUTPUT | ||
else | ||
echo 'No cached build hash found.' | ||
echo "build_hash=NULL" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Check If Previous Build Exists | ||
uses: actions/cache/restore@v4 | ||
id: pre-check-previous-build | ||
with: | ||
key: ${{ env.app_identifier }}-${{ inputs.configuration }}-${{ steps.read-build-hash.outputs.build_hash }} | ||
lookup-only: true | ||
path: ${{ steps.get-built-app-path.outputs.built_app_path }} | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit }} | ||
with: | ||
workspace-focus: ${{ env.test_app_package_name }} | ||
|
||
- name: Prebuild | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit }} | ||
run: | | ||
node_modules/.bin/expo prebuild --platform ios --no-install # --no-install is used to skip installing dependencies, specifically `pod install` as we want to do it after the Cache Pods step | ||
- name: Cache Pods | ||
uses: actions/cache@v4 | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit }} | ||
env: | ||
cache-name: ${{ env.app_identifier }}-pods | ||
with: | ||
path: ${{ env.test_app_path }}/ios/Pods | ||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles(format('{0}/ios/Podfile.lock', env.test_app_path)) }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.cache-name }}- | ||
- name: Pod Install | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit }} | ||
run: | | ||
cd ios && pod install | ||
- name: Caculate Build Hash | ||
id: caculate-build-hash | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit }} | ||
env: | ||
# We need to list all files that will affect native code in hashFiles. | ||
BUILD_HASH: ${{ hashFiles(format('{0}/ios/Podfile.lock', env.test_app_path), format('{0}/app.json', env.test_app_path), 'packages/vxrn/expo-plugin.cjs') }} | ||
run: | | ||
if [ -z "$BUILD_HASH" ]; then | ||
echo '[ERROR] Failed to calculate build hash.' | ||
exit 1 | ||
fi | ||
echo "Build hash: $BUILD_HASH" | ||
echo "build_hash=$BUILD_HASH" >> $GITHUB_OUTPUT | ||
- name: Write Build Hash | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit }} | ||
env: | ||
BUILD_HASH: ${{ steps.caculate-build-hash.outputs.build_hash }} | ||
run: | | ||
echo $BUILD_HASH > build-hash.txt | ||
- name: Save Pre-Build Hash Mapping | ||
uses: actions/cache/save@v4 | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit }} | ||
with: | ||
key: ${{ steps.get-pre-build-hash-mapping-key.outputs.pre_build_hash_mapping_key }} | ||
path: ${{ steps.get-pre-build-hash-mapping-key.outputs.build_hash_mapping_file_path }} | ||
|
||
- name: Check If Previous Build Exists | ||
uses: actions/cache/restore@v4 | ||
id: check-previous-build | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit }} | ||
with: | ||
key: ${{ env.app_identifier }}-${{ inputs.configuration }}-${{ steps.caculate-build-hash.outputs.build_hash }} | ||
lookup-only: true | ||
path: ${{ steps.get-built-app-path.outputs.built_app_path }} | ||
|
||
- name: Restore Build Cache | ||
id: restore-build-cache | ||
uses: actions/cache/restore@v4 | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit && !steps.check-previous-build.outputs.cache-hit }} | ||
env: | ||
cache-name: ${{ env.app_identifier }}-build | ||
with: | ||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.configuration }}-${{ steps.caculate-build-hash.outputs.build_hash }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.cache-name }}-${{ inputs.configuration }}- | ||
${{ runner.os }}-${{ env.cache-name }}- | ||
path: | | ||
${{ env.test_app_path }}/build | ||
- name: Build | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit && !steps.check-previous-build.outputs.cache-hit }} | ||
run: | | ||
xcrun xcodebuild -scheme '${{ env.app_name }}' \ | ||
-workspace 'ios/${{ env.app_name }}.xcworkspace' \ | ||
-configuration ${{ inputs.configuration }} \ | ||
-sdk 'iphonesimulator' \ | ||
-destination 'generic/platform=iOS Simulator' \ | ||
-derivedDataPath \ | ||
build | tee xcodebuild.log | xcpretty | ||
- name: Save Built App | ||
uses: actions/cache/save@v4 | ||
if: ${{ !steps.pre-check-previous-build.outputs.cache-hit && !steps.check-previous-build.outputs.cache-hit }} | ||
with: | ||
key: ${{ steps.check-previous-build.outputs.cache-primary-key }} | ||
path: ${{ steps.get-built-app-path.outputs.built_app_path }} | ||
|
||
- name: Save Build Cache | ||
uses: actions/cache/save@v4 | ||
if: ${{ always() && !steps.pre-check-previous-build.outputs.cache-hit && !steps.check-previous-build.outputs.cache-hit }} | ||
with: | ||
key: ${{ steps.restore-build-cache.outputs.cache-primary-key }} | ||
path: | | ||
${{ env.test_app_path }}/build | ||
- name: Upload Build Log | ||
uses: actions/[email protected] | ||
if: ${{ always() && !steps.pre-check-previous-build.outputs.cache-hit && !steps.check-previous-build.outputs.cache-hit }} | ||
with: | ||
name: xcodebuild-${{ inputs.configuration }}.log | ||
path: | | ||
${{ env.test_app_path }}/xcodebuild.log |
Oops, something went wrong.