Activate detox tests in CI #121
Workflow file for this run
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: CI PR Checks | ||
on: pull_request | ||
jobs: | ||
eslint: | ||
name: ESLint | ||
permissions: | ||
actions: write | ||
contents: write | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
- name: 'Checkout ${{ inputs.ref }}' | ||
uses: actions/checkout@v2 | ||
with: | ||
path: source | ||
ref: '${{ inputs.ref }}' | ||
- name: Install Basic app dependencies | ||
run: | | ||
yarn install | ||
working-directory: source/examples/Basic | ||
- name: Linter Basic | ||
run: | | ||
npx eslint . --ext .js,.jsx,.ts,.tsx | ||
working-directory: source/examples/Basic | ||
- name: Install TestNamiTV app dependencies | ||
run: | | ||
yarn install | ||
working-directory: source/examples/TestNamiTV | ||
- name: Linter TestNamiTV | ||
run: | | ||
npx eslint . --ext .js,.jsx,.ts,.tsx | ||
working-directory: source/examples/TestNamiTV | ||
e2e-ios: | ||
runs-on: macos-12 | ||
steps: | ||
- name: 'Checkout ${{ inputs.ref }}' | ||
uses: actions/checkout@v2 | ||
with: | ||
path: source | ||
ref: '${{ inputs.ref }}' | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
- name: Install Yarn dependencies | ||
run: yarn install | ||
working-directory: source/examples/Basic | ||
- name: Install macOS dependencies | ||
run: | | ||
brew tap wix/brew | ||
brew install applesimutils | ||
sudo gem install cocoapods | ||
gem install CFPropertyList | ||
- name: Install iOS pods | ||
run: | | ||
pod update | ||
pod install | ||
working-directory: source/examples/Basic/ios | ||
- name: Install Detox CLI | ||
run: yarn global add detox-cli | ||
working-directory: source/examples/Basic | ||
- name: Install React-native CLI | ||
run: yarn global add react-native-cli | ||
working-directory: source/examples/Basic | ||
- name: Install Detox | ||
run: yarn add --dev detox | ||
working-directory: source/examples/Basic | ||
- name: Detox build | ||
run: detox build --configuration ios.sim.release | ||
working-directory: source/examples/Basic | ||
- name: Detox test | ||
run: | | ||
yarn start & | ||
METRO_BUNDLER_PID=$! | ||
detox test --configuration ios.sim.release --cleanup --headless --record-logs all | ||
DETOX_EXIT_CODE=$? | ||
kill $METRO_BUNDLER_PID | ||
exit $DETOX_EXIT_CODE | ||
working-directory: source/examples/Basic | ||
- name: Upload artifacts | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: detox-artifacts | ||
path: artifacts | ||
e2e-android: | ||
runs-on: ubuntu-latest | ||
fail-fast: false | ||
steps: | ||
- name: 'Checkout ${{ inputs.ref }}' | ||
uses: actions/checkout@v2 | ||
with: | ||
path: source | ||
ref: '${{ inputs.ref }}' | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
- name: Install Dependencies | ||
run: yarn install --frozen-lockfile | ||
working-directory: source/examples/Basic | ||
- name: Install React-native CLI | ||
run: yarn global add react-native-cli | ||
working-directory: source/examples/Basic | ||
- name: Install Detox CLI | ||
run: yarn global add detox-cli | ||
working-directory: source/examples/Basic | ||
- name: Install Detox | ||
run: yarn add --dev detox | ||
working-directory: source/examples/Basic | ||
- name: Detox build | ||
run: | | ||
rm -rf node_modules/react-native-nami-sdk/examples | ||
detox build --configuration android.emu.release | ||
working-directory: source/examples/Basic | ||
- name: Run Detox Test(s) | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 29 | ||
target: default | ||
arch: x86_64 | ||
profile: pixel | ||
avd-name: Pixel_API_29_AOSP | ||
script: | | ||
cd examples/Basic | ||
yarn start & | ||
METRO_BUNDLER_PID=$! | ||
detox test --configuration android.emu.release --cleanup --headless --record-logs all | ||
DETOX_EXIT_CODE=$? | ||
kill $METRO_BUNDLER_PID | ||
exit $DETOX_EXIT_CODE | ||
- name: Upload artifacts | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: detox-artifacts | ||
path: artifacts |