-
Notifications
You must be signed in to change notification settings - Fork 0
249 lines (223 loc) · 7.98 KB
/
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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: Build
on:
push:
branches:
- main
tags:
- '*'
paths-ignore:
- LICENSE
- '*.md'
- 'docs/**'
- '.github/config/labels.yml'
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
issues: write
packages: write
repository-projects: write
env:
releaseBuild: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
jobs:
build:
name: 🏗️ Gradle Build
permissions:
contents: write
packages: write
discussions: write
strategy:
fail-fast: true
max-parallel: 3
matrix:
os: [ ubuntu-latest, macos-latest ]
jdk: [ ea ]
include:
- os: macos-latest
native_task: :macosArm64Test
- os: ubuntu-latest
native_task: :linuxX64Test
runs-on: ${{ matrix.os }}
continue-on-error: false
outputs:
name: ${{ steps.gradle-build.outputs.name }}
group: ${{ steps.gradle-build.outputs.group }}
version: ${{ steps.gradle-build.outputs.version }}
steps:
- name: 🛎️ Check out the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ⬇️ Download OpenJDK ${{ matrix.jdk }} latest build from ☁️jdk.java.net
id: download-jdk
uses: oracle-actions/setup-java@main
with:
website: jdk.java.net
release: ${{ matrix.jdk }}
version: latest
install: false
- name: ☕ Set up OpenJDK ${{ matrix.jdk }}
id: setup-java
uses: actions/setup-java@v4
if: always() && steps.download-jdk.outcome == 'success'
with:
distribution: jdkfile
java-version: ${{ steps.download-jdk.outputs.version }}
jdkFile: ${{ steps.download-jdk.outputs.archive }}
# cache: 'gradle'
- name: 🐘 Setup Gradle
if: ${{ false }}
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
- name: 🚄 Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: 🏗️ Gradle Build & Run
id: gradle-build
run: |
MKTEMP_PATH="$(dirname "$(mktemp -u)")/"
echo "MKTEMP_PATH=$MKTEMP_PATH" >> $GITHUB_ENV
./gradlew buildAndPublish --no-daemon
# echo "dist_path=backend/jvm/build/libs/jvm-all.jar" >> "$GITHUB_OUTPUT"
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SECRET_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_githubActor: ${{ github.repository_owner }}
ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUB_TOKEN }}
# JOB_CONTEXT: ${{ toJSON(job) }}
# STEPS_CONTEXT: ${{ toJSON(steps) }}
# RUNNER_CONTEXT: ${{ toJSON(runner) }}
# GITHUB_CONTEXT: ${{ toJSON(github) }}
# STRATEGY_CONTEXT: ${{ toJSON(strategy) }}
# MATRIX_CONTEXT: ${{ toJSON(matrix) }}
- name: 📤 Uploading ${{ matrix.os }} build artifacts
if: steps.gradle-build.outcome == 'success' && runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.gradle-build.outputs.artifact_name }}
path: |
backend/jvm/build/libs/jvm-app
if-no-files-found: error
- name: 🕸 Deploy Wasm & Js webapp to Github Pages
if: steps.gradle-build.outcome == 'success' && runner.os == 'Linux'
uses: JamesIves/github-pages-deploy-action@v4.6.0
with:
branch: gh-pages
folder: backend/jvm/build/resources/main/app
target-folder: app
clean: true
commit-message: 'web: Deployed web app'
- name: 🏖️ Publish documentation to Github Pages
if: steps.gradle-build.outcome == 'success' && runner.os == 'Linux'
uses: JamesIves/github-pages-deploy-action@v4.6.0
with:
branch: gh-pages
folder: build/dokka/htmlMultiModule
target-folder: docs
clean: true
commit-message: 'doc: Deployed dokka html documentation'
- name: 🏖️ Publish coverage report to Github Pages
if: steps.gradle-build.outcome == 'success' && runner.os == 'Linux'
uses: JamesIves/github-pages-deploy-action@v4.6.0
with:
branch: gh-pages
folder: build/reports/kover/html
target-folder: reports
clean: true
commit-message: 'report: Deployed coverage report'
- name: 🧪️ Publish test report to Github Pages
if: steps.gradle-build.outcome == 'success' && runner.os == 'Linux'
uses: JamesIves/github-pages-deploy-action@v4.6.0
with:
branch: gh-pages
folder: build/reports/tests/test
target-folder: tests
clean: true
commit-message: 'report: Deployed test results'
- name: 📌 Push the changes to Github
if: ${{ false }}
id: push-to-github
run: |
# date > generated.txt
git diff
git config user.name github-actions
git config user.email github-actions@github.com
git add .
# git commit -m "doc: Update generated.txt" || exit 0
if [ -z "$(git status --porcelain)" ]; then
echo 'No changes detected.'
exit 0
else
git commit --message "doc: Update generated.txt"
git push
# git push origin HEAD:${{ github.event.repository.default_branch }}
fi
- name: 💥 Uploading JVM error logs
if: steps.gradle-build.outcome == 'failure' && always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-jvm-error-logs
path: |
hs_err*
${{ github.workspace }}/hs_err*
${{ env.MKTEMP_PATH }}/*hs-err*
if-no-files-found: warn
retention-days: 30
# GitHub Release Action on tag push
release:
name: 🚰 Release new version.
needs: [ build ]
if: startsWith(github.ref, 'refs/tags/') && needs.build.result == 'success'
runs-on: ubuntu-latest
steps:
- name: 🛎️Check out the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: ⚙️Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v4
with:
configuration: ".github/config/configuration.json"
commitMode: true
ignorePreReleases: ${{ !contains(github.ref, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: ⏬Download all the build artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
- name: ✨Github Release (version = ${{ needs.build.outputs.version }})
uses: softprops/action-gh-release@v2
with:
# body_path: ${{ github.workspace }}-CHANGELOG.txt
body: ${{ steps.github_release.outputs.changelog }}
files: |
${{ github.workspace }}/release-artifacts/**
generate_release_notes: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}