-
Notifications
You must be signed in to change notification settings - Fork 25
90 lines (72 loc) · 3.25 KB
/
integration_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Integration Tests
on:
pull_request:
branches:
- master
jobs:
test-android:
name: Android Integration Tests
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch
# clone the repo to workspace
- name: Check out Git repository
uses: actions/checkout@v2
- 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 --silent 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
# setup JDK environment
- name: Set up our JDK environment
uses: actions/setup-java@v3
with:
distribution: temurin
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('TestApp/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Bundle JS for Android
run: mkdir TestApp/android/app/src/main/assets && yarn TestApp bundle:android
- name: Build TestApp for Android
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
## make gradlew executable in ci
- name: Make Gradlew Executable
run: cd integration-tests && chmod +x ./gradlew
- name: Upload Android Test App for Integration Tests
env:
BROWSERSTACK_USER: ${{ secrets.BROWSERSTACK_USER }}
BROWSERSTACK_PASSWORD: ${{ secrets.BROWSERSTACK_PASSWORD }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
run: curl -u $BROWSERSTACK_USER:$BROWSERSTACK_PASSWORD -X POST https://api-cloud.browserstack.com/app-automate/upload -F file=@TestApp/android/app/build/outputs/apk/debug/app-debug.apk -F "data={\"custom_id\":\"INAPP_RN_SDK_ANDROID_TEST_APP\"}"
- name: Run Android Integration Tests
env:
BROWSERSTACK_USER: ${{ secrets.BROWSERSTACK_USER }}
BROWSERSTACK_PASSWORD: ${{ secrets.BROWSERSTACK_PASSWORD }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
run: ./integration-tests/gradlew -p integration-tests :test --tests TestSuite -Dbrowserstack.username="$BROWSERSTACK_USER" -Dbrowserstack.password="$BROWSERSTACK_PASSWORD" -Dbuild.name="$BRANCH_NAME@$GITHUB_SHA" -Dbuild.platform="Android"