refactor: Change Java to Kotlin within ReactNativeGoogleMobileAds rel… #764
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: | |
pull_request: | |
branches: | |
- '**' | |
paths-ignore: | |
- 'docs/**' | |
- 'website/**' | |
- '.spellcheck.dict.txt' | |
- '**/*.md' | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- 'website/**' | |
- '.spellcheck.dict.txt' | |
- '**/*.md' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
ios: | |
name: iOS | |
runs-on: macos-14 | |
# TODO matrix across APIs, at least 10 and 13 (lowest to highest) | |
timeout-minutes: 60 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
steps: | |
# Set up tool versions | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 50 | |
# Set path variables needed for caches | |
- name: Set workflow variables | |
id: workflow-variables | |
run: | | |
echo "metro-cache=$HOME/.metro" >> $GITHUB_OUTPUT | |
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
echo "xcode-version=$(xcodebuild -version|tail -1|cut -f3 -d' ')" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Yarn Cache | |
id: yarn-cache | |
with: | |
path: ${{ steps.workflow-variables.outputs.yarn-cache-dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }} | |
restore-keys: ${{ runner.os }}-yarn-v1 | |
- uses: actions/cache@v4 | |
name: Detox Framework Cache | |
id: detox-cache | |
with: | |
path: ~/Library/Detox/ios | |
key: ${{ runner.os }}-detox-framework-cache-${{ steps.workflow-variables.outputs.xcode-version }}-v1 | |
# Detox is compiled during yarn install, using Xcode, set up cache first | |
- uses: hendrikmuhs/ccache-action@v1 | |
name: Xcode Compile Cache | |
with: | |
key: ${{ runner.os }}-v2 # makes a unique key w/related restore key internally | |
create-symlink: true | |
max-size: 750M | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3 | |
- name: Update Ruby build tools | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 2 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: gem update cocoapods xcodeproj | |
- uses: actions/cache@v4 | |
name: Cache Pods | |
id: pods-cache | |
with: | |
path: tests/ios/Pods | |
key: ${{ runner.os }}-pods-v2-${{ hashFiles('RNGoogleMobileAdsExample/ios/Podfile.lock') }} | |
restore-keys: ${{ runner.os }}-pods-v2 | |
- name: Yarn Install | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 10 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: yarn && DETOX_DISABLE_POSTINSTALL=1 yarn tests:install | |
- name: Pod Install | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 10 | |
retry_wait_seconds: 30 | |
max_attempts: 3 | |
command: yarn tests:ios:pod:install | |
- name: Build Detox Framework Cache | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 10 | |
retry_wait_seconds: 60 | |
max_attempts: 3 | |
command: cd RNGoogleMobileAdsExample && yarn detox build-framework-cache | |
- name: Install applesimutils | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
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 | |
- name: Metro Bundler Cache | |
uses: actions/cache@v4 | |
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 yarn tests:packager & | |
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" | |
- name: Create Simulator Log | |
# With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine | |
# If you boot the simulator separately from detox, some other race fails and detox testee never sends ready to proxy | |
continue-on-error: true | |
run: nohup sh -c "sleep 30 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &" | |
- name: Build and Run e2e app | |
timeout-minutes: 20 | |
continue-on-error: true | |
run: yarn tests:ios:run | |
- name: Upload Simulator Log | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: simulator_log | |
path: simulator.log | |
- uses: codecov/codecov-action@v4 | |
with: | |
verbose: true |