-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add maestro test on CI/CD #10
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,131 @@ | ||
name: React Native CI | ||
|
||
on: | ||
pull_request: | ||
branches: main | ||
push: | ||
branches: main | ||
schedule: | ||
- cron: '0 0 * * *' # Runs at 00:00 UTC every day | ||
|
||
jobs: | ||
ios-build: | ||
name: iOS Build | ||
runs-on: macos-latest | ||
defaults: | ||
run: | ||
working-directory: example | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
okwasniewski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
node-version: '22' | ||
cache: 'npm' | ||
cache-dependency-path: example/package-lock.json | ||
|
||
- name: Cache CocoaPods | ||
uses: actions/cache@v3 | ||
okwasniewski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
path: | | ||
example/ios/Pods | ||
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-pods- | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install --frozen-lockfile | ||
cd ios && pod install | ||
|
||
- name: Install Maestro CLI | ||
run: | | ||
curl -Ls "https://get.maestro.mobile.dev" | bash | ||
brew tap facebook/fb | ||
brew install facebook/fb/idb-companion | ||
|
||
- name: Add Maestro to path | ||
run: echo "${HOME}/.maestro/bin" >> $GITHUB_PATH | ||
|
||
- name: Start packager | ||
run: npm start & | ||
|
||
- name: Build iOS | ||
run: | | ||
npm run ios | ||
|
||
- name: Setup iOS simulator | ||
run: | | ||
UDID=$(xcrun simctl list devices | grep "iPhone" | grep "Booted" | head -1 | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})") | ||
if [ -z "$UDID" ]; then | ||
UDID=$(xcrun simctl list devices available | grep "iPhone" | head -1 | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})") | ||
xcrun simctl boot "${UDID}" | ||
fi | ||
open -a Simulator | ||
xcrun simctl launch "${UDID}" com.jscexample | ||
|
||
- name: Run iOS tests | ||
run: | | ||
export MAESTRO_DRIVER_STARTUP_TIMEOUT=1500000 | ||
export MAESTRO_WAIT_TIMEOUT=10000 | ||
npm run test:e2e | ||
|
||
|
||
android-build: | ||
name: Android Build | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: example | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
okwasniewski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
okwasniewski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
node-version: '18' | ||
okwasniewski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cache: 'npm' | ||
cache-dependency-path: example/package-lock.json | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
okwasniewski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
|
||
- name: Install dependencies | ||
run: npm install --frozen-lockfile | ||
|
||
- name: Start packager | ||
run: npm start & | ||
|
||
- name: Install Maestro CLI | ||
run: | | ||
curl -Ls "https://get.maestro.mobile.dev" | bash | ||
|
||
- name: Add Maestro to path | ||
run: echo "${HOME}/.maestro/bin" >> $GITHUB_PATH | ||
|
||
- name: Create AVD and generate snapshot for caching | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
target: aosp_atd | ||
api-level: 30 | ||
arch: x86 | ||
ram-size: 4096M | ||
channel: canary | ||
profile: pixel | ||
avd-name: Pixel_3a_API_30_AOSP | ||
force-avd-creation: false | ||
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
emulator-boot-timeout: 12000 | ||
disable-animations: false | ||
working-directory: example | ||
script: | | ||
npm run android | ||
npm run test:e2e |
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
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.