-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (151 loc) · 4.73 KB
/
master.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
148
149
150
151
name: CI
'on':
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
inputs:
runAndroidTests:
description: Run Android Tests
required: true
default: false
type: boolean
permissions:
contents: write
security-events: write
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '17'
- name: Create Google Services JSON
run: |
mkdir ${{ github.workspace }}/app/src/prod
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: java
- name: Build APK
uses: gradle/gradle-build-action@v2.11.1
with:
dependency-graph: generate-and-submit
arguments: ':app:assembleProdDebug'
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '17'
- name: Create Google Services JSON
run: |
mkdir ${{ github.workspace }}/app/src/prod
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json
- name: Lint
uses: gradle/gradle-build-action@v2.11.1
with:
arguments: lint
- name: Uploading lint results
uses: actions/upload-artifact@v4
with:
name: lint-reports
path: '**/lint-results-*.html'
detekt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '17'
- name: Create Google Services JSON
run: |
mkdir ${{ github.workspace }}/app/src/prod
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json
- name: Detekt
uses: gradle/gradle-build-action@v2.11.1
with:
arguments: detektProdDebug
- name: Uploading detekt results
uses: actions/upload-artifact@v4
with:
name: detekt-reports
path: '**/detekt.html'
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '17'
- name: Create Google Services JSON
run: |
mkdir ${{ github.workspace }}/app/src/prod
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json
- name: Unit test and coverage
uses: gradle/gradle-build-action@v2.11.1
with:
arguments: koverHtmlReport
- name: Uploading test results
uses: actions/upload-artifact@v4
with:
name: test-reports
path: '**/reports/tests/testProdDebugUnitTest/'
- name: Uploading test coverage
uses: actions/upload-artifact@v4
with:
name: test-coverage-report
path: '**/reports/coverage/'
android-test:
needs: build
if: '${{ inputs.runAndroidTests }}'
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3.2.0
- name: Create Google Services JSON
run: |
mkdir ${{ github.workspace }}/app/src/prod
echo $GOOGLE_SERVICES_JSON | base64 -d > ${{ github.workspace }}/app/src/prod/google-services.json
- name: Build AndroidTest app
uses: gradle/gradle-build-action@v2.11.1
with:
arguments: packageProdDebug
- name: Run Instrumented Tests on GMD
run: |
./gradlew cleanManagedDevices --unused-only
./gradlew pixel2api30ProdDebugAndroidTest -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
- name: Upload Android test reports
uses: actions/upload-artifact@v4
with:
name: android-test-reports
path: '**/build/reports/androidTests'