chore: publish #668
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: Tests | |
on: | |
- push | |
- pull_request | |
jobs: | |
android: | |
name: Android | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: [34] | |
rn-version: ['0.75', '0.74', '0.73'] | |
arch: ['new', 'old'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: actions/setup-node@v4 | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
# TODO: Remove this after we merge | |
cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/monorepo' }} | |
- name: AVD Deps | |
run: | | |
sudo apt update | |
sudo apt-get install -y libpulse0 libgl1 | |
# - name: SDK cache | |
# uses: actions/cache@v4 | |
# id: sdk-cache | |
# with: | |
# path: | | |
# /usr/local/lib/android/sdk/system-images | |
# /usr/local/lib/android/sdk/platform-tools | |
# key: sdk-${{ matrix.api-level }} | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: SDKs | |
run: | | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \ | |
"system-images;android-${{ matrix.api-level }};default;x86_64" | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager platform-tools | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses | |
- 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 | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Emulator | |
run: | | |
if ! $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager list avd --compact | grep -q "Pixel_API_${{ matrix.api-level }}"; then | |
$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd \ | |
-n Pixel_API_${{ matrix.api-level }} \ | |
--device 'pixel_6_pro' \ | |
--package "system-images;android-${{ matrix.api-level }};default;x86_64" \ | |
--sdcard 512M | |
fi | |
$ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_${{ matrix.api-level }} \ | |
-no-metrics -wipe-data -no-window -gpu swiftshader_indirect \ | |
-no-snapshot -no-snapshot-save -noaudio -no-boot-anim -camera-back none 2>&1 | tee /tmp/avd_log & | |
- name: Setup yarn | |
run: | | |
corepack enable | |
- name: Setup npm | |
uses: bahmutov/npm-install@v1 | |
with: | |
install-command: yarn --immutable | |
- name: Build | |
run: | | |
yarn prepare | |
- name: Set up RN version | |
run: | | |
cd packages/icon-explorer | |
./set-rn-version.sh ${{ matrix.arch }} ${{ matrix.rn-version }} | |
- name: Build App | |
run: | | |
cd packages/icon-explorer | |
yarn test:android:build | |
- name: ADB Wait For Device | |
timeout-minutes: 3 | |
run: | | |
$ANDROID_HOME/platform-tools/adb wait-for-any-device | |
echo -n "Waiting for emulator to boot" | |
while [ "$($ANDROID_HOME/platform-tools/adb shell getprop sys.boot_completed | tr -d '\r')" != "1" ]; do | |
echo -n "." | |
sleep 5 | |
done | |
echo "Emulator has fully booted." | |
# Disable the notification about immersive mode | |
$ANDROID_HOME/platform-tools/adb shell settings put secure immersive_mode_confirmations confirmed | |
- name: Run tests | |
timeout-minutes: 10 | |
run: | | |
export PATH=$ANDROID_HOME/platform-tools:$PATH | |
cd packages/icon-explorer | |
ln -s .owl/baseline baseline-${{ matrix.arch }} | |
yarn test:android:run | |
- name: Stop Emulator | |
if: always() | |
run: | | |
$ANDROID_HOME/platform-tools/adb -s emulator-5554 emu kill || true | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results-${{ matrix.arch }}-${{ matrix.rn-version }}-android | |
path: packages/icon-explorer/.owl | |
include-hidden-files: true | |
- uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: JEST Tests android - ${{ matrix.arch }} ${{ matrix.rn-version }} | |
path: packages/icon-explorer/.owl/report/*.xml | |
reporter: jest-junit | |
ios: | |
name: iOS | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rn-version: ['0.75', '0.74', '0.73'] | |
arch: ['new', 'old'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: actions/setup-node@v4 | |
- name: Setup yarn | |
run: | | |
xcrun simctl list || true | |
- name: Setup yarn | |
run: | | |
corepack enable | |
- uses: bahmutov/npm-install@v1 | |
with: | |
install-command: yarn --immutable | |
- name: Build | |
run: | | |
xcodebuild -version | |
yarn prepare | |
- name: Set up RN version | |
run: | | |
cd packages/icon-explorer | |
./set-rn-version.sh ${{ matrix.arch }} ${{ matrix.rn-version }} | |
- name: Build App | |
run: | | |
cd packages/icon-explorer | |
# Work around mono repo issues with owl | |
mkdir -p node_modules/@johnf | |
cd node_modules | |
cp -a ../../../node_modules/@johnf/react-native-owl @johnf/ | |
ln -nfs ../../../node_modules/react-native react-native | |
cd - | |
# Due to react-native-test-app not bundling | |
yarn build:ios:owl | |
if [ "${{ matrix.arch }}" = "new" ]; then | |
NO_FLIPPER=1 RCT_NEW_ARCH_ENABLED=1 pod update --project-directory=ios | |
else | |
NO_FLIPPER=1 RCT_NEW_ARCH_ENABLED=0 pod update --project-directory=ios | |
fi | |
yarn test:ios:build | |
- name: Run simulator | |
id: simulator | |
uses: futureware-tech/simulator-action@v1 | |
with: | |
os: 'iOS' | |
os_version: "=17.5" | |
model: 'iPhone 15' | |
- name: Run tests | |
timeout-minutes: 10 | |
run: | | |
cd packages/icon-explorer | |
ln -s .owl/baseline baseline-${{ matrix.arch }} | |
tmp=$(mktemp) | |
jq '.ios.device = "${{ steps.simulator.outputs.udid }}"' owl.config.json > "$tmp" && mv "$tmp" owl.config.json | |
yarn test:ios:run | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results-${{ matrix.arch }}-${{ matrix.rn-version }}-ios | |
path: packages/icon-explorer/.owl | |
include-hidden-files: true | |
- uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: JEST Tests ios - ${{ matrix.arch }} ${{ matrix.rn-version }} | |
path: packages/icon-explorer/.owl/report/*.xml | |
reporter: jest-junit |