-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (105 loc) · 4.43 KB
/
ci_android.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: ci-android
# Controls when the action will run.
on:
# Triggers the workflow on push & pull request events but only for the master branch.
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel.
jobs:
gradle_validation:
name: validate-gradle-wrapper
# The type of runner that the job will run on.
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
- name: checkout
uses: actions/checkout@v3
# Validates the checksums of Gradle Wrapper JAR files present in the source tree.
- name: validate-gradle-wrapper
uses: gradle/wrapper-validation-action@v1
generate_apk:
name: generate-apk
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Identifies "gradle_validation" jobs that must complete successfully before this job will run.
needs: gradle_validation
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
- name: checkout
uses: actions/checkout@v3
- name: generate-google-services-json
env:
FIREBASE_PROJECT_INFO: ${{ secrets.FIREBASE_PROJECT_INFO }}
run: echo "$FIREBASE_PROJECT_INFO" | base64 --decode >> app/google-services.json
- name: assemble-debug-apk
run: ./gradlew assembleDebug --full-stacktrace
# Allowing you to share data between jobs and store data.
- name: upload-debug-apk
uses: actions/upload-artifact@v3
with:
name: app-debug
path: app/build/outputs/apk/debug/app-debug.apk
- name: assemble-android-test-apk
run: ./gradlew assembleDebugAndroidTest --full-stacktrace
# Allowing you to share data between jobs and store data.
- name: upload-android-test-apk
uses: actions/upload-artifact@v3
with:
name: app-debug-androidTest
path: app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
unit_tests:
name: unit-tests
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Identifies "gradle_validation" jobs that must complete successfully before this job will run.
needs: gradle_validation
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
- name: checkout
uses: actions/checkout@v3
- name: generate-google-services-json
env:
FIREBASE_PROJECT_INFO: ${{ secrets.FIREBASE_PROJECT_INFO }}
run: echo "$FIREBASE_PROJECT_INFO" | base64 --decode >> app/google-services.json && cd app && ls
- name: run-unit-tests
run: ./gradlew test --full-stacktrace
Instrumented_unit_tests:
name: instrumented-unit-tests-with-firebase-test-lab
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
# Identifies "generate_apk" jobs that must complete successfully before this job will run.
needs: generate_apk
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
- name: checkout
uses: actions/checkout@v3
# This downloads artifacts from your build.
- name: download-apk
uses: actions/[email protected]
with:
name: app-debug
# This downloads artifacts from your build.
- name: download-android-test-apk
uses: actions/[email protected]
with:
name: app-debug-androidTest
# Establishes authentication to Google Cloud.
- name: set-up-auth
uses: google-github-actions/auth@v0
with:
workload_identity_provider: ${{ secrets.GCP_WIP }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT}}
# Configures the Google Cloud SDK.
- name: set-up-cloud-sdk
uses: google-github-actions/setup-gcloud@v0
- name: run-instrumented-unit-tests-in-firebase-test-lab
run: gcloud firebase test android run --type instrumentation --app app-debug.apk --test app-debug-androidTest.apk --device model=Pixel2,version=30