Update build-app.yml for Azure Pipelines #853
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: Build [iOS] | |
on: | |
workflow_dispatch: # To trigger manual build | |
pull_request: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ios-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-ios-app: | |
name: Build ios app | |
runs-on: macos-latest | |
steps: | |
- name: Check out Git repository # clone the repo to local ci workspace | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
- uses: actions/cache@v2 | |
name: Cache Node Modules | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
- name: Install yarn dependencies | |
run: | | |
yarn install --frozen-lockfile | |
- uses: mikehardy/buildcache-action@v1 | |
- uses: actions/cache@v2 | |
id: cache-pod | |
name: Cache Pod and build files | |
with: | |
path: | | |
ios/Pods | |
ios/build | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
- name: CocoaPod Install | |
if: ${{ steps.cache-pod.outputs.cache-hit == false }} | |
working-directory: ios | |
run: | | |
pod install | |
- name: Build ios app | |
run: | | |
yarn detox:build:ios-ci >> ios-build.logs | |
- name: Print logs | |
if: ${{ failure() }} | |
run: | | |
cat ios-build.logs | |
- name: Upload app files | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ios-app | |
path: ios/build/Build/Products/Release-iphonesimulator/*.app | |
test-ios-app: | |
name: Test iOS app | |
runs-on: macos-latest | |
needs: | |
- build-ios-app | |
steps: | |
- name: Check out Git repository # clone the repo to local ci workspace | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
- uses: actions/cache@v2 | |
name: Cache Node Modules | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
- name: Install yarn dependencies | |
run: | | |
yarn install --frozen-lockfile | |
- name: Install detox environment | |
env: | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
run: | | |
brew tap wix/brew | |
brew install applesimutils | |
- name: Build detox cache | |
run: | | |
yarn detox:cache | |
- name: Download app artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ios-app | |
path: ios/build/Build/Products/Release-iphonesimulator/ | |
- name: Test ios app | |
env: | |
DETOX_DEFAULT_LOGIN_EMAIL: ${{ secrets.DETOX_DEFAULT_LOGIN_EMAIL }} | |
DETOX_DEFAULT_LOGIN_PASSWORD: ${{ secrets.DETOX_DEFAULT_LOGIN_PASSWORD }} | |
run: | | |
yarn detox:test:ios-ci --retries=3 --artifacts-location ./artifacts/ --record-videos all | |
- name: Upload detox artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: detox-ios-artifacts | |
path: artifacts | |
- name: Upload demo artifacts | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: detox-demo-ios | |
path: artifacts/✓ App Demo/test.mp4 | |