xref: /expo/.github/workflows/client-ios.yml (revision 962569db)
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-10.15
38    steps:
39      - name: �� Checkout a ref for the event
40        uses: actions/checkout@v2
41        with:
42          submodules: true
43      - name: �� Setup Homebrew
44        run: brew install git-crypt
45      - name: �� decrypt secrets if possible
46        env:
47          GIT_CRYPT_KEY_BASE64: ${{ secrets.GIT_CRYPT_KEY_BASE64 }}
48        run: |
49          if [[ ${GIT_CRYPT_KEY_BASE64:-unset} = unset ]]; then
50            echo 'git-crypt key not present in environment'
51          else
52            git crypt unlock <(echo $GIT_CRYPT_KEY_BASE64 | base64 --decode)
53          fi
54      - run: echo "$(pwd)/bin" >> $GITHUB_PATH
55      - name: ♻️ Restore workspace node modules
56        uses: actions/cache@v2
57        id: node-modules-cache
58        with:
59          path: |
60            # See "workspaces" → "packages" in the root package.json for the source of truth of
61            # which node_modules are affected by the root yarn.lock
62            node_modules
63            apps/*/node_modules
64            home/node_modules
65            packages/*/node_modules
66            packages/@unimodules/*/node_modules
67            react-native-lab/react-native/node_modules
68          key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
69      - name: �� Yarn install
70        run: yarn install --frozen-lockfile
71      - name: ♻️ Restore node modules in tools
72        uses: actions/cache@v2
73        with:
74          path: tools/node_modules
75          key: ${{ runner.os }}-tools-modules-${{ hashFiles('tools/yarn.lock') }}
76      - name: �� Generating dynamic macros
77        run: expotools ios-generate-dynamic-macros
78      - name: �� Setup Ruby and install gems
79        uses: ruby/setup-ruby@v1
80        with:
81          bundler-cache: true
82      - name: ♻️ Restore ios/Pods from cache
83        uses: actions/cache@v2
84        with:
85          path: 'ios/Pods'
86          key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
87          restore-keys: |
88            ${{ runner.os }}-pods-
89      - name: �� Install CocoaPods in `ios`
90        run: pod install
91        working-directory: ios
92      - name: �� Check which flavor to build
93        id: flavor
94        uses: dorny/paths-filter@v2
95        with:
96          filters: |
97            versioned:
98              - ios/versioned-react-native/**
99              - ios/Exponent/Versioned/**
100      - name: �� Build Expo Go for simulator
101        run: |
102          [[ "$IS_VERSIONED_FLAVOR" == "true" ]] && FLAVOR="versioned" || FLAVOR="unversioned"
103          echo "Building with $FLAVOR flavor"
104          expotools client-build --platform ios --flavor $FLAVOR
105        timeout-minutes: 120
106        env:
107          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
108          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
109          IS_VERSIONED_FLAVOR: ${{ github.event_name == 'schedule' || steps.flavor.outputs.versioned == 'true' }}
110      - name: �� Save test results
111        if: always()
112        uses: actions/upload-artifact@v2
113        with:
114          name: fastlane-logs
115          path: ~/Library/Logs/fastlane
116      - name: �� Build Expo Go for simulator
117        run: expotools client-build --platform ios --release # should only upload already-built app
118        if: ${{ github.event.inputs.releaseSimulator == 'release-simulator' }}
119        env:
120          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
121          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
122          EXPO_VERSIONS_SECRET: ${{ secrets.EXPO_VERSIONS_SECRET }}
123      - name: �� Notify on Slack
124        uses: 8398a7/action-slack@v3
125        if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-'))
126        env:
127          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }}
129        with:
130          channel: '#platform-ios'
131          status: ${{ job.status }}
132          fields: job,message,ref,eventName,author,took
133          author_name: Expo Go (iOS)
134