-
Notifications
You must be signed in to change notification settings - Fork 1
324 lines (283 loc) · 12.3 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
name: Build CLI interface
on:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.svg'
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.svg'
workflow_dispatch:
jobs:
buildOnMac:
runs-on: macos-latest
timeout-minutes: 20
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-buildOnMac
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ayltai/setup-graalvm@v1
with:
java-version: 11
graalvm-version: 22.2.0
native-image: true
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
echo "::set-output name=version::$VERSION"
echo "SPP_CLI_VERSION=$VERSION" >> $GITHUB_ENV
echo "SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}" >> $GITHUB_ENV
SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}
echo "::set-output name=release_version::$SPP_RELEASE_VERSION"
- name: Build native spp-cli (Release)
if: github.ref == 'refs/heads/master'
run: gradle assemble nativeImage -Dbuild.profile=release -PcliVersion=$SPP_RELEASE_VERSION
- name: Build native spp-cli (Snapshot)
if: github.ref != 'refs/heads/master'
run: gradle assemble nativeImage -Dbuild.profile=release
- name: "[CLI] Get version"
run: ./build/graal/spp-cli -v version
- name: Compress CLI
uses: svenstaro/upx-action@v2
with:
file: build/graal/spp-cli
- name: Zip CLI
run: zip spp-cli-macOS.zip -j build/graal/spp-cli
- uses: actions/upload-artifact@v3
with:
name: spp-cli-macOS.zip
path: ./spp-cli-macOS.zip
buildOnWindows:
runs-on: windows-2019
timeout-minutes: 20
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-buildOnWindows
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: microsoft/[email protected]
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- uses: ayltai/setup-graalvm@v1
with:
java-version: 11
graalvm-version: 22.2.0
native-image: true
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
echo "::set-output name=version::$VERSION"
echo "SPP_CLI_VERSION=$VERSION" >> $GITHUB_ENV
echo "SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}" >> $GITHUB_ENV
SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}
echo "::set-output name=release_version::$SPP_RELEASE_VERSION"
- name: Build native spp-cli.exe (Release)
if: github.ref == 'refs/heads/master'
run: ./gradlew assemble nativeImage '-Dbuild.profile=release' '-PcliVersion=$SPP_RELEASE_VERSION'
shell: powershell
- name: Build native spp-cli.exe (Snapshot)
if: github.ref != 'refs/heads/master'
run: ./gradlew assemble nativeImage '-Dbuild.profile=release'
shell: powershell
- name: "[CLI] Get version"
run: ./build/graal/spp-cli -v version
- name: Run UPX
uses: crazy-max/[email protected]
with:
version: latest
file: build/graal/spp-cli.exe
args: '-7'
- name: Zip CLI
run: Compress-Archive -LiteralPath build/graal/spp-cli.exe -DestinationPath spp-cli-win64.zip
shell: powershell
- uses: actions/upload-artifact@v3
with:
if-no-files-found: warn
name: spp-cli-win64.zip
path: ./spp-cli-win64.zip
buildOnLinux:
runs-on: ubuntu-latest
timeout-minutes: 20
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-buildOnLinux
cancel-in-progress: true
outputs:
version: ${{ steps.properties.outputs.version }}
release_version: ${{ steps.properties.outputs.release_version }}
steps:
- uses: actions/checkout@v4
- uses: ayltai/setup-graalvm@v1
with:
java-version: 11
graalvm-version: 22.2.0
native-image: true
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
echo "::set-output name=version::$VERSION"
echo "SPP_CLI_VERSION=$VERSION" >> $GITHUB_ENV
echo "SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}" >> $GITHUB_ENV
SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}
echo "::set-output name=release_version::$SPP_RELEASE_VERSION"
- name: Build native spp-cli (Release)
if: github.ref == 'refs/heads/master'
run: ./gradlew assembleUp nativeImage -Dbuild.profile=release -PcliVersion=$SPP_RELEASE_VERSION
- name: Build native spp-cli (Snapshot)
if: github.ref != 'refs/heads/master'
run: ./gradlew assembleUp nativeImage -Dbuild.profile=release
- name: Docker IPs
run: docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
- name: Set SPP_PLATFORM_HOST
run: SPP_PLATFORM_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=spp-platform")) && echo "SPP_PLATFORM_HOST=$SPP_PLATFORM_HOST" >> $GITHUB_ENV
- name: "[CLI] Get version"
run: ./build/graal/spp-cli -v version
- name: "[CLI] Get developers"
run: ./build/graal/spp-cli -v admin get-developers
- name: "[CLI] Add developer"
run: ./build/graal/spp-cli -v admin add-developer test
- name: "[CLI] Refresh authorization code"
run: ./build/graal/spp-cli -v admin refresh-authorization-code test
- name: "[CLI] Get roles"
run: ./build/graal/spp-cli -v admin get-roles
- name: "[CLI] Get role permissions"
run: ./build/graal/spp-cli -v admin get-role-permissions role_manager
- name: "[CLI] Add role"
run: ./build/graal/spp-cli -v admin add-role tester
- name: "[CLI] Add role permission"
run: ./build/graal/spp-cli -v admin add-role-permission tester ADD_DEVELOPER
- name: "[CLI] Add developer role"
run: ./build/graal/spp-cli -v admin add-developer-role test tester
- name: "[CLI] Get developer roles"
run: ./build/graal/spp-cli -v admin get-developer-roles test
- name: "[CLI] Get developer permissions"
run: ./build/graal/spp-cli -v admin get-developer-permissions test
- name: "[CLI] Add access permission"
run: ACCESS_PERMISSION_ID=$(./build/graal/spp-cli -v admin add-access-permission -l spp.example.webapp.model.User WHITE_LIST | grep -oP '(?<="id"\s:\s")[^"]*') && echo "ACCESS_PERMISSION_ID=$ACCESS_PERMISSION_ID" >> $GITHUB_ENV
- name: "[CLI] Add role access permission"
run: ./build/graal/spp-cli -v admin add-role-access-permission tester ${{ env.ACCESS_PERMISSION_ID }}
- name: "[CLI] Get access permissions"
run: ./build/graal/spp-cli -v admin get-access-permissions
- name: "[CLI] Get developer access permissions"
run: ./build/graal/spp-cli -v admin get-developer-access-permissions test
- name: "[CLI] Get role access permissions"
run: ./build/graal/spp-cli -v admin get-role-access-permissions tester
- name: "[CLI] Remove role access permission"
run: ./build/graal/spp-cli -v admin remove-role-access-permission tester ${{ env.ACCESS_PERMISSION_ID }}
- name: "[CLI] Remove access permission"
run: ./build/graal/spp-cli -v admin remove-access-permission ${{ env.ACCESS_PERMISSION_ID }}
- name: "[CLI] Remove developer role"
run: ./build/graal/spp-cli -v admin remove-developer-role test tester
- name: "[CLI] Remove role permission"
run: ./build/graal/spp-cli -v admin remove-role-permission tester ADD_DEVELOPER
- name: "[CLI] Remove role"
run: ./build/graal/spp-cli -v admin remove-role tester
- name: "[CLI] Remove developer"
run: ./build/graal/spp-cli -v admin remove-developer test
- name: "[CLI] Add live breakpoint"
run: ./build/graal/spp-cli -v add breakpoint -h 100 spp.example.webapp.model.User 48
- name: "[CLI] Add live log"
run: ./build/graal/spp-cli -v add log -h 100 spp.example.webapp.model.User 48 test-message
- name: "[CLI] Get live instruments"
run: ./build/graal/spp-cli -v get instruments
- name: "[CLI] Get live breakpoints"
run: ./build/graal/spp-cli -v get breakpoints
- name: "[CLI] Get live logs"
run: ./build/graal/spp-cli -v get logs
- name: "[CLI] Remove live instruments"
run: ./build/graal/spp-cli -v remove instruments spp.example.webapp.model.User 48
- name: Check CLI
run: ./gradlew check -Dtest.profile=integration
- name: Compress CLI
uses: svenstaro/upx-action@v2
with:
file: build/graal/spp-cli
- name: Zip spp-cli
run: zip spp-cli-linux64.zip -j build/graal/spp-cli
- uses: actions/upload-artifact@v3
with:
name: spp-cli-linux64.zip
path: ./spp-cli-linux64.zip
- run: ./gradlew composeLogs
if: ${{ !cancelled() }}
- name: Upload docker logs artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: docker-logs
path: ./build/containers-logs
releaseDraft:
name: Release Draft
needs: [ buildOnMac, buildOnWindows, buildOnLinux ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
| tr '\r\n' ' ' \
| jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' \
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
- name: Create Release Draft
id: createDraft
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.buildOnLinux.outputs.release_version }}
release_name: v${{ needs.buildOnLinux.outputs.release_version }}
body: ${{ needs.build.outputs.changelog }}
draft: true
- name: Download spp-cli-macOS artifact
uses: actions/download-artifact@v3
with:
name: spp-cli-macOS.zip
- name: Upload spp-cli-macOS asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createDraft.outputs.upload_url }}
asset_path: ./spp-cli-macOS.zip
asset_name: spp-cli-${{ needs.buildOnLinux.outputs.release_version }}-macOS.zip
asset_content_type: application/zip
- name: Download spp-cli-win64 artifact
uses: actions/download-artifact@v3
with:
name: spp-cli-win64.zip
- name: Upload spp-cli-win64 asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createDraft.outputs.upload_url }}
asset_path: ./spp-cli-win64.zip
asset_name: spp-cli-${{ needs.buildOnLinux.outputs.release_version }}-win64.zip
asset_content_type: application/zip
- name: Download spp-cli-linux64 artifact
uses: actions/download-artifact@v3
with:
name: spp-cli-linux64.zip
- name: Upload spp-cli-linux64 asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createDraft.outputs.upload_url }}
asset_path: ./spp-cli-linux64.zip
asset_name: spp-cli-${{ needs.buildOnLinux.outputs.release_version }}-linux64.zip
asset_content_type: application/zip