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