name: Tests # https://dev.to/edvinasbartkus/running-react-native-detox-tests-for-ios-and-android-on-github-actions-2ekn # https://medium.com/@reime005/the-best-ci-cd-for-react-native-with-e2e-support-4860b4aaab29 on: [pull_request] jobs: test: runs-on: macos-latest steps: - name: Checkout project uses: actions/checkout@v2 - name: Specify node version uses: actions/setup-node@v2-beta with: node-version: 12 - name: Use npm caches uses: actions/cache@v2 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-npm- - name: Use node_modules caches id: cache-nm uses: actions/cache@v2 with: path: node_modules key: ${{ runner.os }}-nm-${{ hashFiles('package-lock.json') }} - name: Install node_modules if: steps.cache-nm.outputs.cache-hit != 'true' run: npm install - name: Run tests run: npm test || npm test || npm test env: HD_MNEMONIC: ${{ secrets.HD_MNEMONIC }} HD_MNEMONIC_BIP49: ${{ secrets.HD_MNEMONIC_BIP49 }} HD_MNEMONIC_BIP49_MANY_TX: ${{ secrets.HD_MNEMONIC_BIP49_MANY_TX }} HD_MNEMONIC_BIP84: ${{ secrets.HD_MNEMONIC_BIP84 }} HD_MNEMONIC_BREAD: ${{ secrets.HD_MNEMONIC_BREAD }} e2e: runs-on: macos-latest steps: - name: Checkout project uses: actions/checkout@v2 - name: Specify node version uses: actions/setup-node@v2-beta with: node-version: 12 - name: Use gradle caches uses: actions/cache@v2 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} restore-keys: | ${{ runner.os }}-gradle- - name: Use npm caches uses: actions/cache@v2 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-npm- - name: Use specific Java version for sdkmanager to work uses: joschi/setup-jdk@v2 with: java-version: '8' architecture: 'x64' - name: Install node_modules run: npm install - name: Build run: npm run e2e:release-build - name: Run tests uses: reactivecircus/android-emulator-runner@v2 with: api-level: 29 target: google_apis avd-name: Pixel_API_29_AOSP script: npm run e2e:release-test || npm run e2e:release-test env: HD_MNEMONIC: ${{ secrets.HD_MNEMONIC }} HD_MNEMONIC_BIP84: ${{ secrets.HD_MNEMONIC_BIP84 }} - uses: actions/upload-artifact@v1 if: failure() with: name: e2e-test-videos path: ./artifacts/