xref: /expo/.github/workflows/client-ios.yml (revision f8111c10)
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          # this action fails when base is not set on schedule event
97          base: ${{ github.ref }}
98          filters: |
99            versioned:
100              - ios/versioned-react-native/**
101              - ios/Exponent/Versioned/**
102      - name: �� Build Expo Go for simulator
103        run: |
104          [[ "$IS_VERSIONED_FLAVOR" == "true" ]] && FLAVOR="versioned" || FLAVOR="unversioned"
105          echo "Building with $FLAVOR flavor"
106          expotools client-build --platform ios --flavor $FLAVOR
107        timeout-minutes: 120
108        env:
109          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
110          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
111          IS_VERSIONED_FLAVOR: ${{ github.event_name == 'schedule' || steps.flavor.outputs.versioned == 'true' }}
112      - name: �� Save test results
113        if: always()
114        uses: actions/upload-artifact@v2
115        with:
116          name: fastlane-logs
117          path: ~/Library/Logs/fastlane
118      - name: �� Build Expo Go for simulator
119        run: expotools client-build --platform ios --release # should only upload already-built app
120        if: ${{ github.event.inputs.releaseSimulator == 'release-simulator' }}
121        env:
122          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
123          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
124          EXPO_VERSIONS_SECRET: ${{ secrets.EXPO_VERSIONS_SECRET }}
125      - name: �� Notify on Slack
126        uses: 8398a7/action-slack@v3
127        if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-'))
128        env:
129          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }}
131        with:
132          channel: '#platform-ios'
133          status: ${{ job.status }}
134          fields: job,message,ref,eventName,author,took
135          author_name: Expo Go (iOS)
136