Skip to content

Commit

Permalink
[WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Oct 9, 2023
1 parent ce01df9 commit bb67e55
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ runs:
${{ runner.os }}-yarn-ng-
- name: Install dependencies
run: |
yarn install --immutable
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
shell: bash
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Modify APP ID
run: |
sed "s/localAppId = '\(.*\)'/localAppId = '${{ secrets.APP_ID }}'/g" agora.config.ts > tmp
mv tmp agora.config.ts
working-directory: example/src/config

- name: Build example for Android
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
Expand Down
97 changes: 81 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
newArch: [ true, false ]
runs-on: macos-latest
env:
NITRO_API_KEY: ${{ secrets.NITRO_API_KEY }}
TURBO_CACHE_DIR: .turbo/android
ORG_GRADLE_PROJECT_newArchEnabled: ${{ matrix.newArch }}
steps:
- name: Checkout
Expand All @@ -70,6 +70,45 @@ jobs:
- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for Android
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-android-
- name: Check turborepo cache for Android
run: |
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")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Install JDK
if: env.turbo_cache_hit != 1
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Finalize Android SDK
if: env.turbo_cache_hit != 1
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
- name: Cache Gradle
if: env.turbo_cache_hit != 1
uses: actions/cache@v3
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Install Detox dependencies
shell: bash
run: |
Expand All @@ -81,13 +120,9 @@ jobs:
mv tmp agora.config.ts
working-directory: example/src/config

- uses: nitro-build/github-action-nitro-android@v1
id: nitro
with:
debug: true
detox-configuration: android.emu.release
root-directory: example
cache-env-var-lookup-keys: ORG_GRADLE_PROJECT_*
- name: Build example for Android
run: |
yarn turbo run detox:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
- name: Run e2e tests
if: ${{ matrix.newArch == false }}
Expand All @@ -105,7 +140,7 @@ jobs:
newArch: [ 1, 0 ]
runs-on: macos-latest
env:
NITRO_API_KEY: ${{ secrets.NITRO_API_KEY }}
TURBO_CACHE_DIR: .turbo/ios
RCT_NEW_ARCH_ENABLED: ${{ matrix.newArch }}
steps:
- name: Checkout
Expand All @@ -114,6 +149,40 @@ jobs:
- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for iOS
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-ios-
- name: Check turborepo cache for iOS
run: |
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")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Cache cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v3
with:
path: |
**/ios/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
- name: Install cocoapods
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
yarn pod-install example/ios
env:
NO_FLIPPER: 1

- name: Install Detox dependencies
shell: bash
run: |
Expand All @@ -127,13 +196,9 @@ jobs:
mv tmp agora.config.ts
working-directory: example/src/config

- uses: nitro-build/github-action-nitro-ios@v1
id: nitro
with:
debug: true
detox-configuration: ios.sim.release
root-directory: example
cache-env-var-lookup-keys: RCT_NEW_ARCH_ENABLED
- name: Build example for iOS
run: |
yarn turbo run detox:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
- uses: futureware-tech/simulator-action@v1
with:
Expand Down
4 changes: 3 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"ios": "react-native run-ios",
"start": "react-native start",
"build:android": "cd android && ./gradlew assembleRelease --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
"build:ios": "cd ios && xcodebuild -workspace AgoraRtcNgExample.xcworkspace -scheme AgoraRtcNgExample -configuration Release -sdk iphoneos CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
"build:ios": "cd ios && xcodebuild -workspace AgoraRtcNgExample.xcworkspace -scheme AgoraRtcNgExample -configuration Release -sdk iphoneos CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
"detex:android": "detox build --configuration android.emu.release",
"detex:ios": "detox build --configuration ios.sim.release"
},
"dependencies": {
"@react-native-community/slider": "^4.4.2",
Expand Down

0 comments on commit bb67e55

Please sign in to comment.