Skip to content

Instantly share code, notes, and snippets.

@juicemia
Created November 6, 2021 17:39
Show Gist options
  • Save juicemia/cade3b2ee4dce8182e0cad4b857702d8 to your computer and use it in GitHub Desktop.
Save juicemia/cade3b2ee4dce8182e0cad4b857702d8 to your computer and use it in GitHub Desktop.
Workflow for failed end-to-end tests
name: E2E CI
on: [workflow_dispatch]
jobs:
test:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Set up Node 16
uses: actions/setup-node@v2
with:
node-version: "16"
# This is necessary for fastlane, a dependency of the Turtle CLI that builds the app.
- uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7.2"
- name: Install dependencies
run: npm ci
- name: Install appium and expo
run: npm install -g appium expo turtle-cli
- name: Install fastlane
run: gem install fastlane
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Create simulator
run: echo "IPHONE_UDID=$(xcrun simctl create TestIPhone13 com.apple.CoreSimulator.SimDeviceType.iPhone-13 com.apple.CoreSimulator.SimRuntime.iOS-15-0)" >> $GITHUB_ENV
- name: Boot simulator
run: xcrun simctl boot ${{ env.IPHONE_UDID }}
- name: Create environment
run: ./setupEnvironment.sh ${{ secrets.API_SERVER_URL }} ${{ secrets.USER_POOL_ID }} ${{ secrets.WEB_CLIENT_ID }}
# Turtle builds the app in a tarball for upload to Expo but we want the actual app for tests.
- name: Build app with turtle
run: turtle build:ios -o app_bundle.tar.gz -t simulator . && tar -xzvf app_bundle.tar.gz
env:
EXPO_USERNAME: ${{ secrets.EXPO_USERNAME }}
EXPO_PASSWORD: ${{ secrets.EXPO_PASSWORD }}
- name: Run appium
run: appium > appium.log &
- name: Wait for Appium to be running
run: |
until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:4723/wd/hub/sessions); do
sleep 5
done
- name: Run tests
run: npm run e2e
env:
APP_PATH: ${{ github.workspace }}/trovlo-fe.app
- name: Upload Appium logs
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: appium.log
path: appium.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment