Skip to content

Commit 0517722

Browse files
authored
Merge pull request #13 from sourceplusplus/win
Update build.yml
2 parents 0642156 + e543ac6 commit 0517722

File tree

5 files changed

+85
-61
lines changed

5 files changed

+85
-61
lines changed

.github/workflows/build.yml

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v2
22+
- uses: ayltai/setup-graalvm@v1
23+
with:
24+
java-version: 11
25+
graalvm-version: 21.3.0
26+
native-image: true
2227

2328
- name: Build native spp-cli
2429
run: gradle assemble nativeImage -Dbuild.profile=release
@@ -36,29 +41,37 @@ jobs:
3641
name: spp-cli-macOS.zip
3742
path: ./spp-cli-macOS.zip
3843

39-
# buildOnWindows:
40-
# runs-on: windows-2016
41-
42-
# steps:
43-
# - uses: actions/checkout@v2
44-
# - uses: microsoft/setup-msbuild@v1.0.2
45-
# - uses: seanmiddleditch/gha-setup-vsdevenv@master
46-
47-
# - name: Build native spp-cli.exe
48-
# run: ./gradlew assemble nativeImage --debug --info --stacktrace
49-
# shell: powershell
50-
# - run: ls build/graal
51-
# # - name: Run UPX
52-
# # uses: crazy-max/ghaction-upx@v1.3.3
53-
# # with:
54-
# # version: latest
55-
# # file: target/demo-cli.exe
56-
# # args: '-7'
57-
# - uses: actions/upload-artifact@v2
58-
# with:
59-
# if-no-files-found: warn
60-
# name: spp-cli.exe
61-
# path: build/graal/spp-cli.exe
44+
buildOnWindows:
45+
runs-on: windows-2019
46+
47+
steps:
48+
- uses: actions/checkout@v2
49+
- uses: microsoft/setup-msbuild@v1.0.2
50+
- uses: seanmiddleditch/gha-setup-vsdevenv@master
51+
- uses: ayltai/setup-graalvm@v1
52+
with:
53+
java-version: 11
54+
graalvm-version: 21.3.0
55+
native-image: true
56+
57+
- name: Build native spp-cli.exe
58+
run: ./gradlew assemble nativeImage '-Dbuild.profile=release'
59+
shell: powershell
60+
- name: Run UPX
61+
uses: crazy-max/ghaction-upx@v1.3.3
62+
with:
63+
version: latest
64+
file: build/graal/spp-cli.exe
65+
args: '-7'
66+
67+
- name: Zip CLI
68+
run: jar -cfM spp-cli-win64.zip build/graal/
69+
70+
- uses: actions/upload-artifact@v2
71+
with:
72+
if-no-files-found: warn
73+
name: spp-cli-win64.zip
74+
path: ./spp-cli-win64.zip
6275

6376
buildOnLinux:
6477
runs-on: ubuntu-latest
@@ -68,12 +81,11 @@ jobs:
6881
version: ${{ steps.properties.outputs.version }}
6982
steps:
7083
- uses: actions/checkout@v2
71-
- name: Set up JDK 11
72-
uses: actions/setup-java@v2
84+
- uses: ayltai/setup-graalvm@v1
7385
with:
74-
java-version: '11'
75-
distribution: 'adopt'
76-
cache: gradle
86+
java-version: 11
87+
graalvm-version: 21.3.0
88+
native-image: true
7789

7890
- name: Export Properties
7991
id: properties
@@ -90,14 +102,6 @@ jobs:
90102
run: docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
91103
- name: Set SPP_PLATFORM_HOST
92104
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
93-
- run: sleep 30s
94-
95-
- run: ./gradlew test -Dtest.profile=integration
96-
97-
- name: Compress CLI
98-
uses: svenstaro/upx-action@v2
99-
with:
100-
file: build/graal/spp-cli
101105

102106
- name: "[CLI] Get developers"
103107
run: ./build/graal/spp-cli -v admin get-developers
@@ -153,6 +157,15 @@ jobs:
153157
run: ./build/graal/spp-cli -v get-logs
154158
- name: "[CLI] Remove live instruments"
155159
run: ./build/graal/spp-cli -v remove-instruments spp.example.webapp.model.User 48
160+
- name: "[CLI] Reset"
161+
run: ./build/graal/spp-cli -v admin reset
162+
163+
- run: ./gradlew test -Dtest.profile=integration
164+
165+
- name: Compress CLI
166+
uses: svenstaro/upx-action@v2
167+
with:
168+
file: build/graal/spp-cli
156169

157170
- name: Zip spp-cli
158171
run: zip spp-cli-linux64.zip -j build/graal/spp-cli
@@ -161,10 +174,10 @@ jobs:
161174
with:
162175
name: spp-cli-linux64.zip
163176
path: ./spp-cli-linux64.zip
164-
177+
165178
releaseDraft:
166179
name: Release Draft
167-
needs: [buildOnMac, buildOnLinux]
180+
needs: [ buildOnMac, buildOnWindows, buildOnLinux ]
168181
runs-on: ubuntu-latest
169182
if: github.ref == 'refs/heads/master'
170183
steps:
@@ -205,6 +218,21 @@ jobs:
205218
asset_name: spp-cli-${{ needs.buildOnLinux.outputs.version }}-macOS.zip
206219
asset_content_type: application/zip
207220

221+
- name: Download spp-cli-win64 artifact
222+
uses: actions/download-artifact@v2
223+
with:
224+
name: spp-cli-win64.zip
225+
226+
- name: Upload spp-cli-win64 asset
227+
uses: actions/upload-release-asset@v1
228+
env:
229+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
230+
with:
231+
upload_url: ${{ steps.createDraft.outputs.upload_url }}
232+
asset_path: ./spp-cli-win64.zip
233+
asset_name: spp-cli-${{ needs.buildOnWindows.outputs.version }}-win64.zip
234+
asset_content_type: application/zip
235+
208236
- name: Download spp-cli-linux64 artifact
209237
uses: actions/download-artifact@v2
210238
with:

build.gradle.kts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import java.util.*
22

33
plugins {
4+
id("org.mikeneck.graalvm-native-image")
45
id("com.github.johnrengelman.shadow")
5-
id("com.palantir.graal")
66
id("com.apollographql.apollo3")
77
id("com.avast.gradle.docker-compose")
88
kotlin("jvm")
@@ -79,15 +79,21 @@ tasks.create("createProperties") {
7979
}
8080
tasks["processResources"].dependsOn("createProperties")
8181

82-
graal {
83-
graalVersion(project.properties["graalVersion"] as String)
84-
javaVersion("11")
85-
mainClass("spp.cli.Main")
86-
outputName("spp-cli")
87-
option("-H:+PrintClassInitialization")
88-
option("-H:+ReportExceptionStackTraces")
89-
option("-H:IncludeResourceBundles=build")
90-
option("-H:+AddAllCharsets")
82+
configurations {
83+
create("empty")
84+
}
85+
86+
nativeImage {
87+
dependsOn("shadowJar")
88+
setClasspath(File(project.buildDir, "libs/spp-cli-$version.jar"))
89+
runtimeClasspath = configurations.getByName("empty")
90+
graalVmHome = System.getenv("GRAALVM_HOME")
91+
buildType { build ->
92+
build.executable(main = "spp.cli.Main")
93+
}
94+
executableName = "spp-cli"
95+
outputDirectory = file("$buildDir/graal")
96+
arguments("--no-fallback")
9197
}
9298

9399
tasks.getByName<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {

e2e/config/spp-platform.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ spp-platform:
1111
processor:
1212
bridge_port: 5460
1313

14-
redis:
15-
host: localhost
16-
port: 6379
14+
storage:
15+
selector: memory
1716

1817
skywalking-oap:
1918
host: localhost

e2e/docker-compose.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,8 @@ services:
1010
- "5445:5445"
1111
- "5450:5450"
1212
- "5455:5455"
13-
depends_on:
14-
- redis
15-
links:
16-
- redis
1713
environment:
1814
- SPP_CLUSTER_URL=localhost
1915
- SPP_CLUSTER_NAME=docker
20-
- SPP_REDIS_HOST=redis
2116
- SPP_SKYWALKING_HOST=skywalking-oap
2217
- SPP_DISABLE_JWT=true
23-
redis:
24-
image: redis:6.2.1
25-
container_name: redis
26-
hostname: redis

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ pluginManagement {
1010
id 'com.avast.gradle.docker-compose' version "0.14.11" apply false
1111
id 'io.gitlab.arturbosch.detekt' version "1.19.0" apply false
1212
id 'com.github.johnrengelman.shadow' version "7.1.2"
13-
id 'com.palantir.graal' version "0.10.0"
1413
id 'com.apollographql.apollo3' version "3.0.0"
14+
id 'org.mikeneck.graalvm-native-image' version "v1.4.0"
1515
}
1616
}
1717

0 commit comments

Comments
 (0)