-
-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (103 loc) · 4.07 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
name: "🔨 Build & Verify"
on:
workflow_call
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: "Set up JDK 17."
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: "Set up Android SDK."
uses: android-actions/setup-android@v2
- name: "Set up Android SDK components."
run: |
# The following are already done by setup-android@v2 action:
# sdkmanager --install "cmdline-tools;latest"
# sdkmanager --install "tools"
# sdkmanager --install "platform-tools"
# Install Android API used to build the project.
echo sdkmanager --install "platforms;android-34"
sdkmanager --install "platforms;android-34"
- name: "Checkout ${{ github.ref }} branch in ${{ github.repository }} repository."
uses: actions/checkout@v4
- name: "Register problem matchers."
run: echo "::add-matcher::.github/problemMatchers.json"
- name: "Build & Verify project using Gradle."
id: gradle
run: >
./gradlew
--no-daemon
--no-build-cache
--stacktrace
--continue
--scan
assemble
check
detekt
detektMain
detektTest
detektReportMergeSarif
detektReportMergeXml
lintReportMergeSarif
violationReportHtml
- name: "Publish 'Gradle' commit status (with Build Scan URL)."
if: (success() || failure()) && steps.gradle != null && steps.gradle.outputs.result-success != null
uses: actions/github-script@v6
with:
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: ${{ toJSON(fromJSON(steps.gradle.outputs.result-success)) }} === true ? "success" : "failure",
context: "CI / Build & Verify / Gradle",
description: ${{ toJSON(fromJSON(steps.gradle.outputs.result-text)) }},
target_url: ${{ toJSON(fromJSON(steps.gradle.outputs.build-scan-url)) }}
});
- name: "Upload 'Lint Results' artifact."
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: Lint Results
path: |
${{ github.workspace }}/**/build/reports/lint-results*.*
${{ github.workspace }}/build/reports/lint/merge-*.*
${{ github.workspace }}/build/reports/violations.*
- name: "Publish 'Android Lint' GitHub Code Scanning analysis."
uses: github/codeql-action/upload-sarif@v2
if: success() || failure()
with:
# merge-debug.sarif and merge-release.sarif in the folder.
sarif_file: ${{ github.workspace }}/build/reports/lint/
- name: "Upload 'Unit Test Results' artifact."
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: 'Unit Test Results'
path: ${{ github.workspace }}/**/build/reports/tests/*/
- name: "Publish '🔔 Test: 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
test_changes_limit: 0
junit_files: ${{ github.workspace }}/**/build/test-results/*/TEST-*.xml
- name: "Upload 'Detekt Results' artifact."
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: 'Detekt Results'
path: |
${{ github.workspace }}/**/build/reports/detekt/detekt.*
${{ github.workspace }}/build/reports/detekt/merge.*
- name: "Publish 'detekt' GitHub Code Scanning analysis."
uses: github/codeql-action/upload-sarif@v2
if: success() || failure()
with:
sarif_file: ${{ github.workspace }}/build/reports/detekt/merge.sarif