Build linux sample with musl

- Change sample build to use musl on linux
- Optionally remove version from jar so that
  e2e tests don't need to use version in path.
- Add better matrix to e2e so that we're able to
  build on one OS and then test with others.
- Fixes #576
This commit is contained in:
Janne Valkealahti
2022-11-30 15:39:10 +00:00
parent d3e897f6d9
commit 0899d414de
7 changed files with 92 additions and 26 deletions

View File

@@ -6,42 +6,40 @@ on:
- cron: '0 0 * * 1,3,5'
jobs:
e2e:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- nickname: win
os: windows-latest
os: windows-2022
graal: 22.3.0
musl: false
- nickname: macos
os: macos-latest
os: macos-12
graal: 22.3.0
musl: false
- nickname: linux
os: ubuntu-latest
os: ubuntu-22.04
graal: 22.3.0
name: E2E ${{ matrix.nickname }}
musl: true
name: Compile ${{ matrix.nickname }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 17
cache: gradle
- uses: graalvm/setup-graalvm@v1
with:
version: ${{ matrix.graal }}
java-version: 17
components: native-image
set-java-home: false
native-image-musl: ${{ matrix.musl }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v2
with:
node-version: '16'
- run: |
./gradlew clean build nativeCompile
- uses: actions/upload-artifact@v2
./gradlew clean build nativeCompile -PspringShellSampleMusl=${{ matrix.musl }} -PspringShellSampleE2E=true
- uses: actions/upload-artifact@v3
with:
name: spring-shell-samples-${{ matrix.nickname }}
retention-days: 1
@@ -49,11 +47,50 @@ jobs:
spring-shell-samples/build/libs/*.jar
spring-shell-samples/build/native/nativeCompile/spring-shell-samples
spring-shell-samples/build/native/nativeCompile/spring-shell-samples.exe
e2e:
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
nickname: win
# - os: windows-2019
# nickname: win
- os: macos-12
nickname: macos
- os: macos-11
nickname: macos
- os: ubuntu-22.04
nickname: linux
- os: ubuntu-20.04
nickname: linux
name: E2E ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 17
cache: gradle
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: compile e2e module
working-directory: e2e/spring-shell-e2e
run: |
npm install
npm run build
- uses: actions/download-artifact@v3
with:
name: spring-shell-samples-${{ matrix.nickname }}
path: spring-shell-samples/build
- name: fix artifacts
if: runner.os != 'Windows'
shell: bash
run: |
chmod +x spring-shell-samples/build/native/nativeCompile/spring-shell-samples
- name: run e2e tests
working-directory: e2e/spring-shell-e2e-tests
run: |

View File

@@ -13,12 +13,15 @@ jobs:
- nickname: win
os: windows-latest
graal: 22.3.0
musl: false
- nickname: macos
os: macos-latest
graal: 22.3.0
musl: false
- nickname: linux
os: ubuntu-latest
graal: 22.3.0
musl: true
name: Build ${{ matrix.nickname }}
steps:
- uses: actions/checkout@v2
@@ -27,21 +30,15 @@ jobs:
version: ${{ matrix.graal }}
java-version: 17
components: native-image
set-java-home: true
native-image-musl: ${{ matrix.musl }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: |
./mvnw clean package -Pnativex
./gradlew build nativeCompile -PspringShellSampleMusl=${{ matrix.musl }}
- uses: actions/upload-artifact@v2
with:
name: spring-shell-samples-${{ matrix.nickname }}
retention-days: 1
path: |
spring-shell-samples/target/*.jar
spring-shell-samples/target/spring-shell-samples
spring-shell-samples/target/spring-shell-samples.exe
- uses: actions/upload-artifact@v2
with:
name: surefire-reports-${{ matrix.nickname }}
retention-days: 1
path: |
*/target/surefire-reports/*
spring-shell-samples/build/libs/*.jar
spring-shell-samples/build/native/nativeCompile/spring-shell-samples
spring-shell-samples/build/native/nativeCompile/spring-shell-samples.exe

View File

@@ -7,8 +7,8 @@ export const cliPathRelative = isWindows
? '..\\..\\spring-shell-samples\\build\\native\\nativeCompile\\spring-shell-samples.exe'
: '../../spring-shell-samples/build/native/nativeCompile/spring-shell-samples';
export const jarPathRelative = isWindows
? '..\\..\\spring-shell-samples\\build\\libs\\spring-shell-samples-3.0.0-SNAPSHOT.jar'
: '../../spring-shell-samples/build/libs/spring-shell-samples-3.0.0-SNAPSHOT.jar';
? '..\\..\\spring-shell-samples\\build\\libs\\spring-shell-samples.jar'
: '../../spring-shell-samples/build/libs/spring-shell-samples.jar';
export const cliPath = path.resolve(cliPathRelative);
export const jarPath = path.resolve(jarPathRelative);
export const nativeDesc = 'native';

View File

@@ -13,10 +13,17 @@
"xterm-headless": "^4.18.0"
},
"devDependencies": {
"@types/node": "^18.11.9",
"prettier": "^2.6.2",
"typescript": "^4.6.4"
}
},
"node_modules/@types/node": {
"version": "18.11.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
"integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
"dev": true
},
"node_modules/nan": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
@@ -69,6 +76,12 @@
}
},
"dependencies": {
"@types/node": {
"version": "18.11.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
"integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
"dev": true
},
"nan": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",

View File

@@ -31,6 +31,7 @@
},
"homepage": "https://github.com/spring-projects/spring-shell#readme",
"devDependencies": {
"@types/node": "^18.11.9",
"prettier": "^2.6.2",
"typescript": "^4.6.4"
},

View File

@@ -1,4 +1,5 @@
import * as pty from 'node-pty';
import * as os from 'os';
import { Terminal } from 'xterm-headless';
export interface CliOptions {
@@ -32,7 +33,10 @@ export class Cli {
}
public run(): void {
const isWindows = (os.platform() === 'win32')
this.term = new Terminal({
allowProposedApi: true,
windowsMode: isWindows,
cols: this.cols,
rows: this.rows
});

View File

@@ -18,8 +18,22 @@ springBoot {
buildInfo()
}
if (project.hasProperty('springShellSampleE2E') && springShellSampleE2E.toBoolean()) {
bootJar {
archiveName = "$baseName.$extension"
}
}
graalvmNative {
metadataRepository {
enabled = true
}
binaries {
main {
if (project.hasProperty('springShellSampleMusl') && springShellSampleMusl.toBoolean()) {
buildArgs.add('--static')
buildArgs.add('--libc=musl')
}
}
}
}