Skip to content

Commit 3c212d7

Browse files
committed
chore: optimize
1 parent 9e3999d commit 3c212d7

2 files changed

Lines changed: 53 additions & 39 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ runs:
99
with:
1010
node-version-file: .nvmrc
1111

12+
- name: Setup Ruby
13+
if: ${{ runner.os == 'macOS' }}
14+
uses: ruby/setup-ruby@v1
15+
with:
16+
bundler-cache: true
17+
18+
- name: Setup by gem
19+
if: ${{ runner.os == 'macOS' }}
20+
run: gem install 'activesupport:7.0.8' 'xcodeproj:1.25.1'
21+
shell: bash
22+
23+
- name: Setup Cocoapods
24+
if: ${{ runner.os == 'macOS' }}
25+
uses: maxim-lobanov/setup-cocoapods@v1
26+
with:
27+
version: 1.13.0
28+
1229
- name: Cache dependencies
1330
id: yarn-cache
1431
uses: actions/cache@v3
@@ -23,7 +40,7 @@ runs:
2340
2441
- name: Install dependencies
2542
env:
26-
POD_INSTALL: 0
43+
POD_INSTALL: '0'
2744
if: steps.yarn-cache.outputs.cache-hit != 'true'
2845
run: yarn install --immutable
2946
shell: bash

.github/workflows/build.yml

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
name: Build API Example
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
37
on:
48
workflow_dispatch:
59

610
jobs:
711
build-android:
812
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
newArch: [false, true]
916
env:
1017
TURBO_CACHE_DIR: .turbo/android
1118
turbo_cache_hit: 0
19+
ORG_GRADLE_PROJECT_newArchEnabled: ${{ matrix.newArch }}
1220
steps:
1321
- name: Checkout
14-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
1523

1624
- name: Setup
1725
uses: ./.github/actions/setup
@@ -20,9 +28,9 @@ jobs:
2028
uses: actions/cache@v3
2129
with:
2230
path: ${{ env.TURBO_CACHE_DIR }}
23-
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('**/yarn.lock') }}
31+
key: ${{ runner.os }}-turborepo-android-${{ matrix.newArch }}-${{ hashFiles('**/yarn.lock') }}
2432
restore-keys: |
25-
${{ runner.os }}-turborepo-android-
33+
${{ runner.os }}-turborepo-android-${{ matrix.newArch }}-
2634
2735
- name: Check turborepo cache for Android
2836
run: |
@@ -36,8 +44,8 @@ jobs:
3644
if: env.turbo_cache_hit != 1
3745
uses: actions/setup-java@v3
3846
with:
39-
distribution: "zulu"
40-
java-version: "11"
47+
distribution: 'zulu'
48+
java-version: '17'
4149

4250
- name: Finalize Android SDK
4351
if: env.turbo_cache_hit != 1
@@ -51,9 +59,9 @@ jobs:
5159
path: |
5260
~/.gradle/wrapper
5361
~/.gradle/caches
54-
key: ${{ runner.os }}-gradle-false-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
62+
key: ${{ runner.os }}-gradle-${{ matrix.newArch }}-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
5563
restore-keys: |
56-
${{ runner.os }}-gradle-false-
64+
${{ runner.os }}-gradle-${{ matrix.newArch }}-
5765
5866
- name: Modify APP ID
5967
run: |
@@ -63,47 +71,43 @@ jobs:
6371

6472
- name: Build example for Android
6573
run: |
66-
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
74+
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --force=true
6775
6876
- name: Upload APK
6977
uses: actions/upload-artifact@v4
7078
with:
71-
name: AgoraRtcNgExample
79+
name: AgoraRtcNgExample-Android-${{ matrix.newArch && 'NewArch' || 'OldArch' }}-${{ github.run_id }}
7280
path: |
7381
example/android/app/build/outputs/apk/release/*.apk
82+
if-no-files-found: error
7483

7584
build-ios:
7685
runs-on: macos-latest
86+
strategy:
87+
matrix:
88+
newArch: [false, true]
7789
env:
7890
TURBO_CACHE_DIR: .turbo/ios
7991
turbo_cache_hit: 0
92+
RCT_NEW_ARCH_ENABLED: ${{ matrix.newArch }}
8093
steps:
8194
- name: Checkout
82-
uses: actions/checkout@v3
95+
uses: actions/checkout@v4
8396

8497
- name: Setup
8598
uses: ./.github/actions/setup
8699

87-
- name: Setup cocoapods
100+
- name: Setup fastlane
88101
run: |
89-
gem install cocoapods -v 1.13.0
90-
gem install activesupport -v 7.0.8
102+
brew install fastlane
91103
92104
- name: Cache turborepo for iOS
93105
uses: actions/cache@v3
94106
with:
95107
path: ${{ env.TURBO_CACHE_DIR }}
96-
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('**/yarn.lock') }}
108+
key: ${{ runner.os }}-turborepo-ios-${{ matrix.newArch }}-${{ hashFiles('**/yarn.lock') }}
97109
restore-keys: |
98-
${{ runner.os }}-turborepo-ios-
99-
100-
- name: Check turborepo cache for iOS
101-
run: |
102-
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")
103-
104-
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
105-
echo "turbo_cache_hit=1" >> $GITHUB_ENV
106-
fi
110+
${{ runner.os }}-turborepo-ios-${{ matrix.newArch }}-
107111
108112
- name: Cache cocoapods
109113
if: env.turbo_cache_hit != 1
@@ -112,23 +116,14 @@ jobs:
112116
with:
113117
path: |
114118
**/ios/Pods
115-
key: ${{ runner.os }}-cocoapods-0-${{ hashFiles('example/ios/Podfile.lock') }}
119+
key: ${{ runner.os }}-cocoapods-${{ matrix.newArch }}-${{ hashFiles('example/ios/Podfile.lock') }}
116120
restore-keys: |
117-
${{ runner.os }}-cocoapods-0-
121+
${{ runner.os }}-cocoapods-${{ matrix.newArch }}-
118122
119123
- name: Install cocoapods
120-
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
121124
run: |
122125
yarn pod-install example/ios
123126
124-
- name: Upload Podfile.lock & Manifest.lock
125-
uses: actions/upload-artifact@v4
126-
with:
127-
name: lock
128-
path: |
129-
example/ios/Podfile.lock
130-
example/ios/Pods/Manifest.lock
131-
132127
- name: Modify APP ID
133128
run: |
134129
sed "s/localAppId = '\(.*\)'/localAppId = '${{ secrets.APP_ID }}'/g" agora.config.ts > tmp
@@ -166,25 +161,27 @@ jobs:
166161
167162
- name: Build example for iOS
168163
run: |
169-
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
164+
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --force=true
170165
171166
- name: Upload IPA
172167
uses: actions/upload-artifact@v4
173168
with:
174-
name: AgoraRtcNgExample
169+
name: AgoraRtcNgExample-iOS-${{ matrix.newArch && 'NewArch' || 'OldArch' }}-${{ github.run_id }}
175170
path: |
176171
example/ios/*.ipa
172+
if-no-files-found: error
177173

178174
- name: Upload dSYM
179175
uses: actions/upload-artifact@v4
180176
with:
181-
name: AgoraRtcNgExampleSymbol
177+
name: AgoraRtcNgExampleSymbol-${{ matrix.newArch && 'NewArch' || 'OldArch' }}-${{ github.run_id }}
182178
path: |
183179
example/ios/*.dSYM.zip
180+
if-no-files-found: error
184181

185182
notification:
186183
runs-on: ubuntu-latest
187184
needs: [build-android, build-ios]
188185
steps:
189186
- run: |
190-
curl -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${{ secrets.WECHAT_KEY }}" -d '{"msgtype":"text","text":{"content":"ReactNative:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}}'
187+
curl -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${{ secrets.WECHAT_KEY }}" -d '{"msgtype":"text","text":{"content":"ReactNative Example:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\nDownload Link:\nhttps://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}"}}'

0 commit comments

Comments
 (0)