|
1 | 1 | name: CI |
| 2 | + |
2 | 3 | on: |
3 | | - push: |
4 | | - branches: |
5 | | - - main |
6 | 4 | pull_request: |
7 | | - branches: |
8 | | - - main |
9 | 5 |
|
10 | 6 | jobs: |
11 | | - lint: |
| 7 | + lint-and-build: |
| 8 | + name: Lint, Type Check & Build |
12 | 9 | runs-on: ubuntu-latest |
13 | | - steps: |
14 | | - - name: Checkout |
15 | | - uses: actions/checkout@v3 |
16 | | - |
17 | | - - name: Setup |
18 | | - uses: ./.github/actions/setup |
19 | | - |
20 | | - - name: Lint files |
21 | | - run: yarn lint |
22 | 10 |
|
23 | | - - name: Typecheck files |
24 | | - run: yarn typecheck |
25 | | - |
26 | | - test: |
27 | | - runs-on: ubuntu-latest |
28 | 11 | steps: |
29 | 12 | - name: Checkout |
30 | | - uses: actions/checkout@v3 |
31 | | - |
32 | | - - name: Setup |
33 | | - uses: ./.github/actions/setup |
34 | | - |
35 | | - - name: Run unit tests |
36 | | - run: yarn test --maxWorkers=2 --coverage |
| 13 | + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd |
37 | 14 |
|
38 | | - build-library: |
39 | | - runs-on: ubuntu-latest |
40 | | - steps: |
41 | | - - name: Checkout |
42 | | - uses: actions/checkout@v3 |
43 | | - |
44 | | - - name: Setup |
45 | | - uses: ./.github/actions/setup |
46 | | - |
47 | | - - name: Build package |
48 | | - run: yarn prepare |
49 | | - |
50 | | - build-android: |
51 | | - runs-on: ubuntu-latest |
52 | | - env: |
53 | | - TURBO_CACHE_DIR: .turbo/android |
54 | | - steps: |
55 | | - - name: Checkout |
56 | | - uses: actions/checkout@v3 |
57 | | - |
58 | | - - name: Setup |
59 | | - uses: ./.github/actions/setup |
60 | | - |
61 | | - - name: Cache turborepo for Android |
62 | | - uses: actions/cache@v3 |
63 | | - with: |
64 | | - path: ${{ env.TURBO_CACHE_DIR }} |
65 | | - key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} |
66 | | - restore-keys: | |
67 | | - ${{ runner.os }}-turborepo-android- |
68 | | -
|
69 | | - - name: Check turborepo cache for Android |
70 | | - run: | |
71 | | - TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") |
72 | | -
|
73 | | - if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then |
74 | | - echo "turbo_cache_hit=1" >> $GITHUB_ENV |
75 | | - fi |
76 | | -
|
77 | | - - name: Install JDK |
78 | | - if: env.turbo_cache_hit != 1 |
79 | | - uses: actions/setup-java@v3 |
80 | | - with: |
81 | | - distribution: 'zulu' |
82 | | - java-version: '17' |
83 | | - |
84 | | - - name: Finalize Android SDK |
85 | | - if: env.turbo_cache_hit != 1 |
86 | | - run: | |
87 | | - /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" |
88 | | -
|
89 | | - - name: Cache Gradle |
90 | | - if: env.turbo_cache_hit != 1 |
91 | | - uses: actions/cache@v3 |
92 | | - with: |
93 | | - path: | |
94 | | - ~/.gradle/wrapper |
95 | | - ~/.gradle/caches |
96 | | - key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }} |
97 | | - restore-keys: | |
98 | | - ${{ runner.os }}-gradle- |
99 | | -
|
100 | | - - name: Build example for Android |
101 | | - env: |
102 | | - JAVA_OPTS: "-XX:MaxHeapSize=6g" |
103 | | - run: | |
104 | | - yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" |
105 | | -
|
106 | | - build-ios: |
107 | | - runs-on: macos-14 |
108 | | - env: |
109 | | - TURBO_CACHE_DIR: .turbo/ios |
110 | | - steps: |
111 | | - - name: Checkout |
112 | | - uses: actions/checkout@v3 |
113 | | - |
114 | | - - name: Setup |
115 | | - uses: ./.github/actions/setup |
116 | | - |
117 | | - - name: Cache turborepo for iOS |
118 | | - uses: actions/cache@v3 |
| 15 | + - name: Setup Node |
| 16 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 |
119 | 17 | with: |
120 | | - path: ${{ env.TURBO_CACHE_DIR }} |
121 | | - key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }} |
122 | | - restore-keys: | |
123 | | - ${{ runner.os }}-turborepo-ios- |
| 18 | + node-version-file: '.nvmrc' |
124 | 19 |
|
125 | | - - name: Check turborepo cache for iOS |
126 | | - run: | |
127 | | - TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") |
| 20 | + - name: Enable corepack |
| 21 | + run: corepack enable |
128 | 22 |
|
129 | | - if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then |
130 | | - echo "turbo_cache_hit=1" >> $GITHUB_ENV |
131 | | - fi |
| 23 | + - name: Install dependencies |
| 24 | + run: yarn install --immutable |
132 | 25 |
|
133 | | - - name: Cache cocoapods |
134 | | - if: env.turbo_cache_hit != 1 |
135 | | - id: cocoapods-cache |
136 | | - uses: actions/cache@v3 |
137 | | - with: |
138 | | - path: | |
139 | | - **/ios/Pods |
140 | | - key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }} |
141 | | - restore-keys: | |
142 | | - ${{ runner.os }}-cocoapods- |
| 26 | + - name: Type check |
| 27 | + run: yarn typecheck |
143 | 28 |
|
144 | | - - name: Install cocoapods |
145 | | - if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' |
146 | | - run: | |
147 | | - cd example/ios |
148 | | - pod install |
149 | | - env: |
150 | | - NO_FLIPPER: 1 |
| 29 | + - name: Lint check |
| 30 | + run: yarn lint |
151 | 31 |
|
152 | | - - name: Build example for iOS |
153 | | - run: | |
154 | | - yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" |
| 32 | + - name: Build |
| 33 | + run: yarn prepare |
0 commit comments