1name: iOS Unit Tests 2 3on: 4 workflow_dispatch: {} 5 pull_request: 6 paths: 7 - .github/workflows/ios-unit-tests.yml 8 - ios/** 9 - packages/**/ios/** 10 - tools/src/dynamic-macros/** 11 - tools/src/commands/IosGenerateDynamicMacros.ts 12 - tools/src/commands/IosNativeUnitTests.ts 13 - tools/src/commands/NativeUnitTests.ts 14 - secrets/** 15 - fastlane/** 16 - Gemfile.lock 17 - .ruby-version 18 push: 19 branches: [master] 20 paths: 21 - .github/workflows/ios-unit-tests.yml 22 - ios/** 23 - packages/**/ios/** 24 - tools/src/dynamic-macros/** 25 - tools/src/commands/IosGenerateDynamicMacros.ts 26 - tools/src/commands/IosNativeUnitTests.ts 27 - tools/src/commands/NativeUnitTests.ts 28 - secrets/** 29 - fastlane/** 30 - Gemfile.lock 31 - .ruby-version 32 33concurrency: 34 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} 35 cancel-in-progress: true 36 37jobs: 38 build: 39 runs-on: macos-11 40 steps: 41 - uses: actions/checkout@v2 42 with: 43 submodules: true 44 - name: Switch to Xcode 13.0 45 run: sudo xcode-select --switch /Applications/Xcode_13.0.app 46 - run: brew install git-crypt 47 - name: decrypt secrets if possible 48 env: 49 GIT_CRYPT_KEY_BASE64: ${{ secrets.GIT_CRYPT_KEY_BASE64 }} 50 run: | 51 if [[ ${GIT_CRYPT_KEY_BASE64:-unset} = unset ]]; then 52 echo 'git-crypt key not present in environment' 53 else 54 git crypt unlock <(echo $GIT_CRYPT_KEY_BASE64 | base64 --decode) 55 fi 56 - run: echo "$(pwd)/bin" >> $GITHUB_PATH 57 - name: Get yarn cache directory path 58 id: yarn-cache-dir-path 59 run: echo "::set-output name=dir::$(yarn cache dir)" 60 - name: ♻️ Restore yarn cache 61 uses: actions/cache@v2 62 with: 63 path: ${{ steps.yarn-cache-dir-path.outputs.dir }} 64 key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} 65 restore-keys: | 66 ${{ runner.os }}-yarn- 67 - name: Yarn install 68 run: yarn install --frozen-lockfile 69 - name: ♻️ Restore tools/node_modules from cache 70 uses: actions/cache@v2 71 with: 72 path: 'tools/node_modules' 73 key: ${{ runner.os }}-modules-${{ hashFiles('tools/yarn.lock') }} 74 - run: expotools ios-generate-dynamic-macros 75 - uses: ruby/setup-ruby@v1 76 with: 77 bundler-cache: true 78 - name: Restore ios/Pods from cache 79 uses: actions/cache@v2 80 id: pods-cache 81 with: 82 path: 'ios/Pods' 83 key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }} 84 # restore-keys: | 85 # ${{ runner.os }}-pods- 86 - name: Install CocoaPods in `ios` 87 run: pod install 88 working-directory: ios 89 - name: Run native iOS unit tests 90 run: expotools native-unit-tests --platform ios 91