-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (172 loc) · 5.3 KB
/
workflow.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Build & Test & Release
on:
workflow_dispatch:
workflow_call:
push:
pull_request:
permissions:
checks: write
pull-requests: write
jobs:
init:
name: Init
runs-on: ubuntu-latest
outputs:
newRelease: ${{ steps.nyx.outputs.newRelease }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
- name: Cache build files
uses: actions/cache@v3
with:
path: '**/build/'
key: pipeline-${{ github.run_id }}-gradle-build-cache
- name: Init with Gradle
run: ./gradlew nyxInfer --stacktrace
- name: Load Nyx data
id: nyx
uses: mooltiverse/nyx-github-action@main
with:
command: infer
resume: true
- name: Archive Nyx state file
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: .nyx-state.json
path: build/.nyx-state.json
build:
name: Build & Unit tests
needs: init
runs-on: ubuntu-latest
env:
NYX_RESUME: true
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
- name: Cache build files
uses: actions/cache@v3
with:
path: '**/build/'
key: pipeline-${{ github.run_id }}-gradle-build-cache
fail-on-cache-miss: true
- name: Build
run: gradle -s :build
- name: Archive Jar
uses: actions/upload-artifact@v4
with:
name: jar
path: '**/build/libs/'
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: '**/build/test-results/*/TEST-*.xml'
check_name: "JUnit Test Report (Unit tests)"
fail_on_failure: true
test:
name: Integration tests
runs-on: ubuntu-latest
needs: build
env:
NYX_RESUME: true
strategy:
fail-fast: false
matrix:
gradle: [ '8.6', '8.5', '8.0.2', '7.0.2', '6.9.3', '6.8.3' ]
java: [ 8, 11, 17, 21 ]
exclude:
- { gradle: '8.0.2', java: 21 }
- { gradle: '7.0.2', java: 21 }
- { gradle: '7.0.2', java: 17 }
- { gradle: '6.9.3', java: 21 }
- { gradle: '6.9.3', java: 17 }
- { gradle: '6.8.3', java: 21 }
- { gradle: '6.8.3', java: 17 }
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
- name: Cache build files
uses: actions/cache@v3
with:
path: '**/build/'
key: pipeline-${{ github.run_id }}-gradle-build-cache
fail-on-cache-miss: true
- name: Check
run: gradle -s :test :integrationTest
env:
CURSED_PUBLISH_TEST_GRADLE_VERSION: "${{ matrix.gradle }}"
CURSED_PUBLISH_TEST_JAVA_VERSION: "${{ matrix.java }}"
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: '**/build/test-results/*/TEST-*.xml'
check_name: "JUnit Test Report (Integration tests, Gradle ${{ matrix.gradle }}, Java ${{ matrix.java }})"
fail_on_failure: true
release:
name: Publish & Release
needs: [ init, build, test ]
if: needs.init.outputs.newRelease == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
env:
NYX_RESUME: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
- name: Cache build files
uses: actions/cache@v3
with:
path: '**/build/'
key: pipeline-${{ github.run_id }}-gradle-build-cache
fail-on-cache-miss: true
- name: Publish
run: ./gradlew nyxMake nyxMark nyxPublish release --stacktrace -Pgradle.publish.key=${{ secrets.GRADLE_PLUGIN_PUBLISH_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_PLUGIN_PUBLISH_SECRET }}