From 67df6763593e0a905e78f45ff48c105808ef4757 Mon Sep 17 00:00:00 2001 From: Daniel Chao Date: Fri, 24 Jul 2026 21:15:26 -0700 Subject: [PATCH] Introduce C library for Pkl (#1238) This uses native-image to generate a C library for Pkl. This generated library from native-image is wrapped with our own library, in `pkl.h`. This produces a static and a dynamic library for each os/arch variant that Pkl currently supports. Co-authored-by: Kushal Pisavadia Co-authored-by: Jen Basch Co-authored-by: Islon Scherer --- .github/index.pkl | 5 +- .github/jobs/BuildNativeJob.pkl | 20 +- .github/workflows/__lockfile__.yml | 2 + .github/workflows/build.yml | 356 +++++++++++- .github/workflows/main.yml | 366 +++++++++++- .github/workflows/prb.yml | 365 +++++++++++- .github/workflows/release-branch.yml | 361 +++++++++++- .github/workflows/release.yml | 371 ++++++++++++- .idea/inspectionProfiles/Project_Default.xml | 3 + build-logic/src/main/kotlin/BuildInfo.kt | 37 +- build-logic/src/main/kotlin/CArchive.kt | 89 +++ build-logic/src/main/kotlin/CCompile.kt | 410 ++++++++++++++ .../src/main/kotlin/NativeImageBuild.kt | 113 +++- build-logic/src/main/kotlin/Target.kt | 110 ++++ .../kotlin/pklNativeExecutable.gradle.kts | 169 ++---- .../main/kotlin/pklNativeLifecycle.gradle.kts | 62 +-- .../resources/license-header.batch-script.txt | 15 + .../resources/license-header.hash-comment.txt | 15 + gradle/libs.versions.toml | 6 + libpkl/libpkl.gradle.kts | 523 ++++++++++++++++++ libpkl/scripts/build_unix.sh | 116 ++++ libpkl/scripts/build_windows.bat | 85 +++ libpkl/src/main/c/include/pkl.h | 108 ++++ libpkl/src/main/c/pkl.c | 353 ++++++++++++ libpkl/src/main/c/pkl.exported_symbols | 4 + libpkl/src/main/c/pkl.map | 9 + libpkl/src/main/files/LICENSE.txt | 1 + libpkl/src/main/files/README.md | 5 + libpkl/src/main/files/THIRD-PARTY-NOTICES.txt | 437 +++++++++++++++ libpkl/src/main/files/lib/pkgconfig/libpkl.pc | 11 + .../java/org/pkl/libpkl/LibPklInternal.java | 118 ++++ .../java/org/pkl/libpkl/LibPklLogger.java | 29 + .../org/pkl/libpkl/NativeInputStream.java | 46 ++ .../java/org/pkl/libpkl/NativeTransport.java | 77 +++ .../java/org/pkl/libpkl/package-info.java | 4 + libpkl/src/nativeTest/c/test_pkl.c | 90 +++ .../kotlin/org/pkl/libpkl/LibPklJNA.kt | 52 ++ .../org/pkl/libpkl/LibPklMessageTransport.kt | 71 +++ .../kotlin/org/pkl/libpkl/LibPklServerTest.kt | 53 ++ .../kotlin/org/pkl/libpkl/LibPklTest.kt | 72 +++ pkl-commons-test/pkl-commons-test.gradle.kts | 3 + .../commons/test/MessagePackDebugRenderer.kt | 5 +- .../test/server/AbstractHttpServerTest.kt | 74 +++ .../test}/server/AbstractServerTest.kt | 84 ++- .../pkl/commons/test}/server/TestTransport.kt | 4 +- .../pkl/commons/test}/server/resource1.jar | Bin .../pkl/core/messaging/MessageTransport.java | 4 +- .../pkl/core/messaging/MessageTransports.java | 4 +- .../kotlin/org/pkl/server/JvmServerTest.kt | 6 +- .../kotlin/org/pkl/server/NativeServerTest.kt | 6 +- settings.gradle.kts | 2 + 51 files changed, 4982 insertions(+), 349 deletions(-) create mode 100644 build-logic/src/main/kotlin/CArchive.kt create mode 100644 build-logic/src/main/kotlin/CCompile.kt create mode 100644 build-logic/src/main/kotlin/Target.kt create mode 100644 build-logic/src/main/resources/license-header.batch-script.txt create mode 100644 build-logic/src/main/resources/license-header.hash-comment.txt create mode 100644 libpkl/libpkl.gradle.kts create mode 100755 libpkl/scripts/build_unix.sh create mode 100644 libpkl/scripts/build_windows.bat create mode 100644 libpkl/src/main/c/include/pkl.h create mode 100644 libpkl/src/main/c/pkl.c create mode 100644 libpkl/src/main/c/pkl.exported_symbols create mode 100644 libpkl/src/main/c/pkl.map create mode 120000 libpkl/src/main/files/LICENSE.txt create mode 100644 libpkl/src/main/files/README.md create mode 100644 libpkl/src/main/files/THIRD-PARTY-NOTICES.txt create mode 100644 libpkl/src/main/files/lib/pkgconfig/libpkl.pc create mode 100644 libpkl/src/main/java/org/pkl/libpkl/LibPklInternal.java create mode 100644 libpkl/src/main/java/org/pkl/libpkl/LibPklLogger.java create mode 100644 libpkl/src/main/java/org/pkl/libpkl/NativeInputStream.java create mode 100644 libpkl/src/main/java/org/pkl/libpkl/NativeTransport.java create mode 100644 libpkl/src/main/java/org/pkl/libpkl/package-info.java create mode 100644 libpkl/src/nativeTest/c/test_pkl.c create mode 100644 libpkl/src/nativeTest/kotlin/org/pkl/libpkl/LibPklJNA.kt create mode 100644 libpkl/src/nativeTest/kotlin/org/pkl/libpkl/LibPklMessageTransport.kt create mode 100644 libpkl/src/nativeTest/kotlin/org/pkl/libpkl/LibPklServerTest.kt create mode 100644 libpkl/src/nativeTest/kotlin/org/pkl/libpkl/LibPklTest.kt create mode 100644 pkl-commons-test/src/main/kotlin/org/pkl/commons/test/server/AbstractHttpServerTest.kt rename {pkl-server/src/test/kotlin/org/pkl => pkl-commons-test/src/main/kotlin/org/pkl/commons/test}/server/AbstractServerTest.kt (94%) rename {pkl-server/src/test/kotlin/org/pkl => pkl-commons-test/src/main/kotlin/org/pkl/commons/test}/server/TestTransport.kt (92%) rename {pkl-server/src/test/resources/org/pkl => pkl-commons-test/src/main/resources/org/pkl/commons/test}/server/resource1.jar (100%) diff --git a/.github/index.pkl b/.github/index.pkl index 855d1c357..563f1bc6a 100644 --- a/.github/index.pkl +++ b/.github/index.pkl @@ -61,13 +61,14 @@ local gradleCheckJobs: PklJobs = new { local buildNativeJobs: Mapping = new { for (_dist in List("release", "snapshot")) { - for (_project in List("pkl-cli", "pkl-doc")) { + for (_project in List("pkl-cli", "pkl-doc", "libpkl")) { for (_arch in List("amd64", "aarch64")) { ["\(_project)-linux-\(_arch)-\(_dist)"] { arch = _arch os = "linux" isRelease = _dist == "release" project = _project + buildDir = if (_project == "libpkl") "libpkl/build/native-libs/**/*" else "\(_project)*/build/executable/**/*" } } ["\(_project)-macOS-aarch64-\(_dist)"] { @@ -82,12 +83,14 @@ local buildNativeJobs: Mapping = new { musl = true isRelease = _dist == "release" project = _project + buildDir = if (_project == "libpkl") "libpkl*/build/distributions/**/*" else "\(_project)*/build/executable/**/*" } ["\(_project)-windows-amd64-\(_dist)"] { arch = "amd64" os = "windows" isRelease = _dist == "release" project = _project + buildDir = if (_project == "libpkl") "libpkl*/build/distributions/**/*" else "\(_project)*/build/executable/**/*" } } } diff --git a/.github/jobs/BuildNativeJob.pkl b/.github/jobs/BuildNativeJob.pkl index d3e8fe1ce..c57e733bf 100644 --- a/.github/jobs/BuildNativeJob.pkl +++ b/.github/jobs/BuildNativeJob.pkl @@ -1,7 +1,6 @@ extends "GradleJob.pkl" import "@gha/catalog.pkl" -import "@gha/context.pkl" /// Whether to link to musl. Otherwise, links to glibc. musl: Boolean(implies(module.os == "linux")) = false @@ -9,6 +8,11 @@ musl: Boolean(implies(module.os == "linux")) = false /// The Gradle project under which to generate the executable project: String +/// Path pattern for artifact uploads (glob passed to actions/upload-artifact) +buildDir: String = "\(project)*/build/executable/**/*" + +local needsCCompiler = project == "libpkl" + extraGradleArgs { when (musl) { "-Dpkl.musl=true" @@ -40,22 +44,28 @@ steps { run = #"git status || git config --system --add safe.directory "$GITHUB_WORKSPACE""# } } + when (needsCCompiler && os == "windows") { + new { + name = "Set up MSVC" + uses = "ilammy/msvc-dev-cmd@v1" + } + } new { name = "gradle buildNative" shell = "bash" run = "./gradlew \(module.gradleArgs) \(project):buildNative" } (catalog.`actions/upload-artifact@v5`) { - name = "Upload executable artifacts" + name = "Upload built artifacts" with { name = if (musl) - "executable-\(project)-alpine-\(module.os)-\(module.arch)" + "artifacts-\(project)-alpine-\(module.os)-\(module.arch)" else - "executable-\(project)-\(module.os)-\(module.arch)" + "artifacts-\(project)-\(module.os)-\(module.arch)" // Need to insert a wildcard to make actions/upload-artifact preserve the folder hierarchy. // See https://github.com/actions/upload-artifact/issues/206 - path = "\(project)*/build/executable/**/*" + path = module.buildDir } } } diff --git a/.github/workflows/__lockfile__.yml b/.github/workflows/__lockfile__.yml index af403030b..687ccbb2e 100644 --- a/.github/workflows/__lockfile__.yml +++ b/.github/workflows/__lockfile__.yml @@ -38,3 +38,5 @@ jobs: uses: gradle/actions/dependency-submission@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6 - name: gradle/actions/setup-gradle@v5 uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + - name: ilammy/msvc-dev-cmd@v1 + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea2596d96..5fba7a77e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -239,10 +239,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-amd64 + name: artifacts-pkl-cli-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -289,10 +289,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-aarch64 + name: artifacts-pkl-cli-linux-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -338,10 +338,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-macOS-aarch64 + name: artifacts-pkl-cli-macOS-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -455,10 +455,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-alpine-linux-amd64 + name: artifacts-pkl-cli-alpine-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -500,10 +500,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-windows-amd64 + name: artifacts-pkl-cli-windows-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -548,10 +548,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-amd64 + name: artifacts-pkl-doc-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -598,10 +598,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-aarch64 + name: artifacts-pkl-doc-linux-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -647,10 +647,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-macOS-aarch64 + name: artifacts-pkl-doc-macOS-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -764,10 +764,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-alpine-linux-amd64 + name: artifacts-pkl-doc-alpine-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -809,10 +809,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-windows-amd64 + name: artifacts-pkl-doc-windows-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -827,6 +827,317 @@ jobs: name: test-results-html-pkl-doc-windows-amd64-snapshot path: '**/build/reports/tests/**/*' if-no-files-found: ignore + libpkl-linux-amd64-snapshot: + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-amd64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-linux-aarch64-snapshot: + runs-on: ubuntu-24.04-arm + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-aarch64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-aarch64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-aarch64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-macOS-aarch64-snapshot: + if: github.repository_owner == 'apple' + runs-on: + - self-hosted + - macos + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-macOS-aarch64 + path: libpkl*/build/executable/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-macOS-aarch64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-macOS-aarch64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-alpine-linux-amd64-snapshot: + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Install musl and zlib + run: | + set -e + mkdir -p ~/staticdeps/ + + ZLIB_VERSION="1.2.13" + MUSL_VERSION="1.2.5" + + # install zlib + if [[ ! -f ~/staticdeps/include/zlib.h ]]; then + # Download zlib tarball and signature + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz" -o /tmp/zlib.tar.gz + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz.asc" -o /tmp/zlib.tar.gz.asc + + # Import zlib GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 5ED46A6721D365587791E2AA783FCD8E58BCAFBA + + # Verify GPG signature + echo "Verifying zlib GPG signature..." + gpg --verify /tmp/zlib.tar.gz.asc /tmp/zlib.tar.gz + + mkdir -p "/tmp/dep_zlib-${ZLIB_VERSION}" + cd "/tmp/dep_zlib-${ZLIB_VERSION}" + # shellcheck disable=SC2002 + cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . + + echo "zlib-${ZLIB_VERSION}: configure..." + ./configure --static --prefix="$HOME"/staticdeps > /dev/null + + echo "zlib-${ZLIB_VERSION}: make..." + make -s -j4 + + echo "zlib-${ZLIB_VERSION}: make install..." + make -s install + + rm -rf /tmp/dep_zlib-${ZLIB_VERSION} + fi + + # install musl + if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then + # Download musl tarball and signature + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz" -o /tmp/musl.tar.gz + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz.asc" -o /tmp/musl.tar.gz.asc + + # Import musl GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 836489290BB6B70F99FFDA0556BCDB593020450F + + # Verify GPG signature + echo "Verifying musl GPG signature..." + gpg --verify /tmp/musl.tar.gz.asc /tmp/musl.tar.gz + + mkdir -p "/tmp/dep_musl-${MUSL_VERSION}" + cd "/tmp/dep_musl-${MUSL_VERSION}" + + # shellcheck disable=SC2002 + cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . + + echo "musl-${MUSL_VERSION}: configure..." + ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null + + echo "musl-${MUSL_VERSION}: make..." + make -s -j4 + + echo "musl-${MUSL_VERSION}: make install..." + make -s install + + rm -rf "/tmp/dep_musl-${MUSL_VERSION}" + + # native-image expects to find an executable at this path. + ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc + fi + + echo "${HOME}/staticdeps/bin" >> "$GITHUB_PATH" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-alpine-linux-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-alpine-linux-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-alpine-linux-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-windows-amd64-snapshot: + runs-on: windows-latest + env: + LANG: en_US.UTF-8 + JAVA_HOME: /jdk + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Set up MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-windows-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-windows-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-windows-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore publish-test-results: if: '!cancelled()' needs: @@ -844,6 +1155,11 @@ jobs: - pkl-doc-macOS-aarch64-snapshot - pkl-doc-alpine-linux-amd64-snapshot - pkl-doc-windows-amd64-snapshot + - libpkl-linux-amd64-snapshot + - libpkl-linux-aarch64-snapshot + - libpkl-macOS-aarch64-snapshot + - libpkl-alpine-linux-amd64-snapshot + - libpkl-windows-amd64-snapshot permissions: checks: write runs-on: ubuntu-latest diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5b69444e5..502d4103a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -237,10 +237,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-amd64 + name: artifacts-pkl-cli-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -287,10 +287,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-aarch64 + name: artifacts-pkl-cli-linux-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -336,10 +336,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-macOS-aarch64 + name: artifacts-pkl-cli-macOS-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -453,10 +453,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-alpine-linux-amd64 + name: artifacts-pkl-cli-alpine-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -498,10 +498,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-windows-amd64 + name: artifacts-pkl-cli-windows-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -546,10 +546,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-amd64 + name: artifacts-pkl-doc-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -596,10 +596,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-aarch64 + name: artifacts-pkl-doc-linux-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -645,10 +645,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-macOS-aarch64 + name: artifacts-pkl-doc-macOS-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -762,10 +762,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-alpine-linux-amd64 + name: artifacts-pkl-doc-alpine-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -807,10 +807,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-windows-amd64 + name: artifacts-pkl-doc-windows-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -825,6 +825,317 @@ jobs: name: test-results-html-pkl-doc-windows-amd64-snapshot path: '**/build/reports/tests/**/*' if-no-files-found: ignore + libpkl-linux-amd64-snapshot: + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-amd64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-linux-aarch64-snapshot: + runs-on: ubuntu-24.04-arm + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-aarch64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-aarch64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-aarch64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-macOS-aarch64-snapshot: + if: github.repository_owner == 'apple' + runs-on: + - self-hosted + - macos + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-macOS-aarch64 + path: libpkl*/build/executable/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-macOS-aarch64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-macOS-aarch64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-alpine-linux-amd64-snapshot: + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Install musl and zlib + run: | + set -e + mkdir -p ~/staticdeps/ + + ZLIB_VERSION="1.2.13" + MUSL_VERSION="1.2.5" + + # install zlib + if [[ ! -f ~/staticdeps/include/zlib.h ]]; then + # Download zlib tarball and signature + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz" -o /tmp/zlib.tar.gz + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz.asc" -o /tmp/zlib.tar.gz.asc + + # Import zlib GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 5ED46A6721D365587791E2AA783FCD8E58BCAFBA + + # Verify GPG signature + echo "Verifying zlib GPG signature..." + gpg --verify /tmp/zlib.tar.gz.asc /tmp/zlib.tar.gz + + mkdir -p "/tmp/dep_zlib-${ZLIB_VERSION}" + cd "/tmp/dep_zlib-${ZLIB_VERSION}" + # shellcheck disable=SC2002 + cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . + + echo "zlib-${ZLIB_VERSION}: configure..." + ./configure --static --prefix="$HOME"/staticdeps > /dev/null + + echo "zlib-${ZLIB_VERSION}: make..." + make -s -j4 + + echo "zlib-${ZLIB_VERSION}: make install..." + make -s install + + rm -rf /tmp/dep_zlib-${ZLIB_VERSION} + fi + + # install musl + if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then + # Download musl tarball and signature + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz" -o /tmp/musl.tar.gz + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz.asc" -o /tmp/musl.tar.gz.asc + + # Import musl GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 836489290BB6B70F99FFDA0556BCDB593020450F + + # Verify GPG signature + echo "Verifying musl GPG signature..." + gpg --verify /tmp/musl.tar.gz.asc /tmp/musl.tar.gz + + mkdir -p "/tmp/dep_musl-${MUSL_VERSION}" + cd "/tmp/dep_musl-${MUSL_VERSION}" + + # shellcheck disable=SC2002 + cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . + + echo "musl-${MUSL_VERSION}: configure..." + ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null + + echo "musl-${MUSL_VERSION}: make..." + make -s -j4 + + echo "musl-${MUSL_VERSION}: make install..." + make -s install + + rm -rf "/tmp/dep_musl-${MUSL_VERSION}" + + # native-image expects to find an executable at this path. + ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc + fi + + echo "${HOME}/staticdeps/bin" >> "$GITHUB_PATH" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-alpine-linux-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-alpine-linux-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-alpine-linux-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-windows-amd64-snapshot: + runs-on: windows-latest + env: + LANG: en_US.UTF-8 + JAVA_HOME: /jdk + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Set up MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-windows-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-windows-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-windows-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore deploy-snapshot: needs: - gradle-check @@ -842,6 +1153,11 @@ jobs: - pkl-doc-macOS-aarch64-snapshot - pkl-doc-alpine-linux-amd64-snapshot - pkl-doc-windows-amd64-snapshot + - libpkl-linux-amd64-snapshot + - libpkl-linux-aarch64-snapshot + - libpkl-macOS-aarch64-snapshot + - libpkl-alpine-linux-amd64-snapshot + - libpkl-windows-amd64-snapshot runs-on: ubuntu-latest env: LANG: en_US.UTF-8 @@ -911,6 +1227,11 @@ jobs: - pkl-doc-macOS-aarch64-snapshot - pkl-doc-alpine-linux-amd64-snapshot - pkl-doc-windows-amd64-snapshot + - libpkl-linux-amd64-snapshot + - libpkl-linux-aarch64-snapshot + - libpkl-macOS-aarch64-snapshot + - libpkl-alpine-linux-amd64-snapshot + - libpkl-windows-amd64-snapshot permissions: checks: write runs-on: ubuntu-latest @@ -949,6 +1270,11 @@ jobs: - pkl-doc-macOS-aarch64-snapshot - pkl-doc-alpine-linux-amd64-snapshot - pkl-doc-windows-amd64-snapshot + - libpkl-linux-amd64-snapshot + - libpkl-linux-aarch64-snapshot + - libpkl-macOS-aarch64-snapshot + - libpkl-alpine-linux-amd64-snapshot + - libpkl-windows-amd64-snapshot - deploy-snapshot - dependency-submission - publish-test-results diff --git a/.github/workflows/prb.yml b/.github/workflows/prb.yml index 249474976..c2b891f7f 100644 --- a/.github/workflows/prb.yml +++ b/.github/workflows/prb.yml @@ -123,10 +123,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-amd64 + name: artifacts-pkl-cli-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -175,10 +175,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-aarch64 + name: artifacts-pkl-cli-linux-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -225,10 +225,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-macOS-aarch64 + name: artifacts-pkl-cli-macOS-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -344,10 +344,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-alpine-linux-amd64 + name: artifacts-pkl-cli-alpine-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -391,10 +391,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-windows-amd64 + name: artifacts-pkl-cli-windows-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -441,10 +441,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-amd64 + name: artifacts-pkl-doc-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -493,10 +493,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-aarch64 + name: artifacts-pkl-doc-linux-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -543,10 +543,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-macOS-aarch64 + name: artifacts-pkl-doc-macOS-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -662,10 +662,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-alpine-linux-amd64 + name: artifacts-pkl-doc-alpine-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -709,10 +709,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-windows-amd64 + name: artifacts-pkl-doc-windows-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -728,6 +728,326 @@ jobs: name: test-results-html-pkl-doc-windows-amd64-snapshot path: '**/build/reports/tests/**/*' if-no-files-found: ignore + libpkl-linux-amd64-snapshot: + if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-libpkl]') || contains(github.event.pull_request.body, '[native-libpkl-linux]') || contains(github.event.pull_request.body, '[native-libpkl-linux-amd64]') || contains(github.event.pull_request.body, '[native-libpkl-linux-amd64]') + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-amd64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-amd64-snapshot + path: '**/build/test-results/**/*.xml' + if-no-files-found: ignore + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-linux-aarch64-snapshot: + if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-libpkl]') || contains(github.event.pull_request.body, '[native-libpkl-linux]') || contains(github.event.pull_request.body, '[native-libpkl-linux-aarch64]') || contains(github.event.pull_request.body, '[native-libpkl-linux-aarch64]') + runs-on: ubuntu-24.04-arm + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-aarch64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-aarch64-snapshot + path: '**/build/test-results/**/*.xml' + if-no-files-found: ignore + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-aarch64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-macOS-aarch64-snapshot: + if: (contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-libpkl]') || contains(github.event.pull_request.body, '[native-libpkl-macOS]') || contains(github.event.pull_request.body, '[native-libpkl-macOS-aarch64]') || contains(github.event.pull_request.body, '[native-libpkl-macOS-aarch64]')) && github.repository_owner == 'apple' + runs-on: + - self-hosted + - macos + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-macOS-aarch64 + path: libpkl*/build/executable/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-macOS-aarch64-snapshot + path: '**/build/test-results/**/*.xml' + if-no-files-found: ignore + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-macOS-aarch64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-alpine-linux-amd64-snapshot: + if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-libpkl]') || contains(github.event.pull_request.body, '[native-libpkl-linux]') || contains(github.event.pull_request.body, '[native-libpkl-linux-amd64]') || contains(github.event.pull_request.body, '[native-libpkl-linux-amd64]') || contains(github.event.pull_request.body, '[native-libpkl-alpine-linux-amd64]') + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Install musl and zlib + run: | + set -e + mkdir -p ~/staticdeps/ + + ZLIB_VERSION="1.2.13" + MUSL_VERSION="1.2.5" + + # install zlib + if [[ ! -f ~/staticdeps/include/zlib.h ]]; then + # Download zlib tarball and signature + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz" -o /tmp/zlib.tar.gz + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz.asc" -o /tmp/zlib.tar.gz.asc + + # Import zlib GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 5ED46A6721D365587791E2AA783FCD8E58BCAFBA + + # Verify GPG signature + echo "Verifying zlib GPG signature..." + gpg --verify /tmp/zlib.tar.gz.asc /tmp/zlib.tar.gz + + mkdir -p "/tmp/dep_zlib-${ZLIB_VERSION}" + cd "/tmp/dep_zlib-${ZLIB_VERSION}" + # shellcheck disable=SC2002 + cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . + + echo "zlib-${ZLIB_VERSION}: configure..." + ./configure --static --prefix="$HOME"/staticdeps > /dev/null + + echo "zlib-${ZLIB_VERSION}: make..." + make -s -j4 + + echo "zlib-${ZLIB_VERSION}: make install..." + make -s install + + rm -rf /tmp/dep_zlib-${ZLIB_VERSION} + fi + + # install musl + if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then + # Download musl tarball and signature + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz" -o /tmp/musl.tar.gz + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz.asc" -o /tmp/musl.tar.gz.asc + + # Import musl GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 836489290BB6B70F99FFDA0556BCDB593020450F + + # Verify GPG signature + echo "Verifying musl GPG signature..." + gpg --verify /tmp/musl.tar.gz.asc /tmp/musl.tar.gz + + mkdir -p "/tmp/dep_musl-${MUSL_VERSION}" + cd "/tmp/dep_musl-${MUSL_VERSION}" + + # shellcheck disable=SC2002 + cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . + + echo "musl-${MUSL_VERSION}: configure..." + ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null + + echo "musl-${MUSL_VERSION}: make..." + make -s -j4 + + echo "musl-${MUSL_VERSION}: make install..." + make -s install + + rm -rf "/tmp/dep_musl-${MUSL_VERSION}" + + # native-image expects to find an executable at this path. + ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc + fi + + echo "${HOME}/staticdeps/bin" >> "$GITHUB_PATH" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-alpine-linux-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-alpine-linux-amd64-snapshot + path: '**/build/test-results/**/*.xml' + if-no-files-found: ignore + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-alpine-linux-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-windows-amd64-snapshot: + if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-libpkl]') || contains(github.event.pull_request.body, '[native-libpkl-windows]') || contains(github.event.pull_request.body, '[native-libpkl-windows-amd64]') || contains(github.event.pull_request.body, '[native-libpkl-windows-amd64]') + runs-on: windows-latest + env: + LANG: en_US.UTF-8 + JAVA_HOME: /jdk + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Set up MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-windows-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-windows-amd64-snapshot + path: '**/build/test-results/**/*.xml' + if-no-files-found: ignore + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-windows-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore verdict: if: always() needs: @@ -744,6 +1064,11 @@ jobs: - pkl-doc-macOS-aarch64-snapshot - pkl-doc-alpine-linux-amd64-snapshot - pkl-doc-windows-amd64-snapshot + - libpkl-linux-amd64-snapshot + - libpkl-linux-aarch64-snapshot + - libpkl-macOS-aarch64-snapshot + - libpkl-alpine-linux-amd64-snapshot + - libpkl-windows-amd64-snapshot runs-on: ubuntu-latest steps: - name: Failure verdict diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml index b3aff09dc..a52abe880 100644 --- a/.github/workflows/release-branch.yml +++ b/.github/workflows/release-branch.yml @@ -237,10 +237,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-amd64 + name: artifacts-pkl-cli-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -287,10 +287,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-aarch64 + name: artifacts-pkl-cli-linux-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -336,10 +336,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-macOS-aarch64 + name: artifacts-pkl-cli-macOS-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -453,10 +453,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-alpine-linux-amd64 + name: artifacts-pkl-cli-alpine-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -498,10 +498,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-windows-amd64 + name: artifacts-pkl-cli-windows-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -546,10 +546,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-amd64 + name: artifacts-pkl-doc-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -596,10 +596,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-aarch64 + name: artifacts-pkl-doc-linux-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -645,10 +645,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-macOS-aarch64 + name: artifacts-pkl-doc-macOS-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -762,10 +762,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-alpine-linux-amd64 + name: artifacts-pkl-doc-alpine-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -807,10 +807,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-windows-amd64 + name: artifacts-pkl-doc-windows-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -825,6 +825,317 @@ jobs: name: test-results-html-pkl-doc-windows-amd64-snapshot path: '**/build/reports/tests/**/*' if-no-files-found: ignore + libpkl-linux-amd64-snapshot: + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-amd64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-linux-aarch64-snapshot: + runs-on: ubuntu-24.04-arm + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-aarch64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-aarch64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-aarch64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-macOS-aarch64-snapshot: + if: github.repository_owner == 'apple' + runs-on: + - self-hosted + - macos + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-macOS-aarch64 + path: libpkl*/build/executable/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-macOS-aarch64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-macOS-aarch64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-alpine-linux-amd64-snapshot: + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Install musl and zlib + run: | + set -e + mkdir -p ~/staticdeps/ + + ZLIB_VERSION="1.2.13" + MUSL_VERSION="1.2.5" + + # install zlib + if [[ ! -f ~/staticdeps/include/zlib.h ]]; then + # Download zlib tarball and signature + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz" -o /tmp/zlib.tar.gz + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz.asc" -o /tmp/zlib.tar.gz.asc + + # Import zlib GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 5ED46A6721D365587791E2AA783FCD8E58BCAFBA + + # Verify GPG signature + echo "Verifying zlib GPG signature..." + gpg --verify /tmp/zlib.tar.gz.asc /tmp/zlib.tar.gz + + mkdir -p "/tmp/dep_zlib-${ZLIB_VERSION}" + cd "/tmp/dep_zlib-${ZLIB_VERSION}" + # shellcheck disable=SC2002 + cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . + + echo "zlib-${ZLIB_VERSION}: configure..." + ./configure --static --prefix="$HOME"/staticdeps > /dev/null + + echo "zlib-${ZLIB_VERSION}: make..." + make -s -j4 + + echo "zlib-${ZLIB_VERSION}: make install..." + make -s install + + rm -rf /tmp/dep_zlib-${ZLIB_VERSION} + fi + + # install musl + if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then + # Download musl tarball and signature + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz" -o /tmp/musl.tar.gz + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz.asc" -o /tmp/musl.tar.gz.asc + + # Import musl GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 836489290BB6B70F99FFDA0556BCDB593020450F + + # Verify GPG signature + echo "Verifying musl GPG signature..." + gpg --verify /tmp/musl.tar.gz.asc /tmp/musl.tar.gz + + mkdir -p "/tmp/dep_musl-${MUSL_VERSION}" + cd "/tmp/dep_musl-${MUSL_VERSION}" + + # shellcheck disable=SC2002 + cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . + + echo "musl-${MUSL_VERSION}: configure..." + ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null + + echo "musl-${MUSL_VERSION}: make..." + make -s -j4 + + echo "musl-${MUSL_VERSION}: make install..." + make -s install + + rm -rf "/tmp/dep_musl-${MUSL_VERSION}" + + # native-image expects to find an executable at this path. + ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc + fi + + echo "${HOME}/staticdeps/bin" >> "$GITHUB_PATH" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-alpine-linux-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-alpine-linux-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-alpine-linux-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-windows-amd64-snapshot: + runs-on: windows-latest + env: + LANG: en_US.UTF-8 + JAVA_HOME: /jdk + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: {} + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Set up MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-windows-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-windows-amd64-snapshot + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-windows-amd64-snapshot + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore publish-test-results: if: '!cancelled()' needs: @@ -842,6 +1153,11 @@ jobs: - pkl-doc-macOS-aarch64-snapshot - pkl-doc-alpine-linux-amd64-snapshot - pkl-doc-windows-amd64-snapshot + - libpkl-linux-amd64-snapshot + - libpkl-linux-aarch64-snapshot + - libpkl-macOS-aarch64-snapshot + - libpkl-alpine-linux-amd64-snapshot + - libpkl-windows-amd64-snapshot permissions: checks: write runs-on: ubuntu-latest @@ -880,6 +1196,11 @@ jobs: - pkl-doc-macOS-aarch64-snapshot - pkl-doc-alpine-linux-amd64-snapshot - pkl-doc-windows-amd64-snapshot + - libpkl-linux-amd64-snapshot + - libpkl-linux-aarch64-snapshot + - libpkl-macOS-aarch64-snapshot + - libpkl-alpine-linux-amd64-snapshot + - libpkl-windows-amd64-snapshot - publish-test-results runs-on: ubuntu-latest steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe2ce2b8e..7b40eb6b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -239,10 +239,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-amd64 + name: artifacts-pkl-cli-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -290,10 +290,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-linux-aarch64 + name: artifacts-pkl-cli-linux-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -340,10 +340,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-macOS-aarch64 + name: artifacts-pkl-cli-macOS-aarch64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -458,10 +458,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.musl=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-alpine-linux-amd64 + name: artifacts-pkl-cli-alpine-linux-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -504,10 +504,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-cli-windows-amd64 + name: artifacts-pkl-cli-windows-amd64 path: pkl-cli*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -553,10 +553,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-amd64 + name: artifacts-pkl-doc-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -604,10 +604,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-linux-aarch64 + name: artifacts-pkl-doc-linux-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -654,10 +654,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-macOS-aarch64 + name: artifacts-pkl-doc-macOS-aarch64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -772,10 +772,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.musl=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-alpine-linux-amd64 + name: artifacts-pkl-doc-alpine-linux-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -818,10 +818,10 @@ jobs: - name: gradle buildNative shell: bash run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative - - name: Upload executable artifacts + - name: Upload built artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: - name: executable-pkl-doc-windows-amd64 + name: artifacts-pkl-doc-windows-amd64 path: pkl-doc*/build/executable/**/* - name: Upload Test Result XML if: '!cancelled()' @@ -836,6 +836,322 @@ jobs: name: test-results-html-pkl-doc-windows-amd64-release path: '**/build/reports/tests/**/*' if-no-files-found: ignore + libpkl-linux-amd64-release: + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: + cache-disabled: true + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-amd64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-amd64-release + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-amd64-release + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-linux-aarch64-release: + runs-on: ubuntu-24.04-arm + env: + LANG: en_US.UTF-8 + steps: + - name: Install deps + run: dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: + cache-disabled: true + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Fix git ownership + run: git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-linux-aarch64 + path: libpkl/build/native-libs/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-linux-aarch64-release + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-linux-aarch64-release + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + container: + image: redhat/ubi8:8.10 + libpkl-macOS-aarch64-release: + if: github.repository_owner == 'apple' + runs-on: + - self-hosted + - macos + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: aarch64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: + cache-disabled: true + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-macOS-aarch64 + path: libpkl*/build/executable/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-macOS-aarch64-release + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-macOS-aarch64-release + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-alpine-linux-amd64-release: + runs-on: ubuntu-latest + env: + LANG: en_US.UTF-8 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: + cache-disabled: true + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Install musl and zlib + run: | + set -e + mkdir -p ~/staticdeps/ + + ZLIB_VERSION="1.2.13" + MUSL_VERSION="1.2.5" + + # install zlib + if [[ ! -f ~/staticdeps/include/zlib.h ]]; then + # Download zlib tarball and signature + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz" -o /tmp/zlib.tar.gz + curl -Lf "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz.asc" -o /tmp/zlib.tar.gz.asc + + # Import zlib GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 5ED46A6721D365587791E2AA783FCD8E58BCAFBA + + # Verify GPG signature + echo "Verifying zlib GPG signature..." + gpg --verify /tmp/zlib.tar.gz.asc /tmp/zlib.tar.gz + + mkdir -p "/tmp/dep_zlib-${ZLIB_VERSION}" + cd "/tmp/dep_zlib-${ZLIB_VERSION}" + # shellcheck disable=SC2002 + cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . + + echo "zlib-${ZLIB_VERSION}: configure..." + ./configure --static --prefix="$HOME"/staticdeps > /dev/null + + echo "zlib-${ZLIB_VERSION}: make..." + make -s -j4 + + echo "zlib-${ZLIB_VERSION}: make install..." + make -s install + + rm -rf /tmp/dep_zlib-${ZLIB_VERSION} + fi + + # install musl + if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then + # Download musl tarball and signature + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz" -o /tmp/musl.tar.gz + curl -Lf "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz.asc" -o /tmp/musl.tar.gz.asc + + # Import musl GPG key + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 836489290BB6B70F99FFDA0556BCDB593020450F + + # Verify GPG signature + echo "Verifying musl GPG signature..." + gpg --verify /tmp/musl.tar.gz.asc /tmp/musl.tar.gz + + mkdir -p "/tmp/dep_musl-${MUSL_VERSION}" + cd "/tmp/dep_musl-${MUSL_VERSION}" + + # shellcheck disable=SC2002 + cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . + + echo "musl-${MUSL_VERSION}: configure..." + ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null + + echo "musl-${MUSL_VERSION}: make..." + make -s -j4 + + echo "musl-${MUSL_VERSION}: make install..." + make -s install + + rm -rf "/tmp/dep_musl-${MUSL_VERSION}" + + # native-image expects to find an executable at this path. + ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc + fi + + echo "${HOME}/staticdeps/bin" >> "$GITHUB_PATH" + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.musl=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-alpine-linux-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-alpine-linux-amd64-release + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-alpine-linux-amd64-release + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore + libpkl-windows-amd64-release: + runs-on: windows-latest + env: + LANG: en_US.UTF-8 + JAVA_HOME: /jdk + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 + with: + java-version: '25' + distribution: temurin + architecture: x64 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 + with: + cache-disabled: true + - name: Set DEBUG_ARGS env var + env: + RUNNER_DEBUG: ${{ runner.debug }} + shell: bash + run: |- + if [[ "$RUNNER_DEBUG" -eq 1 ]]; then + echo "DEBUG_ARGS=--info --stacktrace" >> $GITHUB_ENV + fi + - name: Set up MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 + - name: gradle buildNative + shell: bash + run: ./gradlew $DEBUG_ARGS --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true libpkl:buildNative + - name: Upload built artifacts + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: artifacts-libpkl-windows-amd64 + path: libpkl*/build/distributions/**/* + - name: Upload Test Result XML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-xml-libpkl-windows-amd64-release + path: '**/build/test-results/**/*.xml' + - name: Upload Test Result HTML + if: '!cancelled()' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 + with: + name: test-results-html-libpkl-windows-amd64-release + path: '**/build/reports/tests/**/*' + if-no-files-found: ignore deploy-release: needs: - gradle-check @@ -853,6 +1169,11 @@ jobs: - pkl-doc-macOS-aarch64-release - pkl-doc-alpine-linux-amd64-release - pkl-doc-windows-amd64-release + - libpkl-linux-amd64-release + - libpkl-linux-aarch64-release + - libpkl-macOS-aarch64-release + - libpkl-alpine-linux-amd64-release + - libpkl-windows-amd64-release runs-on: ubuntu-latest env: LANG: en_US.UTF-8 @@ -934,6 +1255,11 @@ jobs: - pkl-doc-macOS-aarch64-release - pkl-doc-alpine-linux-amd64-release - pkl-doc-windows-amd64-release + - libpkl-linux-amd64-release + - libpkl-linux-aarch64-release + - libpkl-macOS-aarch64-release + - libpkl-alpine-linux-amd64-release + - libpkl-windows-amd64-release permissions: checks: write runs-on: ubuntu-latest @@ -972,6 +1298,11 @@ jobs: - pkl-doc-macOS-aarch64-release - pkl-doc-alpine-linux-amd64-release - pkl-doc-windows-amd64-release + - libpkl-linux-amd64-release + - libpkl-linux-aarch64-release + - libpkl-macOS-aarch64-release + - libpkl-alpine-linux-amd64-release + - libpkl-windows-amd64-release - deploy-release - github-release - publish-test-results diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 45a03ea6a..c23e489e3 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -96,6 +96,9 @@