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