Skip to content

Commit d91cfd2

Browse files
Switch to Temurin JDK (#392)
1 parent 88c6764 commit d91cfd2

File tree

8 files changed

+47
-50
lines changed

8 files changed

+47
-50
lines changed

.github/workflows/unit-test.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ on:
77
branches:
88
- main
99

10-
permissions:
11-
contents: write
12-
security-events: write
10+
permissions: read-all
1311

1412
jobs:
1513
tests:
1614
name: Execute unit tests
1715
runs-on: ${{ matrix.os }}
16+
permissions:
17+
contents: write
1818
strategy:
1919
fail-fast: false
2020
matrix:
@@ -32,7 +32,7 @@ jobs:
3232
- name: Setup Java
3333
uses: actions/setup-java@v4
3434
with:
35-
distribution: zulu
35+
distribution: temurin
3636
java-version: 24
3737

3838
- name: Setup project and upload dependency graph
@@ -44,6 +44,7 @@ jobs:
4444
build-scan-terms-of-use-agree: 'yes'
4545

4646
- name: Execute tests
47+
shell: bash
4748
run: ./gradlew test
4849

4950
- name: Upload coverage report
@@ -56,16 +57,17 @@ jobs:
5657
if-no-files-found: error
5758

5859
qodana:
59-
permissions:
60-
checks: write
6160
name: Perform Qodana analysis
6261
needs: tests
6362
runs-on: ubuntu-latest
63+
permissions:
64+
checks: write
65+
security-events: write
6466
steps:
6567
- name: Checkout code changes
6668
uses: actions/checkout@v5
6769
with:
68-
ref: ${{ github.event.pull_request.head.sha }}
70+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
6971
fetch-depth: 0
7072

7173
- name: Download coverage report
@@ -75,7 +77,7 @@ jobs:
7577
path: .qodana/code-coverage
7678

7779
- name: Execute analysis
78-
uses: JetBrains/qodana-action@main
80+
uses: JetBrains/qodana-action@v2025.2
7981
env:
8082
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
8183
with:

Dockerfile

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
1-
FROM azul/zulu-openjdk-alpine:24 AS builder
2-
3-
# bump: libwebp /LIBWEBP_VERSION=([\d.]+)/ git:https://chromium.googlesource.com/webm/libwebp.git|^1
4-
# bump: libwebp after ./hashupdate Dockerfile LIBWEBP $LATEST
5-
ARG LIBWEBP_VERSION=1.6.0
6-
ARG LIBWEBP_SHA256=1c5ffab71efecefa0e3c23516c3a3a1dccb45cc310ae1095c6f14ae268e38067
7-
ARG LIBWEBP_FILE="libwebp-$LIBWEBP_VERSION-linux-x86-64.tar.gz"
8-
ARG LIBWEBP_URL="https://storage.googleapis.com/downloads.webmproject.org/releases/webp/$LIBWEBP_FILE"
1+
FROM eclipse-temurin:24-alpine AS builder
92

103
WORKDIR /app
11-
RUN apk --no-cache add binutils curl tar
12-
RUN curl -L --fail --retry 3 --retry-delay 5 "$LIBWEBP_URL" -O && \
13-
echo "$LIBWEBP_SHA256 $LIBWEBP_FILE" | sha256sum -c - && \
14-
tar -xzf "$LIBWEBP_FILE" --one-top-level=libwebp --strip-components=1 && \
15-
rm "$LIBWEBP_FILE"
16-
174
COPY . .
185
RUN --mount=type=cache,target=/root/.gradle ./gradlew jlink shadowJar
196

207
# bump: alpine /FROM alpine:([\d.]+)/ docker:alpine|^3
218
# bump: alpine link "Release notes" https://alpinelinux.org/posts/Alpine-$LATEST-released.html
229
FROM alpine:3.22.1 AS bot
2310

24-
# bump: ffmpeg /static-ffmpeg:([\d.]+)/ docker:mwader/static-ffmpeg|~7.0
25-
COPY --from=mwader/static-ffmpeg:7.0.2 /ffmpeg /usr/local/bin/
26-
ENV FFMPEG_PATH=/usr/local/bin/ffmpeg
11+
RUN apk --no-cache add libwebp-tools
2712

28-
COPY --from=builder /app/libwebp/bin/cwebp /usr/local/bin/
29-
COPY --from=builder /app/libwebp/bin/dwebp /usr/local/bin/
13+
# bump: ffmpeg /static-ffmpeg:([\d.]+)/ docker:mwader/static-ffmpeg|~7.0
14+
COPY --from=mwader/static-ffmpeg:7.0.2 /ffmpeg /usr/bin/
15+
ENV FFMPEG_PATH=/usr/bin/ffmpeg
3016

3117
COPY --from=builder /app/build/jlink/jre jre
32-
COPY --from=builder /app/build/libs/Stickerify-1.0-all.jar Stickerify.jar
18+
COPY --from=builder /app/build/libs/*-all.jar Stickerify.jar
3319

34-
CMD ["jre/bin/java", "-Dcom.sksamuel.scrimage.webp.binary.dir=/usr/local/bin/", "-jar", "Stickerify.jar"]
20+
CMD ["jre/bin/java", "-Dcom.sksamuel.scrimage.webp.binary.dir=/usr/bin", "-jar", "Stickerify.jar"]

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,18 @@ description = 'Telegram bot to convert medias in the format required to be used
4848

4949
java.toolchain {
5050
languageVersion = JavaLanguageVersion.of(24)
51-
vendor = JvmVendorSpec.AZUL
51+
vendor = JvmVendorSpec.ADOPTIUM
5252
}
5353

5454
updateDaemonJvm {
5555
languageVersion = JavaLanguageVersion.of(24)
56-
vendor = JvmVendorSpec.AZUL
56+
vendor = JvmVendorSpec.ADOPTIUM
5757
}
5858

5959
def jlink = tasks.register('jlink', JlinkTask) {
6060
options = ['--strip-debug', '--no-header-files', '--no-man-pages']
6161
modules = ['java.desktop', 'java.instrument', 'java.naming', 'java.sql', 'jdk.crypto.ec', 'jdk.unsupported']
62+
includeModulePath = false
6263

6364
group = 'build'
6465
description = 'Generates a minimal JRE for the project.'
@@ -72,7 +73,7 @@ test {
7273
finalizedBy(jacocoTestReport)
7374

7475
testLogging {
75-
events "passed"
76+
events 'passed', 'failed', 'skipped'
7677
}
7778
}
7879

buildSrc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ repositories {
88

99
java.toolchain {
1010
languageVersion = JavaLanguageVersion.of(24)
11-
vendor = JvmVendorSpec.AZUL
11+
vendor = JvmVendorSpec.ADOPTIUM
1212
}

buildSrc/src/main/java/com/github/stickerifier/stickerify/JlinkTask.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public abstract class JlinkTask extends DefaultTask {
3030
@Input
3131
public abstract ListProperty<@NotNull String> getModules();
3232

33+
/**
34+
* If the selected JVM is <a href="https://openjdk.org/jeps/493">JEP 493</a> compatible, then this should be set to false.
35+
*/
36+
@Input
37+
public abstract Property<@NotNull Boolean> getIncludeModulePath();
38+
3339
@OutputDirectory
3440
public abstract DirectoryProperty getOutputDirectory();
3541

@@ -46,6 +52,7 @@ public abstract class JlinkTask extends DefaultTask {
4652
public JlinkTask(ProjectLayout layout, JavaToolchainService javaToolchain) {
4753
getOptions().convention(List.of());
4854
getModules().convention(List.of("ALL-MODULE-PATH"));
55+
getIncludeModulePath().convention(true);
4956
getOutputDirectory().convention(layout.getBuildDirectory().dir("jlink"));
5057

5158
var toolchain = getProject().getExtensions().getByType(JavaPluginExtension.class).getToolchain();
@@ -71,8 +78,10 @@ public void createJre() {
7178
var commandLine = new ArrayList<String>();
7279
commandLine.add(jlink.toString());
7380
commandLine.addAll(getOptions().get());
74-
commandLine.add("--module-path");
75-
commandLine.add(jmods.toString());
81+
if (getIncludeModulePath().get()) {
82+
commandLine.add("--module-path");
83+
commandLine.add(jmods.toString());
84+
}
7685
commandLine.add("--add-modules");
7786
commandLine.add(String.join(",", getModules().get()));
7887
commandLine.add("--output");
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#This file is generated by updateDaemonJvm
2-
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d898567da69cac7b9b75d8d74e577e7a/redirect
3-
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/902ef81bafffcd1670604d74b6c7a6b0/redirect
4-
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d898567da69cac7b9b75d8d74e577e7a/redirect
5-
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/902ef81bafffcd1670604d74b6c7a6b0/redirect
6-
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4175090548a4792cf1cef411becfba0f/redirect
7-
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/50df1a9c218487a6519e22a0d29e6215/redirect
8-
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d898567da69cac7b9b75d8d74e577e7a/redirect
9-
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/902ef81bafffcd1670604d74b6c7a6b0/redirect
10-
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/f55af862790b0c395d3f70e23016df3d/redirect
11-
toolchainVendor=AZUL
2+
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/6d0adbce30460017fe61d2993dfa663e/redirect
3+
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/50f16d2dc2bb80a421afc1af38fc92e3/redirect
4+
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/6d0adbce30460017fe61d2993dfa663e/redirect
5+
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/50f16d2dc2bb80a421afc1af38fc92e3/redirect
6+
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4f4ebe4f162f6deb29540c4ebe629d79/redirect
7+
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/79d5995ef1c3e4df39a3b2f545cada5e/redirect
8+
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/6d0adbce30460017fe61d2993dfa663e/redirect
9+
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/50f16d2dc2bb80a421afc1af38fc92e3/redirect
10+
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/61fdd87038cf8b094dadad8566609a29/redirect
11+
toolchainVendor=ADOPTIUM
1212
toolchainVersion=24

hashupdate

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#!/bin/sh
2-
set -euo
1+
#!/usr/bin/env bash
2+
set -euo pipefail
33

44
# Usage: hashupdate <FILE> <NAME> <VERSION>
5-
URL_TEMPLATE=$(grep "$2_URL=" "$1" | sed -E 's/.*="(.*)"/\1/')
6-
URL=$(echo "$URL_TEMPLATE" | sed "s/\$$2_VERSION/$3/g")
5+
URL=$(grep "$2_URL=" "$1" | sed -E 's/.*="([^"]*)".*/\1/' | sed "s/\$$2_VERSION/$3/g")
76
SHA256=$(curl -sL "$URL" | sha256sum | sed -e 's/ -//g')
87
sed -i -E "s/$2_SHA256=.*/$2_SHA256=$SHA256/" "$1"

qodana.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ include:
55
- name: VulnerableLibrariesGlobal
66
# bump: qodana /qodana-jvm:([\d.]+)/ docker:jetbrains/qodana-jvm|/^[\d]{4}\.\d+$/|sort
77
linter: jetbrains/qodana-jvm:2025.2
8-
projectJDK: zulu-24
8+
projectJDK: temurin-24

0 commit comments

Comments
 (0)