-
-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (115 loc) · 4.33 KB
/
ci-build.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
name: "🔨 Build & Verify"
on:
workflow_call
jobs:
build:
name: "build"
timeout-minutes: 30
permissions:
# actions/checkout
contents: read
# EnricoMi/publish-unit-test-result-action -> https://github.com/EnricoMi/publish-unit-test-result-action#permissions
checks: write
# github/codeql-action/upload-sarif -> https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github
security-events: write
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: "Set up JDK 17."
uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
# Temporarily until Android SDK Platform-Tools updates post 34.0.4 in ubuntu-latest.
# https://github.com/actions/runner-images/blob/ubuntu22/20231016.1/images/linux/Ubuntu2204-Readme.md#android
- name: "Set up Android SDK"
uses: android-actions/setup-android@v3
with:
log-accepted-android-sdk-licenses: false
- name: "Checkout ${{ github.ref }} branch in ${{ github.repository }} repository."
uses: actions/checkout@v4
with:
submodules: true
- name: "Build project."
working-directory: .
run: >
./gradlew
--no-daemon
--stacktrace
--continue
--no-build-cache
assemble assembleDebugAndroidTest compileDebugUnitTestSources compileReleaseUnitTestSources
- name: "Verify project."
working-directory: .
run: >
./gradlew
--no-daemon
--stacktrace
--continue
build
violationCountFile
violationReportHtml
violationReportConsole
- name: "Upload 'Lint Results' artifact."
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: 'Lint Results'
if-no-files-found: error
path: |
${{ github.workspace }}/**/build/reports/lint-results*.html
${{ github.workspace }}/build/reports/violations.*
- name: "Fail if there are violations."
if: ${{ success() || failure() }}
run: |
count=$(cat "${GITHUB_WORKSPACE}/build/reports/violations.count")
if [[ "$count" != "0" ]]; then
echo "::error file=config/lint/lint.xml,title=Android Lint::There were $count violations, see 'Lint Results' artifact."
exit 1
else
echo "No violations found."
exit 0
fi
- name: "Upload 'Detekt Results' artifact."
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: 'Detekt Results'
if-no-files-found: error
path: |
${{ github.workspace }}/**/build/reports/detekt/detekt.*
- name: "Publish 'Code scanning results / detekt' GitHub Code Scanning analysis."
uses: github/codeql-action/upload-sarif@v3
if: ${{ success() || failure() }}
with:
sarif_file: ${{ github.workspace }}/gradle/plugins-inventory/build/reports/detekt/detekt.sarif
- name: "Upload 'Unit Test Results' artifact."
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: 'Unit Test Results'
if-no-files-found: error
path: ${{ github.workspace }}/**/build/reports/tests/*/
- name: "Publish 'Unit Results' check suite."
if: ${{ success() || failure() }}
uses: EnricoMi/publish-unit-test-result-action@v2
with:
check_name: '🔔 Test: Unit Results'
comment_mode: off
report_individual_runs: true
action_fail_on_inconclusive: true
test_changes_limit: 0
junit_files: ${{ github.workspace }}/**/build/test-results/*/TEST-*.xml
- name: "Upload 'APKs' artifact."
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: 'APKs'
if-no-files-found: error
path: |
${{ github.workspace }}/**/build/outputs/apk/
${{ github.workspace }}/**/build/outputs/mapping/
${{ github.workspace }}/**/build/outputs/logs/
${{ github.workspace }}/**/build/outputs/sdk-dependencies/