Skip to content

Commit

Permalink
release:release for 0.1.0
Browse files Browse the repository at this point in the history
Signed-off-by: grapebaba <[email protected]>
  • Loading branch information
GrapeBaBa committed Jun 17, 2023
1 parent 844827d commit 0e51ba3
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 20 deletions.
78 changes: 59 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,26 @@ env:

jobs:
native-build:
name: GraalVM CE latest ${{ matrix.java-version }} on ${{ matrix.os }}
name: GraalVM latest ${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 3
matrix:
version: [ '20.0.1' ]
java-version: [ '20.0.1' ]
os: [ macos-latest, windows-latest, ubuntu-latest ]
os: [ macos-latest, windows-latest ]

outputs:
version: ${{ steps.native-build.outputs.version }}
native_image_name: ${{ steps.native-build.outputs.native_image_name }}
version: ${{ github.ref_name }}

steps:
- name: 🛎️ Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ☕ Setup GraalVM CE Dev Build
- name: ☕ Setup GraalVM Build
uses: graalvm/setup-graalvm@v1
with:
version: ${{ matrix.version }}
Expand All @@ -53,37 +52,78 @@ jobs:
distribution: 'graalvm'
cache: 'gradle'
set-java-home: 'true'
native-image-job-reports: 'false'
native-image-job-reports: 'true'

- name: 🏗️ Native Image Build & Test
id: native-build
run: |
./gradlew nativeCompile
ls -ltrh hildr-node/build/${{ github.event.repository.name }}*.tar.gz
ls -ltrh hildr-node/build/native/nativeCompile/hildr-node
- name: 📤 Upload ${{ matrix.os }} native image
uses: actions/upload-artifact@v3
with:
name: ${{ steps.native-build.outputs.native_image_name }}
name: hildr-node-${{ matrix.os }}
path: |
hildr-node/build/${{ steps.native-build.outputs.native_image_name }}
hildr-node/build/native/nativeCompile/hildr-node
if-no-files-found: error

native-build-linux:
name: GraalVM latest ${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 3
matrix:
version: [ '20.0.1' ]
java-version: [ '20.0.1' ]
os: [ ubuntu-latest ]

outputs:
version: ${{ github.ref_name }}

steps:
- name: 🛎️ Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ☕ Setup GraalVM Build
uses: graalvm/setup-graalvm@v1
with:
version: ${{ matrix.version }}
java-version: ${{ matrix.java-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
distribution: 'graalvm'
cache: 'gradle'
set-java-home: 'true'
native-image-job-reports: 'true'

- name: 🏗️ Native Image Build & Test
id: native-build
run: |
./gradlew buildBinary
ls -ltrh hildr-node/build/binary/hildr-node
- name: 📤 Upload ${{ matrix.os }} native image
uses: actions/upload-artifact@v3
with:
name: hildr-node-${{ matrix.os }}
path: |
hildr-node/build/binary/hildr-node
if-no-files-found: error

native-build-musl:
name: GraalVM CE Dev + musl static image
name: GraalVM + musl static image
runs-on: ubuntu-latest

outputs:
native_image_name: ${{ steps.native-build.outputs.native_image_name }}

steps:
- name: 🛎️ Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ☕ Setup GraalVM CE Dev Build
- name: ☕ Setup GraalVM Build
uses: graalvm/setup-graalvm@v1
with:
version: '20.0.1'
Expand All @@ -98,20 +138,20 @@ jobs:
- name: 🏗️ Build static image with musl libc
id: native-build
run: |
./gradlew nativeCompile -Pmusl
ls -ltrh hildr-node/build/native/nativeCompile/hildr-node
./gradlew buildBinaryStatic
ls -ltrh hildr-node/build/binary/hildr-node
- name: 📤 Upload static binary
uses: actions/upload-artifact@v3
with:
name: ${{ steps.native-build.outputs.native_image_name }}
name: hildr-node
path: |
hildr-node/build/native/nativeCompile/hildr-node
hildr-node/build/binary/hildr-node
if-no-files-found: error

release:
name: 🚰 Release new version.
needs: [ native-build, native-build-musl ]
needs: [ native-build, native-build-musl, native-build-linux ]
if: startsWith(github.ref, 'refs/tags/') && needs.native-build.result == 'success'
runs-on: ubuntu-latest

Expand Down
47 changes: 46 additions & 1 deletion hildr-node/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,53 @@ jar {
}
}


task buildBinary {
dependsOn jar
def buildBinaryDir = "build/binary"
def out = new ByteArrayOutputStream()
doFirst {
new File(buildBinaryDir).mkdirs()
copy {
from "build/libs/${project.name}-${project.version}.jar"
into buildBinaryDir
rename "${project.name}-${project.version}.jar", "${project.name}.jar"
}
}
doLast {
exec {
workingDir buildBinaryDir
executable "sh"
args "-c", "native-image -jar ${project.name}.jar --no-fallback --enable-http --enable-https --enable-preview --add-modules jdk.incubator.concurrent -H:EnableURLProtocols=http,https --initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback.core.CoreConstants,ch.qos.logback.core.util.Loader,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.core.status.InfoStatus,ch.qos.logback.classic.Logger,ch.qos.logback.core.rolling.helper.FileNamePattern,ch.qos.logback.classic.Level,ch.qos.logback.core.status.StatusBase,io.opentelemetry.api.trace.ArrayBasedTraceStateBuilder,io.opentelemetry.context.LazyStorage,ch.qos.logback.core.util.FileSize,ch.qos.logback.core.rolling.helper.RollingCalendar,io.opentelemetry.api.internal.ImmutableSpanContext,io.opentelemetry.api.internal.OtelEncodingUtils,ch.qos.logback.classic.PatternLayout,io.opentelemetry.context.ThreadLocalContextStorage,io.opentelemetry.api.trace.PropagatedSpan,io.opentelemetry.context.ContextStorageWrappers,ch.qos.logback.core.rolling.helper.Compressor\$1,io.opentelemetry.api.trace.ImmutableTraceFlags,ch.qos.logback.core.rolling.helper.RollingCalendar\$1,ch.qos.logback.classic.model.ConfigurationModel,ch.qos.logback.core.model.processor.DefaultProcessor\$1,ch.qos.logback.core.model.processor.ImplicitModelHandler\$1,ch.qos.logback.core.subst.Token,ch.qos.logback.core.pattern.parser.Parser,ch.qos.logback.core.subst.Parser\$1,ch.qos.logback.core.util.Duration,ch.qos.logback.core.model.processor.ChainedModelFilter\$1,ch.qos.logback.classic.model.processor.ConfigurationModelHandler,ch.qos.logback.classic.model.processor.LogbackClassicDefaultNestedComponentRules,ch.qos.logback.core.subst.NodeToStringTransformer\$1,ch.qos.logback.core.pattern.parser.TokenStream\$1,ch.qos.logback.core.subst.Tokenizer\$1 --initialize-at-run-time=io.netty.channel.AbstractChannel,io.netty.channel.socket.nio.SelectorProviderUtil,io.netty.util.concurrent.DefaultPromise,io.netty,org.slf4j.MDC,org.github.gestalt.config ${project.name}"
standardOutput out
}
}
println(out.toString())
}

task buildBinaryStatic {
dependsOn jar
def buildBinaryDir = "build/binary"
def out = new ByteArrayOutputStream()
doFirst {
new File(buildBinaryDir).mkdirs()
copy {
from "build/libs/${project.name}-${project.version}.jar"
into buildBinaryDir
rename "${project.name}-${project.version}.jar", "${project.name}.jar"
}
}
doLast {
exec {
workingDir buildBinaryDir
executable "sh"
args "-c", "native-image -jar ${project.name}.jar --gc=G1 --static --libc=musl --no-fallback --enable-http --enable-https --enable-preview --add-modules jdk.incubator.concurrent -H:EnableURLProtocols=http,https --initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback.core.CoreConstants,ch.qos.logback.core.util.Loader,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.core.status.InfoStatus,ch.qos.logback.classic.Logger,ch.qos.logback.core.rolling.helper.FileNamePattern,ch.qos.logback.classic.Level,ch.qos.logback.core.status.StatusBase,io.opentelemetry.api.trace.ArrayBasedTraceStateBuilder,io.opentelemetry.context.LazyStorage,ch.qos.logback.core.util.FileSize,ch.qos.logback.core.rolling.helper.RollingCalendar,io.opentelemetry.api.internal.ImmutableSpanContext,io.opentelemetry.api.internal.OtelEncodingUtils,ch.qos.logback.classic.PatternLayout,io.opentelemetry.context.ThreadLocalContextStorage,io.opentelemetry.api.trace.PropagatedSpan,io.opentelemetry.context.ContextStorageWrappers,ch.qos.logback.core.rolling.helper.Compressor\$1,io.opentelemetry.api.trace.ImmutableTraceFlags,ch.qos.logback.core.rolling.helper.RollingCalendar\$1,ch.qos.logback.classic.model.ConfigurationModel,ch.qos.logback.core.model.processor.DefaultProcessor\$1,ch.qos.logback.core.model.processor.ImplicitModelHandler\$1,ch.qos.logback.core.subst.Token,ch.qos.logback.core.pattern.parser.Parser,ch.qos.logback.core.subst.Parser\$1,ch.qos.logback.core.util.Duration,ch.qos.logback.core.model.processor.ChainedModelFilter\$1,ch.qos.logback.classic.model.processor.ConfigurationModelHandler,ch.qos.logback.classic.model.processor.LogbackClassicDefaultNestedComponentRules,ch.qos.logback.core.subst.NodeToStringTransformer\$1,ch.qos.logback.core.pattern.parser.TokenStream\$1,ch.qos.logback.core.subst.Tokenizer\$1 --initialize-at-run-time=io.netty.channel.AbstractChannel,io.netty.channel.socket.nio.SelectorProviderUtil,io.netty.util.concurrent.DefaultPromise,io.netty,org.slf4j.MDC,org.github.gestalt.config ${project.name}"
standardOutput out
}
}
println(out.toString())
}

task buildBinaryG1GC {
dependsOn jar
def buildBinaryDir = "build/binary"
def out = new ByteArrayOutputStream()
Expand Down

0 comments on commit 0e51ba3

Please sign in to comment.