Skip to content

Commit

Permalink
ci: other platform testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Salakar committed Jul 9, 2024
1 parent 0c988ad commit b872233
Show file tree
Hide file tree
Showing 33 changed files with 3,663 additions and 1,946 deletions.
33 changes: 7 additions & 26 deletions .github/workflows/tests_e2e_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
android:
name: Android
runs-on: ubuntu-latest-l
timeout-minutes: 90
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
Expand All @@ -46,20 +46,7 @@ jobs:
iteration: [0]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
EMULATOR_COMMAND: "-avd TestingAVD -noaudio -gpu swiftshader_indirect -camera-back none -no-snapshot -no-window -no-boot-anim -nojni -memory 4096 -timezone 'Europe/London' -cores 4"
EMULATOR_EXECUTABLE: qemu-system-x86_64-headless
steps:
- name: Liberate disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: false
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
Expand Down Expand Up @@ -88,13 +75,13 @@ jobs:
echo "metro-cache=$HOME/.metro" >> $GITHUB_OUTPUT
echo "tempdir=$TMPDIR" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
name: Yarn Cache Restore
- uses: actions/cache@v4
name: Yarn Cache
id: yarn-cache
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-v1
key: ${{ runner.os }}-android-yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-android-yarn-v1

- name: Yarn Install
uses: nick-fields/retry@v3
Expand Down Expand Up @@ -158,11 +145,12 @@ jobs:

- name: Detox Tests
uses: reactivecircus/android-emulator-runner@v2
timeout-minutes: 60
timeout-minutes: 45
with:
api-level: ${{ matrix.api-level }}
avd-name: TestingAVD
target: ${{ matrix.target }}
disable-spellchecker: true
arch: ${{ matrix.arch }}
pre-emulator-launch-script: |
sudo mkdir /mnt/avd
Expand All @@ -179,13 +167,6 @@ jobs:
with:
verbose: true

- uses: actions/cache/save@v4
name: Yarn Cache Save
if: "${{ github.ref == 'refs/heads/main' }}"
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }}

- name: Upload Emulator Log
uses: actions/upload-artifact@v4
if: always()
Expand Down
25 changes: 9 additions & 16 deletions .github/workflows/tests_e2e_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ jobs:
echo "metro-cache=$HOME/.metro" >> $GITHUB_OUTPUT
echo "xcode-version=$(xcodebuild -version|tail -1|cut -f3 -d' ')" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
name: Yarn Cache Restore
- uses: actions/cache@v4
name: Yarn Cache
id: yarn-cache
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-v1
key: ${{ runner.os }}-ios-yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-ios-yarn-v1

- uses: actions/cache@v4
name: Detox Framework Cache
Expand All @@ -78,7 +78,7 @@ jobs:
- uses: hendrikmuhs/ccache-action@v1
name: Xcode Compile Cache
with:
key: ${{ runner.os }}-v3 # makes a unique key w/related restore key internally
key: ${{ runner.os }}-ios-v3 # makes a unique key w/related restore key internally
create-symlink: true
max-size: 1500M

Expand Down Expand Up @@ -108,8 +108,8 @@ jobs:
id: pods-cache
with:
path: tests/ios/Pods
key: ${{ runner.os }}-pods-v3-${{ hashFiles('tests/ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-v3
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
Expand Down Expand Up @@ -158,8 +158,8 @@ jobs:
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
key: ${{ runner.os }}-ios-metro-v1-${{ github.run_id }}
restore-keys: ${{ runner.os }}-ios-metro-v1

- name: Pre-fetch Javascript bundle
run: |
Expand Down Expand Up @@ -210,10 +210,3 @@ jobs:
- uses: codecov/codecov-action@v4
with:
verbose: true

- uses: actions/cache/save@v4
name: Yarn Cache Save
if: "${{ github.ref == 'refs/heads/main' }}"
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }}
179 changes: 179 additions & 0 deletions .github/workflows/tests_e2e_other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: Testing E2E Other

on:
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:
other:
name: Other
runs-on: macos-14-xlarge
timeout-minutes: 100
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18

- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- 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 "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 }}-macos-yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-macos-yarn-v1

- uses: hendrikmuhs/ccache-action@v1
name: Xcode Compile Cache
with:
key: ${{ runner.os }}-macos-v2
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: DETOX_DISABLE_POSTINSTALL=1 yarn && yarn lerna:prepare

- 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/macos/Pods
key: ${{ runner.os }}-macos-pods-v2-${{ hashFiles('tests/macos/Podfile.lock') }}
restore-keys: ${{ runner.os }}-macos-pods-v2

- name: Pod Install
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
retry_wait_seconds: 30
max_attempts: 3
command: yarn tests:macos: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

- 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 xcbeautify

- name: Build macos App
run: |
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
export CCACHE_LIMIT_MULTIPLE=0.95
ccache -s
export SKIP_BUNDLING=1
export RCT_NO_LAUNCH_PACKAGER=1
set -o pipefail
echo $PATH
which clang
yarn tests:macos:build
ccache -s
shell: bash

- name: Metro Bundler Cache
uses: actions/cache@v4
with:
path: ${{ steps.workflow-variables.outputs.metro-cache }}
key: ${{ runner.os }}-macos-metro-v1-${{ github.run_id }}
restore-keys: ${{ runner.os }}-macos-metro-v1

- name: Pre-fetch Javascript bundle
run: |
nohup sh -c "yarn tests:packager:jet-ci > metro.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=macos&dev=true&minify=false&inlineSourceMap=true"
echo "...javascript bundle ready"
- name: Jet Test
timeout-minutes: 20
run: yarn tests:macos:test-cover

- uses: codecov/codecov-action@v4
with:
verbose: true

- name: Upload Metro Log
uses: actions/upload-artifact@v4
if: always()
with:
name: metro_log
path: metro.log
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,21 @@
"tests:android:test:windows": "cd tests && yarn detox test --configuration android.emu.debug",
"tests:android:test:debug": "yarn tests:android:emulator:forward && cd tests && yarn detox test --configuration android.emu.debug --inspect",
"tests:android:test-reuse": "yarn tests:android:emulator:forward && cd tests && yarn detox test --configuration android.emu.debug --reuse",
"tests:android:test-cover": "yarn tests:android:emulator:forward && cd tests && ./node_modules/.bin/nyc yarn detox test --configuration android.emu.debug",
"tests:android:test-cover-reuse": "yarn tests:android:emulator:forward && cd tests && ./node_modules/.bin/nyc yarn detox test --configuration android.emu.debug --reuse",
"tests:android:test-cover": "yarn tests:android:emulator:forward && cd tests && yarn detox test --configuration android.emu.debug --loglevel verbose",
"tests:android:test-cover-reuse": "yarn tests:android:emulator:forward && cd tests && yarn detox test --configuration android.emu.debug --reuse",
"tests:android:test:jacoco-report": "cd tests/android && ./gradlew jacocoAndroidTestReport",
"tests:android:emulator:forward": ".github/workflows/scripts/adb_all_emulators.sh 'reverse tcp:8081 tcp:8081' && .github/workflows/scripts/adb_all_emulators.sh 'reverse tcp:8090 tcp:8090' && .github/workflows/scripts/adb_all_emulators.sh 'reverse tcp:8080 tcp:8080' && .github/workflows/scripts/adb_all_emulators.sh 'reverse tcp:9099 tcp:9099' && .github/workflows/scripts/adb_all_emulators.sh 'reverse tcp:9000 tcp:9000' && .github/workflows/scripts/adb_all_emulators.sh 'reverse tcp:9199 tcp:9199'",
"tests:ios:build": "cd tests && yarn detox build --configuration ios.sim.debug",
"tests:ios:build-release": "cd tests && yarn detox build --configuration ios.sim.release",
"tests:ios:test": "cd tests && SIMCTL_CHILD_GULGeneratedClassDisposeDisabled=1 yarn detox test --configuration ios.sim.debug --loglevel warn",
"tests:ios:test:debug": "cd tests && SIMCTL_CHILD_GULGeneratedClassDisposeDisabled=1 yarn detox test --configuration ios.sim.debug --loglevel warn --inspect",
"tests:ios:test-reuse": "cd tests && SIMCTL_CHILD_GULGeneratedClassDisposeDisabled=1 yarn detox test --configuration ios.sim.debug --reuse --loglevel warn",
"tests:ios:test-cover": "cd tests && SIMCTL_CHILD_GULGeneratedClassDisposeDisabled=1 ./node_modules/.bin/nyc yarn detox test --configuration ios.sim.debug --loglevel warn",
"tests:ios:test-cover": "cd tests && SIMCTL_CHILD_GULGeneratedClassDisposeDisabled=1 yarn detox test --configuration ios.sim.debug --loglevel verbose",
"tests:ios:test-cover-reuse": "cd tests && SIMCTL_CHILD_GULGeneratedClassDisposeDisabled=1 node_modules/.bin/nyc yarn detox test --configuration ios.sim.debug --reuse --loglevel warn",
"tests:ios:pod:install": "cd tests && rm -f ios/Podfile.lock && rm -rf ios/ReactNativeFirebaseDemo.xcworkspace && yarn pod-install",
"tests:ios:pod:install": "cd tests && rm -f ios/Podfile.lock && rm -rf ios/ReactNativeFirebaseDemo.xcworkspace && cd ios && pod install",
"tests:macos:build": "cd tests && yarn build:macos",
"tests:macos:pod:install": "cd tests && rm -f macos/Podfile.lock && cd macos && pod install",
"tests:macos:test-cover": "cd tests && npx jet --target=macos --coverage",
"format:markdown": "prettier --write \"docs/**/*.md\""
},
"devDependencies": {
Expand Down
16 changes: 12 additions & 4 deletions packages/app-check/e2e/appcheck.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ describe('appCheck() modular', function () {
});
});

describe('getToken())', function () {
// TODO flakey after many runs, sometimes fails on android & ios,
// possibly a rate limiting issue on the server side
xdescribe('getToken()', function () {
it('token fetch attempt with configured debug token should work', async function () {
const { token } = await firebase.appCheck().getToken(true);
token.should.not.equal('');
Expand Down Expand Up @@ -200,7 +202,9 @@ describe('appCheck() modular', function () {
});
});

describe('getLimitedUseToken())', function () {
// TODO flakey after many runs, sometimes fails on android & ios,
// possibly a rate limiting issue on the server side
xdescribe('getLimitedUseToken()', function () {
it('limited use token fetch attempt with configured debug token should work', async function () {
const { token } = await firebase.appCheck().getLimitedUseToken();
token.should.not.equal('');
Expand Down Expand Up @@ -293,7 +297,9 @@ describe('appCheck() modular', function () {
});
});

describe('getToken())', function () {
// TODO flakey after many runs, sometimes fails on android & ios,
// possibly a rate limiting issue on the server side
xdescribe('getToken()', function () {
it('token fetch attempt with configured debug token should work', async function () {
const { getToken } = appCheckModular;

Expand Down Expand Up @@ -383,7 +389,9 @@ describe('appCheck() modular', function () {
});
});

describe('getLimitedUseToken())', function () {
// TODO flakey after many runs, sometimes fails on android & ios,
// possibly a rate limiting issue on the server side
xdescribe('getLimitedUseToken()', function () {
it('limited use token fetch attempt with configured debug token should work', async function () {
const { initializeAppCheck, getLimitedUseToken } = appCheckModular;

Expand Down
Loading

0 comments on commit b872233

Please sign in to comment.