Skip to content

Commit 88afdd6

Browse files
committed
Add pre build shell for linux
1 parent c1520ce commit 88afdd6

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
- cron: "3 4 */15 * *" # 每两周的午夜触发一次
1717

1818
concurrency:
19-
group: build-${{ github.ref }}
19+
group: build
2020
cancel-in-progress: true
2121

2222

@@ -38,6 +38,12 @@ jobs:
3838
chmod +x gradlew
3939
./gradlew --version
4040
41+
- name: Pre-build shell for Linux
42+
if: runner.os == 'Linux' || runner.os == 'Ubuntu' || runner.os == 'CentOS'
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install --install-suggests -y musl musl-tools zlib1g-dev
46+
4147
- name: Pre-build shell for Windows
4248
if: runner.os == 'Windows'
4349
run: |
@@ -74,18 +80,17 @@ jobs:
7480
- name: Download artifacts
7581
uses: actions/download-artifact@v4
7682
with:
77-
name: native-image-${{ matrix.os }}-${{ matrix.architecture }}
7883
path: ./artifacts
7984

8085
- name: Create or Update Release
8186
id: create_release
8287
uses: softprops/action-gh-release@v1
8388
with:
84-
tag_name: ${{ github.ref }}
85-
name: Release ${{ github.ref }}
89+
tag_name: ${{ github.ref_name }}
90+
name: Release ${{ github.ref_name }}
8691
draft: false
8792
prerelease: false
88-
files: ./artifacts/native-image-${{ matrix.os }}-${{ matrix.architecture }}
8993
overwrite: true
94+
files: ./artifacts/**
9095
env:
9196
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ graalvmNative {
8585
imageName.set("SrunLogin")
8686
mainClass.set(application.mainClass.get())
8787
buildArgs.add("-O2")
88+
89+
// For linux only
90+
if (System.getProperty("os.name").lowercase().contains("linux")) {
91+
buildArgs.add("--static")
92+
buildArgs.add("--libc=musl")
93+
}
94+
8895
// buildArgs.add("--initialize-at-build-time")
8996
buildArgs.add("-H:+RemoveUnusedSymbols")
9097
// buildArgs.add("--initialize-at-run-time=jdk.internal.net.http.HttpClientFacade")

gradlew

100644100755
File mode changed.

0 commit comments

Comments
 (0)