-
Notifications
You must be signed in to change notification settings - Fork 296
76 lines (59 loc) · 2.06 KB
/
test_action.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
name: Test Action
env:
EMULATOR_REPO: us-docker.pkg.dev/android-emulator-268719/images/28-playstore-x64:30.1.2
JAVA_V: 11
JAVA_DIST: corretto
permissions:
checks: write
pull-requests: write
on:
push:
branches:
- master
- staging
pull_request:
branches:
- master
- staging
jobs:
setup:
runs-on: ubuntu-latest
name: Build and Test the SDK
steps:
- name: Install Docker to the Runner
run: sudo apt-get install docker
- name: Install Docker to the Runner
run: cd .github/workflows/emulator_setup && docker build --build-arg TARGET=google_apis_playstore --build-arg API_LEVEL=31 --build-arg BUILD_TOOLS=31.0.0 -t android-emulator .
- name: Pull Emulator from the Repo
run: docker pull ${{ env.EMULATOR_REPO }}
- name: Checkout SDK code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_V }}
distribution: ${{ env.JAVA_DIST }}
- name: Setup Android SDK
uses: android-actions/setup-android@v2.0.10
- name: Start ADB Server
run: adb start-server
- name: Run Android Emulator Container
run: docker run -it --privileged -d --publish 5555:5555/tcp --name androidContainer android-emulator
- name: Run emulator in headless mode
run: docker exec --privileged -it -e EMULATOR_TIMEOUT=300 androidContainer bash -c "./start_emu_headless.sh"
- name: Connect to the Emulator
run: adb connect localhost:5555
- name: Build the SDK
if: always()
run: ./gradlew sdk:build
- name: Run the Android Unit Tests
if: always()
run: ./gradlew sdk:connectedAndroidTest
- name: Publish Test Results to PR
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: "Unit Test Results :rocket:"
comment_title: "Unit Test Results :rocket:"
files: |
sdk/build/outputs/androidTest-results/**/*.xml