xref: /expo/.github/workflows/client-ios.yml (revision aa6fa0ae)
1name: iOS Client
2
3on:
4  workflow_dispatch:
5    inputs:
6      releaseSimulator:
7        description: 'type "release-simulator" to confirm upload'
8        required: false
9  schedule:
10    - cron: '20 5 * * 1,3,5' # 5:20 AM UTC time on every Monday, Wednesday and Friday
11  pull_request:
12    paths:
13      - .github/workflows/client-ios.yml
14      - ios/**
15      - tools/**
16      - secrets/**
17      - fastlane/**
18      - Gemfile.lock
19      - .ruby-version
20  push:
21    branches: [master, sdk-*]
22    paths:
23      - .github/workflows/client-ios.yml
24      - ios/**
25      - tools/**
26      - secrets/**
27      - fastlane/**
28      - Gemfile.lock
29      - .ruby-version
30
31concurrency:
32  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
33  cancel-in-progress: true
34
35jobs:
36  build:
37    runs-on: macos-11
38    steps:
39      - name: �� Checkout a ref for the event
40        uses: actions/checkout@v2
41        with:
42          submodules: true
43      - name: �� Switch to Xcode 12.5.1
44        run: sudo xcode-select --switch /Applications/Xcode_12.5.1.app
45      - name: �� Setup Homebrew
46        run: brew install git-crypt
47      - name: �� decrypt secrets if possible
48        env:
49          GIT_CRYPT_KEY_BASE64: ${{ secrets.GIT_CRYPT_KEY_BASE64 }}
50        run: |
51          if [[ ${GIT_CRYPT_KEY_BASE64:-unset} = unset ]]; then
52            echo 'git-crypt key not present in environment'
53          else
54            git crypt unlock <(echo $GIT_CRYPT_KEY_BASE64 | base64 --decode)
55          fi
56      - run: echo "$(pwd)/bin" >> $GITHUB_PATH
57      - name: ♻️ Restore workspace node modules
58        uses: actions/cache@v2
59        id: node-modules-cache
60        with:
61          path: |
62            # See "workspaces" → "packages" in the root package.json for the source of truth of
63            # which node_modules are affected by the root yarn.lock
64            node_modules
65            apps/*/node_modules
66            home/node_modules
67            packages/*/node_modules
68            packages/@unimodules/*/node_modules
69            react-native-lab/react-native/node_modules
70          key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
71      - name: �� Yarn install
72        run: yarn install --frozen-lockfile
73      - name: ♻️ Restore node modules in tools
74        uses: actions/cache@v2
75        with:
76          path: tools/node_modules
77          key: ${{ runner.os }}-tools-modules-${{ hashFiles('tools/yarn.lock') }}
78      - name: �� Generating dynamic macros
79        run: expotools ios-generate-dynamic-macros
80      - name: �� Setup Ruby and install gems
81        uses: ruby/setup-ruby@v1
82        with:
83          bundler-cache: true
84      - name: ♻️ Restore ios/Pods from cache
85        uses: actions/cache@v2
86        with:
87          path: 'ios/Pods'
88          key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
89          restore-keys: |
90            ${{ runner.os }}-pods-
91      - name: �� Install CocoaPods in `ios`
92        run: pod install
93        working-directory: ios
94      - name: �� Check which flavor to build
95        id: flavor
96        uses: dorny/paths-filter@v2
97        with:
98          # this action fails when base is not set on schedule event
99          base: ${{ github.ref }}
100          filters: |
101            versioned:
102              - ios/versioned-react-native/**
103              - ios/Exponent/Versioned/**
104      - name: �� Build Expo Go for simulator
105        run: |
106          [[ "$IS_VERSIONED_FLAVOR" == "true" ]] && FLAVOR="versioned" || FLAVOR="unversioned"
107          echo "Building with $FLAVOR flavor"
108          expotools client-build --platform ios --flavor $FLAVOR
109        timeout-minutes: 120
110        env:
111          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
112          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
113          IS_VERSIONED_FLAVOR: ${{ github.event_name == 'schedule' || steps.flavor.outputs.versioned == 'true' }}
114      - name: �� Save test results
115        if: always()
116        uses: actions/upload-artifact@v2
117        with:
118          name: fastlane-logs
119          path: ~/Library/Logs/fastlane
120      - name: �� Build Expo Go for simulator
121        run: expotools client-build --platform ios --release # should only upload already-built app
122        if: ${{ github.event.inputs.releaseSimulator == 'release-simulator' }}
123        env:
124          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
125          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
126          EXPO_VERSIONS_SECRET: ${{ secrets.EXPO_VERSIONS_SECRET }}
127      - name: �� Notify on Slack
128        uses: 8398a7/action-slack@v3
129        if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-'))
130        env:
131          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }}
133        with:
134          channel: '#platform-ios'
135          status: ${{ job.status }}
136          fields: job,message,ref,eventName,author,took
137          author_name: Expo Go (iOS)
138