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