Skip to content

chore(release): use token-based npmjs publish for now #3495

chore(release): use token-based npmjs publish for now

chore(release): use token-based npmjs publish for now #3495

Workflow file for this run

name: Testing E2E iOS
on:
workflow_dispatch:
inputs:
iterations:
description: 'Number of iterations to run. Default 1. Max 122.'
required: true
default: 1
type: number
pull_request:
branches:
- '**'
paths-ignore:
- 'docs/**'
- 'website/**'
- '.spellcheck.dict.txt'
- '**/*.md'
push:
branches:
- main
- v14-release
paths-ignore:
- 'docs/**'
- 'website/**'
- '.spellcheck.dict.txt'
- '**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# We want to generate our matrix dynamically
# Initial job generates the matrix as a JSON, and following job will use deserialize and use the result
matrix_prep:
# Do not run the scheduled jobs on forks
if: (github.event_name == 'schedule' && github.repository == 'invertase/react-native-firebase') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build-matrix.outputs.result }}
steps:
- id: build-matrix
uses: actions/github-script@v7
with:
script: |
// by default, we will run one iteration
let iterationArray = [0]
// workflow dispatch will be a drop-down of different options
if (context.eventName === "workflow_dispatch") {
const inputs = ${{ toJSON(inputs) }}
console.log('inputs is: ' + JSON.stringify(inputs))
const iterationInput = inputs.iterations
console.log('iterations input is: ' + iterationInput)
// this will expand for example with input 5 => [0, 1, 2, 3, 4]
iterationArray = []
for (let i = 0; i < iterationInput; i++) {
iterationArray.push(i);
}
console.log('iterationArray is: ' + iterationArray)
}
// If we are running on a schedule it's our periodic passive scan for flakes
// Goal is to run enough iterations on all systems that we have confidence there are no flakes
if (context.eventName === "schedule") {
const iterationCount = 15
for (let i = 0; i < iterationCount; i++) {
iterationArray.push(i);
}
}
// we want to test debug and release - they generate different code
let buildmode = ['debug', 'release'];
return {
"iteration": iterationArray,
"buildmode": buildmode
}
- name: Debug Output
run: echo "${{ steps.build-matrix.outputs.result }}"
# This uses the matrix generated from the matrix-prep stage
# it will run unit tests on whatever OS combinations are desired
ios:
name: iOS (${{ matrix.buildmode }}, ${{ matrix.iteration }})
runs-on: macos-15
needs: matrix_prep
# TODO matrix across APIs, at least 11 and 15 (lowest to highest)
timeout-minutes: 70
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CCACHE_SLOPPINESS: clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros
CCACHE_FILECLONE: true
CCACHE_DEPEND: true
CCACHE_INODECACHE: true
CCACHE_LIMIT_MULTIPLE: 0.95
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
steps:
- name: Setup Environment for Screen Recording
uses: guidepup/[email protected]
continue-on-error: true
with:
record: true
- name: Upload Screen Recording Environment Setup
uses: actions/upload-artifact@v4
continue-on-error: true
if: always()
with:
name: screenrecording-setup-${{ matrix.buildmode }}-${{ matrix.iteration }}.mov
path: ./recordings/
# Set up tool versions
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.0.1' # temporarily pinning version until simulators are defined '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 "xcode-version=$(xcodebuild -version|tail -1|cut -f3 -d' ')" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Yarn Cache
id: yarn-cache
with:
path: .yarn/cache
key: ${{ runner.os }}-ios-yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-ios-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 }}
# 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 }}-${{ matrix.buildmode }}-ios-v3 # makes a unique key w/related restore key internally
create-symlink: true
max-size: 1500M
- name: Yarn Install
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
retry_wait_seconds: 60
max_attempts: 3
command: yarn
- 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 }}-ios-pods-v3-${{ hashFiles('tests/ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-ios-pods-v3
- name: Pod Install
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
retry_wait_seconds: 30
max_attempts: 3
command: yarn tests:ios:pod:install
- name: Cache Firestore Emulator
uses: actions/cache@v4
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-v1-${{ github.run_id }}
restore-keys: firebase-emulators-v1
- name: Start Firestore Emulator
run: yarn tests:emulator:start-ci
# https://bitrise.io/blog/post/xcode-15-performance-regressions
# https://developer.apple.com/forums/thread/805625?answerId=865340022#865340022
- name: Install yeetd and fix iOS perf issues
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist
- name: Install brew utilities
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 xcbeautify
- name: Build iOS App Debug
if: contains(matrix.buildmode, 'debug')
run: |
ccache -s
export SKIP_BUNDLING=1
export RCT_NO_LAUNCH_PACKAGER=1
set -o pipefail
echo $PATH
which clang
yarn tests:ios:build
ccache -s
shell: bash
- name: Build iOS App Release
if: contains(matrix.buildmode, 'release')
run: |
ccache -s
export RCT_NO_LAUNCH_PACKAGER=1
set -o pipefail
echo $PATH
which clang
yarn tests:ios:build:release
ccache -s
shell: bash
- name: Metro Bundler Cache
uses: actions/cache@v4
with:
path: ${{ steps.workflow-variables.outputs.metro-cache }}
key: ${{ runner.os }}-ios-metro-v1-${{ github.run_id }}
restore-keys: ${{ runner.os }}-ios-metro-v1
- name: Pre-fetch Javascript bundle
run: |
nohup yarn tests:packager:jet-ci &
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: Start Screen and Simulator Recordings and System Logging
# With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine
continue-on-error: true
run: |
nohup sh -c "sleep 314159265 | screencapture -v -C -k -T0 -g screenrecording.mov > screenrecording.log 2>&1 &"
nohup sh -c "log stream --backtrace --color none --style syslog > syslog.log 2>&1 &"
nohup sh -c "sleep 110 && xcrun simctl io booted recordVideo --codec=h264 -f simulator.mp4 2>&1 &"
- 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 110 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &"
- name: Pre-Boot Simulator
# The goal here is to separate Simulator boot from Detox run,
# So that Simulator boot issues we seem to have may be handled separately
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
retry_wait_seconds: 60
max_attempts: 3
command: ./.github/workflows/scripts/boot-simulator.sh
- name: Detox Test
if: contains(matrix.buildmode, 'debug')
timeout-minutes: 50
run: yarn tests:ios:test-cover
- name: Detox Test
if: contains(matrix.buildmode, 'release')
timeout-minutes: 50
run: yarn tests:ios:test:release
- name: Stop Screen and App Video and System Logging
if: always()
continue-on-error: true
run: |
killall -int simctl
killall -int screencapture
killall -int log
- name: Upload App Video
uses: actions/upload-artifact@v4
continue-on-error: true
if: always()
with:
name: simulator-${{ matrix.buildmode }}-${{ matrix.iteration }}_video
path: simulator.mp4
- name: Upload Simulator Log
uses: actions/upload-artifact@v4
continue-on-error: true
if: always()
with:
name: simulator-${{ matrix.buildmode }}-${{ matrix.iteration }}_log
path: simulator.log
- name: Upload Screen Recording
uses: actions/upload-artifact@v4
continue-on-error: true
if: always()
with:
name: screenrecording-${{ matrix.buildmode }}-${{ matrix.iteration }}
path: screenrecording.*
- uses: codecov/codecov-action@v5
if: contains(matrix.buildmode, 'debug')
continue-on-error: true
with:
verbose: true