diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0c57a72..c869dc6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,5 +37,5 @@ jobs: - name: 'Native test' run: ./gradlew nativeTest - - name: 'Native compile and generate package' - run: ./gradlew generatePackage \ No newline at end of file + - name: 'Native compile' + run: ./gradlew nativeCompile \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8260a66..f10a2c5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,6 +19,9 @@ jobs: fail-fast: true matrix: os: [ ubuntu-latest, macOS-latest, windows-latest, macOS-arm64, linux-arm64 ] + include: + - os: windows-latest + suffix: .exe steps: - name: 'Check out repository' uses: actions/checkout@v3 @@ -39,7 +42,19 @@ jobs: - name: 'Check' run: ./gradlew check -Pversion='${{ github.event.inputs.version }}' - - name: 'Build native executable and compress' + - name: 'Build native executable' + run: ./gradlew nativeCompile -Pversion='${{ github.event.inputs.version }}' + + - name: 'Compress with UPX' + if: ${{ runner.os == 'Windows' || runner.os == 'Linux' }} + uses: crazy-max/ghaction-upx@v2 + with: + version: latest + files: | + ./build/native/nativeCompile/convert${{ matrix.suffix }} + args: --best + + - name: 'Generate package' run: ./gradlew generatePackage -Pversion='${{ github.event.inputs.version }}' - name: 'Upload build artifact' diff --git a/README.md b/README.md index 1c232c3..c317427 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ sdk env ./gradlew -Pagent nativeTest # Generate a distributable package with VERSION -./gradlew -Pversion=${VERSION} generatePackage +./gradlew -Pversion=${VERSION} nativeCompile generatePackage ``` ## TODO list @@ -146,5 +146,5 @@ sdk env - [ ] Read data from `STDIN` - [ ] Handle huge files - [ ] Handle partial inputs (streaming json logs ?) -- [ ] Minify binary with UPX on supported platforms +- [x] Minify binary with UPX on supported platforms - [ ] Have fun diff --git a/build.gradle b/build.gradle index b8f16be..513cacc 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,6 @@ plugins { id "com.diffplug.spotless" version "${spotlessVersion}" id "net.ltgt.errorprone" version "${errorPronePluginVersion}" id "org.graalvm.buildtools.native" version "${graalvmBuildtoolsVersion}" - id "org.jetbrains.gradle.upx" version "${upxVersion}" } group = "dev.gokhun" @@ -74,7 +73,7 @@ def archiveName = "${project.name}-${project.version}-${osName}-${arch == 'amd64 tasks.register("copyBinaries", Copy) { group = taskGroup - dependsOn("nativeCompile") + mustRunAfter("nativeCompile") def binDir = file("${buildDir}/native/${archiveName}/bin/") binDir.parentFile.mkdirs() diff --git a/gradle.properties b/gradle.properties index 35bb1af..d6e7ea3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,6 @@ spotlessVersion=6.15.0 errorPronePluginVersion=3.0.1 graalvmBuildtoolsVersion=0.9.19 testLoggerVersion=3.2.0 -upxVersion=1.5.2 # dependencies guavaVersion=31.1-jre