Publish #415
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: [31] | |
# TODO: Let's not care about different APIs for now | |
# api-level: [31, 32, 33, 34] | |
rn-version: ['latest', '0.72-stable', '0.71-stable', '0.70-stable'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: false | |
# large-packages: true | |
# swap-storage: true | |
- 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: Setup yarn | |
run: | | |
corepack enable | |
- uses: bahmutov/npm-install@v1 | |
with: | |
install-command: yarn --immutable | |
- name: AVD Deps | |
run: | | |
sudo apt update | |
sudo apt-get install -y libpulse0 libgl1 | |
- name: Build | |
run: | | |
yarn prepare | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
profile: pixel_6_pro | |
api-level: ${{ matrix.api-level }} | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
script: echo "Generated AVD snapshot for caching." | |
- 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: Set up RN version | |
run: | | |
cd packages/icon-explorer | |
./set-rn-version.sh android ${{ matrix.rn-version }} | |
# TODO Not sure if this should re really needed but seems to fix things | |
- name: Start Metro | |
run: | | |
cd packages/icon-explorer | |
nohup yarn start & | |
- name: Run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
profile: pixel_6_pro | |
api-level: ${{ matrix.api-level }} | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: cd packages/icon-explorer && yarn test:android | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results-${{ matrix.rn-version }}-${{ matrix.api-level }}-android | |
path: packages/icon-explorer/e2e/output | |
- uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: JEST Tests | |
path: packages/icon-explorer/e2e/output/*.xml | |
reporter: jest-junit | |
ios: | |
name: iOS | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: [31] | |
# api-level: [31, 32, 33, 34] TODO: Let's not care about different APIs for now | |
rn-version: ['latest', '0.72-stable', '0.71-stable', '0.70-stable'] | |
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: | | |
corepack enable | |
- 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 ios ${{ matrix.rn-version }} | |
- name: Set up build tools | |
run: | | |
brew tap wix/brew | |
brew install applesimutils | |
# TODO Not sure if this should re really needed but seems to fix things | |
- name: Start Metro | |
run: | | |
cd packages/icon-explorer | |
nohup yarn start & | |
- name: Run tests | |
run: | | |
cd packages/icon-explorer | |
NO_FLIPPER=1 pod install --project-directory=ios | |
yarn test:ios | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results-${{ matrix.rn-version }}-${{ matrix.api-level }}-ios | |
path: packages/icon-explorer/e2e/output | |
- uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: JEST Tests | |
path: packages/icon-explorer/e2e/output/*.xml | |
reporter: jest-junit |