xref: /expo/.github/workflows/client-ios.yml (revision 57852c41)
1name: iOS Client
2
3on:
4  workflow_dispatch:
5    inputs:
6      releaseSimulator:
7        description: 'type "release-simulator" to confirm upload'
8        required: false
9  pull_request:
10    paths:
11      - .github/workflows/client-ios.yml
12      - ios/**
13      - tools/**
14      - secrets/**
15      - fastlane/**
16      - Gemfile.lock
17      - .ruby-version
18  push:
19    branches: [master, sdk-*]
20    paths:
21      - .github/workflows/client-ios.yml
22      - ios/**
23      - tools/**
24      - secrets/**
25      - fastlane/**
26      - Gemfile.lock
27      - .ruby-version
28
29concurrency:
30  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
31  cancel-in-progress: true
32
33jobs:
34  build:
35    runs-on: macos-10.15
36    steps:
37      - uses: actions/checkout@v2
38        with:
39          submodules: true
40      - run: brew install git-crypt
41      - name: decrypt secrets if possible
42        env:
43          GIT_CRYPT_KEY_BASE64: ${{ secrets.GIT_CRYPT_KEY_BASE64 }}
44        run: |
45          if [[ ${GIT_CRYPT_KEY_BASE64:-unset} = unset ]]; then
46            echo 'git-crypt key not present in environment'
47          else
48            git crypt unlock <(echo $GIT_CRYPT_KEY_BASE64 | base64 --decode)
49          fi
50      - run: echo "$(pwd)/bin" >> $GITHUB_PATH
51      - name: Get yarn cache directory path
52        id: yarn-cache-dir-path
53        run: echo "::set-output name=dir::$(yarn cache dir)"
54      - name: ♻️ Restore yarn cache
55        uses: actions/cache@v2
56        with:
57          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
58          key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
59          restore-keys: |
60            ${{ runner.os }}-yarn-
61      - name: �� Yarn install
62        run: yarn install --frozen-lockfile
63      - name: ♻️ Restore tools/node_modules from cache
64        uses: actions/cache@v2
65        with:
66          path: 'tools/node_modules'
67          key: ${{ runner.os }}-modules-${{ hashFiles('tools/yarn.lock') }}
68      - run: expotools ios-generate-dynamic-macros
69      - uses: ruby/setup-ruby@v1
70        with:
71          bundler-cache: true
72      - name: Restore ios/Pods from cache
73        uses: actions/cache@v2
74        with:
75          path: 'ios/Pods'
76          key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
77          restore-keys: |
78            ${{ runner.os }}-pods-
79      - name: �� Install CocoaPods in `ios`
80        run: pod install
81        working-directory: ios
82      - name: �� Check which flavor to build
83        id: flavor
84        uses: dorny/paths-filter@v2
85        with:
86          filters: |
87            versioned:
88              - ios/versioned-react-native/**
89              - ios/Exponent/Versioned/**
90      - name: �� Build Expo Go for simulator
91        run: expotools client-build --platform ios --flavor ${{ steps.flavor.outputs.versioned == 'true' && 'versioned' || 'unversioned' }}
92        timeout-minutes: 120
93        env:
94          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
95          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
96      - name: Save test results
97        if: always()
98        uses: actions/upload-artifact@v2
99        with:
100          name: fastlane-logs
101          path: ~/Library/Logs/fastlane
102      - run: expotools client-build --platform ios --release # should only upload already-built app
103        if: ${{ github.event.inputs.releaseSimulator == 'release-simulator' }}
104        env:
105          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
106          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
107          EXPO_VERSIONS_SECRET: ${{ secrets.EXPO_VERSIONS_SECRET }}
108      - name: �� Notify on Slack
109        uses: 8398a7/action-slack@v3
110        if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-'))
111        env:
112          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }}
114        with:
115          channel: '#platform-ios'
116          status: ${{ job.status }}
117          fields: job,commit,ref,eventName,author,took
118          author_name: Expo Go (iOS)
119