chore: bump version #3
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
name: Testing E2E iOS | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths-ignore: | |
- 'docs-react-native/**' | |
- '**/*.md' | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs-react-native/**' | |
- '**/*.md' | |
jobs: | |
ios: | |
name: iOS | |
runs-on: macos-11 | |
# TODO matrix across APIs, at least 10 and 13 (lowest to highest) | |
timeout-minutes: 60 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
steps: | |
- uses: styfle/[email protected] | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 50 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '13.0' | |
- name: Start Simulator | |
# The first time you try to `yarn run:ios` after xcode-select, it fails, so get it out of the way... | |
continue-on-error: true | |
run: xcrun simctl boot "iPhone 12" | |
# Set path variables needed for caches | |
- name: Set workflow variables | |
id: workflow-variables | |
run: | | |
echo "::set-output name=metro-cache::$HOME/.metro" | |
echo "::set-output name=yarn-cache-dir::$(yarn cache dir)" | |
- uses: actions/cache@v2 | |
name: Yarn Cache | |
id: yarn-cache | |
with: | |
path: ${{ steps.workflow-variables.outputs.yarn-cache-dir }} | |
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('**/package.json') }} | |
restore-keys: ${{ runner.os }}-yarn-v1 | |
- uses: actions/cache@v2 | |
name: Cache Pods | |
with: | |
path: tests_react_native/ios/Pods | |
key: ${{ runner.os }}-pods-v2-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: ${{ runner.os }}-pods-v2 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3 | |
- name: Update Ruby build tools | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 2 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: gem update cocoapods xcodeproj | |
- name: Yarn Install | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 10 | |
retry_wait_seconds: 60 | |
max_attempts: 4 | |
command: yarn --no-audit --prefer-offline && npm i -g cavy-cli | |
- name: Install applesimutils | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 10 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew && HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils && applesimutils --list | |
- name: Prepare test index file | |
# For some reason, in CI, the test file is never running. So let's make all index files the test file. | |
run: cp tests_react_native/index.test.js tests_react_native/index.js | |
- name: Metro Bundler Cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.workflow-variables.outputs.metro-cache }} | |
key: ${{ runner.os }}-metro-v1-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-metro-v1 | |
- name: Pre-fetch Javascript bundle | |
run: | | |
nohup sh -c "yarn tests_rn:packager > packager.log 2>&1 &" | |
printf 'Waiting for packager to come online' | |
until curl --output /dev/null --silent --head --fail http://localhost:8081/status; do | |
printf '.' | |
sleep 2 | |
done | |
echo "Packager is online! Preparing bundle..." | |
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&inlineSourceMap=true" | |
echo "...javascript bundle ready" | |
- uses: hendrikmuhs/ccache-action@v1 | |
name: Xcode Compile Cache | |
with: | |
key: ${{ runner.os }}-v2 # makes a unique key w/related restore key internally | |
max-size: 400M | |
- name: Build App, Boot Simulator, Run App | |
id: run1 | |
continue-on-error: true | |
run: | | |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | |
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros | |
export CCACHE_FILECLONE=true | |
export CCACHE_DEPEND=true | |
export CCACHE_INODECACHE=true | |
ccache -s | |
export SKIP_BUNDLING=1 | |
export RCT_NO_LAUNCH_PACKAGER=1 | |
yarn run:ios | |
ccache -s | |
shell: bash | |
- name: Build App, Boot Simulator, Run App Retry 1 | |
id: run2 | |
if: steps.run1.outcome=='failure' | |
continue-on-error: true | |
run: | | |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | |
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros | |
export CCACHE_FILECLONE=true | |
export CCACHE_DEPEND=true | |
export CCACHE_INODECACHE=true | |
ccache -s | |
export SKIP_BUNDLING=1 | |
export RCT_NO_LAUNCH_PACKAGER=1 | |
yarn run:ios | |
ccache -s | |
shell: bash | |
- name: Build App, Boot Simulator, Run App Retry 2 | |
id: run3 | |
if: steps.run2.outcome=='failure' | |
continue-on-error: true | |
run: | | |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | |
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros | |
export CCACHE_FILECLONE=true | |
export CCACHE_DEPEND=true | |
export CCACHE_INODECACHE=true | |
ccache -s | |
export SKIP_BUNDLING=1 | |
export RCT_NO_LAUNCH_PACKAGER=1 | |
yarn run:ios | |
ccache -s | |
shell: bash | |
- name: Simulator Status | |
if: always() | |
run: | | |
if ${{ steps.run1.outcome=='success' || steps.run2.outcome=='success' || steps.run3.outcome=='success' }}; then | |
echo "Simulator Started" | |
else | |
exit 1 | |
fi | |
- name: Grant Notification Permission | |
run: applesimutils --booted --setPermissions notifications=YES --bundle com.notifee.testing | |
- name: Record App Video | |
# It seems to take about a minute (based on video recording) for the Simulator to be back up and stable | |
run: sleep 60 && nohup sh -c "xcrun simctl io booted recordVideo --codec=h264 -f simulator.mp4 2>&1 &" | |
- name: Create Simulator Log | |
# With a little delay, missing the first part of boot is fine, it will still capture app issues | |
run: nohup sh -c "xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &" | |
- name: E2E Test | |
timeout-minutes: 6 | |
run: yarn tests_rn:ios:test | |
- name: Stop App Video | |
if: always() | |
run: killall -INT simctl | |
- name: Upload App Video | |
uses: actions/upload-artifact@v2 | |
continue-on-error: true | |
if: always() | |
with: | |
name: simulator_video | |
path: simulator.mp4 | |
- name: Compress Simulator Log | |
continue-on-error: true | |
if: always() | |
run: gzip -9 simulator.log | |
- name: Upload Simulator Log | |
uses: actions/upload-artifact@v2 | |
continue-on-error: true | |
if: always() | |
with: | |
name: simulator_logs | |
path: simulator.log.gz | |
- name: Upload Packager Log | |
uses: actions/upload-artifact@v2 | |
continue-on-error: true | |
if: always() | |
with: | |
name: packager_log | |
path: packager.log | |
- name: Submit Coverage | |
# This can fail on timeouts etc, wrap with retry | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 10 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: curl https://codecov.io/bash -o codecov.sh && bash ./codecov.sh |