-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (118 loc) · 4.32 KB
/
run_gradle_task.yml
File metadata and controls
140 lines (118 loc) · 4.32 KB
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
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
env:
REPOSILITE_DIR: .cache/reposilite
steps:
### Gradle task ###
- name: Restore Reposilite cache
uses: actions/cache@v4
with:
path: ${{ env.REPOSILITE_DIR }}
key: ${{ runner.os }}-reposilite
#region Cache Konan
# (Argh does not use KMP directly, but KMP projects are used in integration tests.)
- name: "Set KONAN_DATA_DIR (Windows)"
if: runner.os == 'Windows'
shell: cmd
run: |
echo KONAN_DATA_DIR=C:\Users\runneradmin\.konan>>%GITHUB_ENV%
- name: "Set KONAN_DATA_DIR (bash)"
if: runner.os != 'Windows'
run: |
echo "KONAN_DATA_DIR=${HOME}/.konan" >> $GITHUB_ENV
- name: Restore Konan cache
uses: actions/cache@v4
with:
path: ${{ env.KONAN_DATA_DIR }}
key: ${{ runner.os }}-konan
#endregion
- 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 JDKs
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: |
11
17
21
- 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 }}
"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@v5
if: always()
with:
report_paths: |
**/build/test-results/**/TEST-*.xml
require_tests: false