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