-
Notifications
You must be signed in to change notification settings - Fork 8
124 lines (102 loc) · 3.98 KB
/
run_gradle_task.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
name: Gradle Task
run-name: "Gradle Task ${{ inputs.gradle-task }} @ ${{ inputs.runs-on }}"
# Reusable Workflow for running a Gradle task
on:
workflow_dispatch:
inputs:
gradle-task:
description: "The Gradle task to run, including any flags"
required: true
type: string
runs-on:
description: "OS to run the task on"
required: true
type: string
checkout-ref:
description: "The branch, tag or SHA to checkout. See actions/checkout 'ref'."
required: false
type: string
workflow_call:
inputs:
gradle-task:
description: "The Gradle task to run, including any flags"
required: true
type: string
runs-on:
description: "OS to run the task on"
required: true
type: string
checkout-ref:
description: "The branch, tag or SHA to checkout. See actions/checkout 'ref'."
required: false
type: string
concurrency:
# note: the Workflow inputs are also included in the concurrency group
group: "Gradle Task: ${{ github.workflow }} ${{ join(inputs.*) }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
permissions:
contents: read
checks: write # required by mikepenz/action-junit-report
jobs:
run-task:
runs-on: ${{ inputs.runs-on }}
name: "./gradlew ${{ inputs.gradle-task}} @ ${{ inputs.runs-on }}"
timeout-minutes: 60
steps:
### Gradle task ###
- name: Checkout the repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout-ref || github.ref }}
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Setup JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Android SDK # required for integration tests
uses: android-actions/setup-android@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-cleanup: always
# write build cache on 'main' and 'release' branches, or tags (default is 'main' only)
cache-read-only: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release') && !startsWith(github.ref, 'refs/tags/') }}
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- run: >-
./gradlew ${{ inputs.gradle-task }}
env:
MAVEN_SONATYPE_USERNAME: ${{ secrets.MAVEN_SONATYPE_USERNAME }}
MAVEN_SONATYPE_PASSWORD: ${{ secrets.MAVEN_SONATYPE_PASSWORD }}
MAVEN_SONATYPE_SIGNING_KEY_ID: ${{ secrets.MAVEN_SONATYPE_SIGNING_KEY_ID }}
MAVEN_SONATYPE_SIGNING_KEY: ${{ secrets.MAVEN_SONATYPE_SIGNING_KEY }}
MAVEN_SONATYPE_SIGNING_PASSWORD: ${{ secrets.MAVEN_SONATYPE_SIGNING_PASSWORD }}
MAVEN_JB_SPACE_USERNAME: ${{ secrets.MAVEN_JB_SPACE_USERNAME }}
MAVEN_JB_SPACE_PASSWORD: ${{ secrets.MAVEN_JB_SPACE_PASSWORD }}
MAVEN_ADAMKO_DEV_USERNAME: ${{ vars.MAVEN_ADAMKO_DEV_USERNAME }}
MAVEN_ADAMKO_DEV_PASSWORD: ${{ secrets.MAVEN_ADAMKO_DEV_PASSWORD }}
"ORG_GRADLE_PROJECT_gradle.publish.key": ${{ secrets.GRADLE_PLUGIN_PORTAL_KEY }}
"ORG_GRADLE_PROJECT_gradle.publish.secret": ${{ secrets.GRADLE_PLUGIN_PORTAL_SECRET }}
- name: Upload build reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-report-${{ runner.os }}${{ github.action }}
path: |
**/build/reports/
**/*.hprof
**/*.log
if-no-files-found: ignore
- name: Publish Test Reports
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: |
**/build/test-results/**/TEST-*.xml
require_tests: false