22 Commits
main ... 0.30.1

Author SHA1 Message Date
Jen Basch
36af9382c5 Fix release publishing (#1343) 2025-12-03 15:14:30 -08:00
Daniel Chao
a3075d0d9f Fix testing of pkldoc executables (#1342)
These tests are actually not running right now.
2025-12-03 15:14:24 -08:00
Daniel Chao
18af7571e8 CI job polish (#1341)
Avoids issues where setup-java post-task cacheing will hang with "device
or resource busy".
2025-12-03 15:14:18 -08:00
Jen Basch
5b6ee977c9 Prepare 0.30.1 release 2025-12-03 13:35:58 -08:00
Jen Basch
dca6da83b2 Prepare 0.30.1 release (#1338) 2025-12-03 12:16:15 -08:00
Jen Basch
7711a1612c Fix fetch depth for gradle-compatibility and java-executables-* CI jobs (#1339) 2025-12-03 10:35:35 -08:00
Daniel Chao
4f3f28aa76 Fix parsing of URLs with plus signs (#1335)
This fixes an issue where URLs with schemes that contain `+`, `-`, and
`.` would not be parsed correctly.

For example, `foo+bar:///?baz.pkl` would turn into
`foo+bar:///%3Fbaz.pkl`. The query param is lost, and turned into the
path.
2025-12-03 10:22:10 -08:00
Jen Basch
99ba9be765 Vendor paguro's RrbTree, fix an int overflow breaking large Lists (#1337) 2025-12-03 09:45:42 -08:00
Islon Scherer
bffc50ea10 Fix snapshot publishing (#1330) 2025-12-03 09:45:35 -08:00
Spencer Phillip Young
c63b8d3965 Fix newline checks in parser (#1328) 2025-12-03 09:45:28 -08:00
Spencer Phillip Young
5516cdb210 Fix empty parenthesized type unexpected error (#1323) 2025-12-03 09:44:45 -08:00
Daniel Chao
a8b6081a90 Fix macos/amd64 image builds (#1322) 2025-12-03 09:44:32 -08:00
Daniel Chao
cab7bd1b01 Fix deploy jobs (#1319)
Specify `merge-multiple` to prevent new directories from being created
when downloading artifacts.
2025-12-03 09:44:23 -08:00
Daniel Chao
1b29d59b21 Replace broken references to CircleCI (#1318) 2025-12-03 09:44:17 -08:00
Daniel Chao
e5577ed8f0 Fix release builds (#1317)
In order to preserve the folder hierarchy in our uploaded artifact,
we need to insert a wildcard in the root path.

Also, fix fan-in of tasks that lead to the publish test result task.
2025-12-03 09:44:01 -08:00
Daniel Chao
c965281d46 Fix build java executable (#1316) 2025-12-03 09:43:46 -08:00
Daniel Chao
718898d083 Switch to GitHub Actions (#1315)
This switches our builds over to GitHub Actions!

TODO:

* Add macOS/amd64 native-image builds; this isn't working right now
* Patch musl with security patches
* Add benchmark jobs over time

As part of this build, PRBs will now only run `./gradlew check` on Linux,
but other jobs can be run using slash commands, e.g. `[windows]`
to run `./gradle check` on Windows.
2025-12-03 09:43:37 -08:00
Islon Scherer
d33736625e Fix Map formatting (#1312) 2025-12-03 09:43:29 -08:00
Daniel Chao
53dcac56d0 Disable spotless ratcheting of Pkl sources (#1295)
This causes spotless to _always_ format Pkl files, instead of only
formatting them if there's a diff between the file and what's in main.

This means that formatting changes in pkl-formatter will be propagated
to the standard library.
2025-12-03 09:42:41 -08:00
Dan Chao
687ce0f97b Apply spotless formatting 2025-12-03 09:42:30 -08:00
Jen Basch
8c82051a4b Update CLI docs to clarify that --version only applies to the root command (#1326) 2025-11-19 15:34:42 -08:00
Dan Chao
e99d145299 Prepare 0.30.0 release 2025-11-03 10:38:43 -08:00
85 changed files with 6747 additions and 2296 deletions

View File

@@ -1,172 +0,0 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
// File gets rendered to .circleci/config.yml via git hook.
amends "package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.circleci@1.2.1#/PklCI.pkl"
import "jobs/BuildNativeJob.pkl"
import "jobs/DeployJob.pkl"
import "jobs/GradleCheckJob.pkl"
import "jobs/SimpleGradleJob.pkl"
local prbJobs: Listing<String> = gradleCheckJobs.keys.toListing()
local buildAndTestJobs = (prbJobs) {
"bench"
"gradle-compatibility"
...buildNativeJobs.keys.filter((it) -> it.endsWith("snapshot"))
}
local releaseJobs = (prbJobs) {
"bench"
"gradle-compatibility"
...buildNativeJobs.keys.filter((it) -> it.endsWith("release"))
}
prb {
jobs = prbJobs
}
main {
jobs {
...buildAndTestJobs
new {
["deploy-snapshot"] {
requires = buildAndTestJobs
context = "pkl-maven-release"
}
}
}
}
release {
jobs {
...releaseJobs
// do GitHub release first because we can overwrite the tag.
// publishing to Maven Central is final.
new {
["github-release"] {
requires = releaseJobs
context = "pkl-github-release"
}
}
new {
["deploy-release"] {
requires { "github-release" }
context = "pkl-maven-release"
}
}
}
}
releaseBranch {
jobs = releaseJobs
}
triggerDocsBuild = "both"
triggerPackageDocsBuild = "release"
local buildNativeJobs: Mapping<String, BuildNativeJob> = new {
for (_dist in List("release", "snapshot")) {
for (_project in List("pkl-cli", "pkl-doc")) {
for (_arch in List("amd64", "aarch64")) {
for (_os in List("macOS", "linux")) {
["\(_project)-\(_os)-\(_arch)-\(_dist)"] {
arch = _arch
os = _os
isRelease = _dist == "release"
project = _project
}
}
}
["\(_project)-linux-alpine-amd64-\(_dist)"] {
arch = "amd64"
os = "linux"
musl = true
isRelease = _dist == "release"
project = _project
}
["\(_project)-windows-amd64-\(_dist)"] {
arch = "amd64"
os = "windows"
isRelease = _dist == "release"
project = _project
}
}
}
}
local gradleCheckJobs: Mapping<String, GradleCheckJob> = new {
["gradle-check"] {
javaVersion = "21.0"
isRelease = false
os = "linux"
}
["gradle-check-windows"] {
javaVersion = "21.0"
isRelease = false
os = "windows"
}
}
jobs {
for (jobName, job in buildNativeJobs) {
[jobName] = job.job
}
for (jobName, job in gradleCheckJobs) {
[jobName] = job.job
}
["bench"] = new SimpleGradleJob { command = "bench:jmh" }.job
["gradle-compatibility"] =
new SimpleGradleJob {
name = "gradle compatibility"
command =
#"""
:pkl-gradle:build \
:pkl-gradle:compatibilityTestReleases
"""#
}.job
["deploy-snapshot"] = new DeployJob { command = "publishToSonatype" }.job
["deploy-release"] =
new DeployJob {
isRelease = true
command = "publishToSonatype closeAndReleaseSonatypeStagingRepository"
}.job
["github-release"] {
docker {
new { image = "maniator/gh:v2.40.1" }
}
steps {
new AttachWorkspaceStep { at = "." }
new RunStep {
name = "Publish release on GitHub"
command =
#"""
# exclude build_artifacts.txt from publish
rm -f */build/executable/*.build_artifacts.txt
find */build/executable/* -type d | xargs rm -rf
gh release create "${CIRCLE_TAG}" \
--title "${CIRCLE_TAG}" \
--target "${CIRCLE_SHA1}" \
--verify-tag \
--notes "Release notes: https://pkl-lang.org/main/current/release-notes/changelog.html#release-${CIRCLE_TAG}" \
--repo "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" \
*/build/executable/*
"""#
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,202 +0,0 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
/// Builds the native `pkl` CLI
extends "GradleJob.pkl"
import "package://pkg.pkl-lang.org/pkl-pantry/com.circleci.v2@1.7.0#/Config.pkl"
/// The architecture to use
arch: "amd64" | "aarch64"
/// Whether to link to musl. Otherwise, links to glibc.
musl: Boolean = false
/// The Gradle project under which to generate the executable
project: String
javaVersion = "21.0"
extraGradleArgs {
when (os == "macOS" && arch == "amd64") {
"-Dpkl.targetArch=\(arch)"
}
when (musl) {
"-Dpkl.musl=true"
}
}
local setupLinuxEnvironment: Config.RunStep =
let (muslVersion = "1.2.2")
let (zlibVersion = "1.2.13")
new {
name = "Set up environment"
shell = "#!/bin/bash -exo pipefail"
command =
new Listing {
#"""
sed -ie '/\[ol8_codeready_builder\]/,/^$/s/enabled=0/enabled=1/g' /etc/yum.repos.d/oracle-linux-ol8.repo \
&& microdnf -y install util-linux tree coreutils-single findutils curl tar gzip git zlib-devel gcc-c++ make openssl glibc-langpack-en libstdc++-static \
&& microdnf clean all \
&& rm -rf /var/cache/dnf
# install jdk
curl -Lf \
https://github.com/adoptium/temurin\#(module.majorJdkVersion)-binaries/releases/download/\#(module
.jdkGitHubReleaseName)/OpenJDK\#(module.majorJdkVersion)U-jdk_\#(if (arch == "amd64")
"x64"
else
"aarch64")_linux_hotspot_\#(module.jdkVersionAlt).tar.gz -o /tmp/jdk.tar.gz
mkdir /jdk \
&& cd /jdk \
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
mkdir -p ~/staticdeps/bin
cp /usr/lib/gcc/\#(if (arch == "amd64") "x86_64" else "aarch64")-redhat-linux/8/libstdc++.a ~/staticdeps
# install zlib
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
curl -Lf https://github.com/madler/zlib/releases/download/v\#(zlibVersion)/zlib-\#(zlibVersion).tar.gz -o /tmp/zlib.tar.gz
mkdir -p /tmp/dep_zlib-\#(zlibVersion) \
&& cd /tmp/dep_zlib-\#(zlibVersion) \
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
&& echo "zlib-\#(zlibVersion): configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
&& echo "zlib-\#(zlibVersion): make..." && make -s -j4 \
&& echo "zlib-\#(zlibVersion): make install..." && make -s install \
&& rm -rf /tmp/dep_zlib-\#(zlibVersion)
fi
"""#
// don't need musl on aarch because GraalVM only supports musl builds on x86
when (arch == "amd64") {
#"""
# install musl
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
curl -Lf https://musl.libc.org/releases/musl-\#(muslVersion).tar.gz -o /tmp/musl.tar.gz
mkdir -p /tmp/dep_musl-\#(muslVersion) \
&& cd /tmp/dep_musl-\#(muslVersion) \
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
&& echo "musl-\#(muslVersion): configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
&& echo "musl-\#(muslVersion): make..." && make -s -j4 \
&& echo "musl-\#(muslVersion): make install..." && make -s install \
&& rm -rf /tmp/dep_musl-\#(muslVersion)
# native-image expects to find an executable at this path.
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
fi
"""#
}
}.join("\n\n")
}
local setupMacEnvironment: Config.RunStep = new {
name = "Set up environment"
shell = "#!/bin/bash -exo pipefail"
command =
#"""
# install jdk
curl -Lf \
https://github.com/adoptium/temurin\#(module.majorJdkVersion)-binaries/releases/download/\#(module
.jdkGitHubReleaseName)/OpenJDK\#(module.majorJdkVersion)U-jdk_\#(if (arch == "amd64")
"x64"
else
"aarch64")_mac_hotspot_\#(module.jdkVersionAlt).tar.gz -o /tmp/jdk.tar.gz
mkdir $HOME/jdk \
&& cd $HOME/jdk \
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
"""#
}
steps {
when (os == "linux") {
new Config.RestoreCacheStep {
name = "Restore static deps from cache"
key = "staticdeps-\(arch)"
}
setupLinuxEnvironment
new Config.SaveCacheStep {
name = "Save statics deps to cache"
key = "staticdeps-\(arch)"
paths {
"~/staticdeps"
}
}
}
when (os == "macOS") {
when (arch == "amd64") {
new Config.RunStep {
name = "Installing Rosetta 2"
command =
"""
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
"""
}
}
setupMacEnvironment
}
new Config.RunStep {
name = "gradle buildNative"
when (module.os == "windows") {
shell = "bash.exe"
}
command =
#"""
export PATH=~/staticdeps/bin:$PATH
./gradlew \#(module.gradleArgs) \#(project):buildNative
"""#
}
new Config.PersistToWorkspaceStep {
root = "."
paths {
"\(project)/build/executable/"
}
}
}
job {
when (os == "macOS") {
macos {
xcode = "16.4.0"
}
resource_class = "m4pro.large"
environment {
["JAVA_HOME"] = "/Users/distiller/jdk/Contents/Home"
}
}
when (os == "linux") {
docker = new Listing<Config.DockerImage> {
new {
image = if (arch == "aarch64") "arm64v8/oraclelinux:8-slim" else "oraclelinux:8-slim"
}
}
environment {
["JAVA_HOME"] = "/jdk"
}
resource_class = if (arch == "aarch64") "arm.xlarge" else "xlarge"
}
when (os == "windows") {
machine {
image = "windows-server-2022-gui:current"
}
resource_class = "windows.large"
environment {
["JAVA_HOME"] = "/jdk"
}
}
}

View File

@@ -1,43 +0,0 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
extends "GradleJob.pkl"
import "package://pkg.pkl-lang.org/pkl-pantry/com.circleci.v2@1.7.0#/Config.pkl"
local self = this
javaVersion = "21.0"
command: String
os = "linux"
steps {
new Config.AttachWorkspaceStep { at = "." }
new Config.RunStep {
command = "./gradlew \(self.gradleArgs) \(module.command)"
}
// add Java executables to workspace so they get published as a GitHub release
new Config.PersistToWorkspaceStep {
root = "."
paths {
"pkl-cli/build/executable/"
"pkl-doc/build/executable/"
"pkl-codegen-java/build/executable/"
"pkl-codegen-kotlin/build/executable/"
}
}
}

View File

@@ -1,25 +0,0 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
extends "GradleJob.pkl"
import "package://pkg.pkl-lang.org/pkl-pantry/com.circleci.v2@1.7.0#/Config.pkl"
steps {
new Config.RunStep {
name = "gradle check"
command = "./gradlew \(module.gradleArgs) check"
}
}

View File

@@ -1,107 +0,0 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
abstract module GradleJob
import "package://pkg.pkl-lang.org/pkl-pantry/com.circleci.v2@1.7.0#/Config.pkl"
import "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.3#/URI.pkl"
/// Whether this is a release build or not.
isRelease: Boolean = false
/// The OS to run on
os: "macOS" | "linux" | "windows"
/// The version of Java to use.
javaVersion: "17.0" | "21.0"
fixed javaVersionFull = if (javaVersion == "17.0") "17.0.9+9" else "21.0.5+11"
fixed jdkVersionAlt = javaVersionFull.replaceLast("+", "_")
fixed majorJdkVersion = javaVersionFull.split(".").first
fixed jdkGitHubReleaseName =
let (ver =
// 17.0.9+9 is missing some binaries (see https://github.com/adoptium/adoptium-support/issues/994)
if (javaVersionFull == "17.0.9+9" && os == "windows")
"jdk-17.0.9+9.1"
else
"jdk-\(javaVersionFull)"
)
URI.encodeComponent(ver)
fixed gradleArgs =
new Listing {
"--info"
"--stacktrace"
"-DtestReportsDir=${HOME}/test-results"
"-DpklMultiJdkTesting=true"
when (isRelease) {
"-DreleaseBuild=true"
}
...extraGradleArgs
}.join(" ")
extraGradleArgs: Listing<String>
steps: Listing<Config.Step>
job: Config.Job = new {
environment {
["LANG"] = "en_US.UTF-8"
when (os == "windows") {
["JAVA_HOME"] = "/jdk"
}
}
when (os == "linux") {
docker {
new {
image = "cimg/openjdk:\(javaVersion)"
}
}
resource_class = "2xlarge"
}
when (os == "windows") {
machine {
image = "windows-server-2022-gui:current"
}
resource_class = "windows.large"
}
steps {
"checkout"
when (os == "windows") {
new Config.RunStep {
name = "Set up environment"
shell = "bash.exe"
command =
#"""
# install jdk
curl -Lf \
https://github.com/adoptium/temurin\#(majorJdkVersion)-binaries/releases/download/\#(jdkGitHubReleaseName)/OpenJDK\#(majorJdkVersion)U-jdk_x64_windows_hotspot_\#(jdkVersionAlt).zip -o /tmp/jdk.zip
unzip /tmp/jdk.zip -d /tmp/jdk \
&& cd /tmp/jdk/jdk-* \
&& mkdir /jdk \
&& cp -r . /jdk
"""#
}
}
...module.steps
new Config.StoreTestResults {
path = "~/test-results"
}
}
}

View File

@@ -1,36 +0,0 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
extends "GradleJob.pkl"
import "package://pkg.pkl-lang.org/pkl-pantry/com.circleci.v2@1.7.0#/Config.pkl"
name: String = command
command: String
os = "linux"
javaVersion = "21.0"
steps {
new Config.RunStep {
name = module.name
command =
"""
./gradlew \(module.gradleArgs) \(module.command)
"""
}
}

1
.gitattributes vendored
View File

@@ -1,5 +1,6 @@
# linguist-generated would suppress files in diffs
**/src/test/files/** linguist-vendored
.github/workflows/* linguist-generated
/docs/** linguist-documentation

View File

@@ -2,7 +2,7 @@
files=`git diff --cached --name-status`
if [[ $files =~ .circleci/config.pkl ]]; then
pkl eval .circleci/config.pkl -o .circleci/config.yml
git add .circleci/config.yml
if [[ $files =~ .github/* ]]; then
pkl eval --project-dir .github/ -m .github .github/index.pkl
git add .github/workflows/
fi

10
.github/PklProject vendored Normal file
View File

@@ -0,0 +1,10 @@
amends "pkl:Project"
dependencies {
["pkl.impl.ghactions"] {
uri = "package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@0.7.1"
}
["gha"] {
uri = "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.6"
}
}

19
.github/PklProject.deps.json vendored Normal file
View File

@@ -0,0 +1,19 @@
{
"schemaVersion": 1,
"resolvedDependencies": {
"package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0": {
"type": "remote",
"uri": "projectpackage://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.6",
"checksums": {
"sha256": "84365239996740252a91abab084d443aa3a3438f375b667ac16cb765461c1555"
}
},
"package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@0": {
"type": "remote",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@0.7.1",
"checksums": {
"sha256": "f8efc4b174855a2fafdab8ed792de4b0cb89b0516d688c8540eea13af20e0f80"
}
}
}
}

198
.github/index.pkl vendored Normal file
View File

@@ -0,0 +1,198 @@
amends "@pkl.impl.ghactions/PklCI.pkl"
import "@gha/Workflow.pkl"
import "jobs/BuildJavaExecutableJob.pkl"
import "jobs/BuildNativeJob.pkl"
import "jobs/DeployJob.pkl"
import "jobs/GithubRelease.pkl"
import "jobs/GradleJob.pkl"
import "jobs/PklJob.pkl"
import "jobs/SimpleGradleJob.pkl"
triggerDocsBuild = "both"
testReports {
junit {
"**/build/test-results/**/*.xml"
}
html {
"**/build/reports/tests/**/*"
}
excludeJobs {
"bench"
"deploy-release"
"github-release"
}
}
local baseGradleCheck: SimpleGradleJob = new {
isRelease = false
command = "check"
fetchDepth = 0
}
local gradleCheck = (baseGradleCheck) {
os = "linux"
}
local gradleCheckWindows = (baseGradleCheck) {
os = "windows"
}
local typealias PklJobs = Mapping<String, PklJob>
local toWorkflowJobs: (PklJobs) -> Workflow.Jobs = (it) -> new Workflow.Jobs {
for (k, v in it) {
[k] = v.job
}
}
local gradleCheckJobs: PklJobs = new {
["gradle-check"] = gradleCheck
["gradle-check-windows"] = gradleCheckWindows
}
local buildNativeJobs: Mapping<String, BuildNativeJob> = new {
for (_dist in List("release", "snapshot")) {
for (_project in List("pkl-cli", "pkl-doc")) {
for (_arch in List("amd64", "aarch64")) {
for (_os in List("macOS", "linux")) {
["\(_project)-\(_os)-\(_arch)-\(_dist)"] {
arch = _arch
os = _os
isRelease = _dist == "release"
project = _project
}
}
}
["\(_project)-alpine-linux-amd64-\(_dist)"] {
arch = "amd64"
os = "linux"
musl = true
isRelease = _dist == "release"
project = _project
}
["\(_project)-windows-amd64-\(_dist)"] {
arch = "amd64"
os = "windows"
isRelease = _dist == "release"
project = _project
}
}
}
}
local buildNativeSnapshots = buildNativeJobs.toMap().filter((key, _) -> key.endsWith("snapshot"))
local buildNativeReleases = buildNativeJobs.toMap().filter((key, _) -> key.endsWith("release"))
local benchmarkJob: SimpleGradleJob = new { command = "bench:jmh" }
local gradleCompatibilityJob: SimpleGradleJob = new {
command = ":pkl-gradle:build :pkl-gradle:compatibilityTestReleases"
fetchDepth = 0
}
local buildJavaExecutableJob: BuildJavaExecutableJob = new {
fetchDepth = 0
}
local buildAndTestJobs: PklJobs = new {
...gradleCheckJobs
["bench"] = benchmarkJob
["gradle-compatibility"] = gradleCompatibilityJob
["java-executables-snapshot"] = (buildJavaExecutableJob) { isRelease = false }
...buildNativeSnapshots
}
local releaseJobs: PklJobs = new {
...gradleCheckJobs
["bench"] = benchmarkJob
["gradle-compatibility"] = gradleCompatibilityJob
["java-executables-release"] = (buildJavaExecutableJob) { isRelease = true }
...buildNativeReleases
}
// By default, just run ./gradlew check on linux.
// Trigger other checks based on GitHub PR description. Examples:
//
// * [windows] -- Test on Windows
// * [native] -- Test all native builds
// * [native-pkl-cli] -- Test all pkl-cli os/arch pairs
// * [native-pkl-cli-macos] -- Test pkl-cli on macOS
prb {
local prbJobs: Mapping<String, GradleJob> = new {
["gradle-check"] = gradleCheck
["gradle-check-windows"] = (gradleCheckWindows) {
`if` = "contains(github.event.pull_request.body, '[windows]')"
}
for (jobName, job in buildNativeSnapshots) {
[jobName] = (job) {
local tags = new Listing {
"[native]"
"[native-\(job.project)]"
"[native-\(job.project)-\(job.os)]"
"[native-\(job.project)-\(job.os)-\(job.arch)]"
"[native-\(job.project)-\(job.os)-\(job.arch)]"
when (job.musl) {
"[native-\(job.project)-alpine-\(job.os)-\(job.arch)]"
}
}
`if` =
tags
.toList()
.map((it) -> "contains(github.event.pull_request.body, '\(it)')")
.join(" || ")
}
}
}
local prbJobs2 = (prbJobs) {
[[true]] {
// better SLA when not running on nightly
nightlyMacOS = false
}
}
jobs = prbJobs2 |> toWorkflowJobs
}
build {
jobs = buildAndTestJobs |> toWorkflowJobs
}
main {
jobs =
(buildAndTestJobs) {
["deploy-snapshot"] = (
new DeployJob {
extraGradleArgs {
"--no-parallel"
}
command = "publishToSonatype"
}
) {
needs = buildAndTestJobs.keys.toListing()
}
} |> toWorkflowJobs
}
releaseBranch {
jobs = releaseJobs |> toWorkflowJobs
}
release {
jobs =
(releaseJobs) {
["deploy-release"] = (
new DeployJob {
isRelease = true
command = "publishToSonatype closeAndReleaseSonatypeStagingRepository"
}
) {
needs = releaseJobs.keys.toListing()
}
["github-release"] = new GithubRelease {
needs = "deploy-release"
}
} |> toWorkflowJobs
}

33
.github/jobs/BuildJavaExecutableJob.pkl vendored Normal file
View File

@@ -0,0 +1,33 @@
extends "GradleJob.pkl"
import "@gha/actions/Artifact.pkl"
import "@gha/actions/Common.pkl"
// Keep this in sync with projects that build java executables
local projects: List<String> = List("pkl-doc", "pkl-cli", "pkl-codegen-java", "pkl-codegen-kotlin")
local command =
new Listing<String> {
"./gradlew"
module.gradleArgs
for (project in projects) {
// NOTE: `build` doesn't build native executables
"\(project):build"
}
}.join(" ")
steps {
new Common.Checkout {}
new {
name = "gradle build java executables"
shell = "bash"
run = command
}
new Artifact.Upload {
name = "Upload executable artifacts"
with {
name = "executable-java"
path = "*/build/executable/**/*"
}
}
}

47
.github/jobs/BuildNativeJob.pkl vendored Normal file
View File

@@ -0,0 +1,47 @@
extends "GradleJob.pkl"
import "@gha/actions/Artifact.pkl"
import "@gha/Context.pkl"
/// Whether to link to musl. Otherwise, links to glibc.
musl: Boolean(implies(module.os == "linux")) = false
/// The Gradle project under which to generate the executable
project: String
extraGradleArgs {
when (os == "macOS" && arch == "amd64") {
"-Dpkl.targetArch=\(module.arch)"
"-Dpkl.native--native-compiler-path=\(Context.github.workspace)/.github/scripts/cc_macos_amd64.sh"
}
when (musl) {
"-Dpkl.musl=true"
}
}
steps {
when (musl) {
new {
name = "Install musl and zlib"
run = read("../scripts/install_musl.sh").text
}
}
new {
name = "gradle buildNative"
shell = "bash"
run = "./gradlew \(module.gradleArgs) \(project):buildNative"
}
new Artifact.Upload {
name = "Upload executable artifacts"
with {
name =
if (musl)
"executable-\(project)-alpine-\(module.os)-\(module.arch)"
else
"executable-\(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/**/*"
}
}
}

32
.github/jobs/DeployJob.pkl vendored Normal file
View File

@@ -0,0 +1,32 @@
extends "GradleJob.pkl"
import "@gha/actions/Artifact.pkl"
import "@gha/actions/Common.pkl"
import "@gha/Workflow.pkl"
import "@pkl.impl.ghactions/helpers.pkl"
local self = this
command: String
arch = "amd64"
os = "linux"
steps {
new Common.Checkout {}
new Artifact.Download {
with {
pattern = "executable-**"
`merge-multiple` = true
}
}
new Workflow.Step {
run = "./gradlew \(self.gradleArgs) \(module.command)"
}
|> helpers.withMavenPublishSecrets
}
fixed job {
environment = "maven-release"
}

44
.github/jobs/GithubRelease.pkl vendored Normal file
View File

@@ -0,0 +1,44 @@
module GithubRelease
extends "PklJob.pkl"
import "@gha/actions/Artifact.pkl"
import "@gha/Context.pkl"
fixed job {
`runs-on` = "ubuntu-latest"
permissions {
contents = "write"
}
needs = "deploy-release"
steps {
new Artifact.Download {
with {
pattern = "executable-**"
`merge-multiple` = true
}
}
new {
name = "Publish release on GitHub"
env {
["GH_TOKEN"] = Context.github.token
["TAG_NAME"] = Context.github.refName
["GIT_SHA"] = Context.github.sha
["GH_REPO"] = Context.github.repository
}
// language=bash
run =
#"""
# exclude build_artifacts.txt from publish
rm -f */build/executable/*.build_artifacts.txt
find */build/executable/* -type d | xargs rm -rf
gh release create ${TAG_NAME} \
--title "${TAG_NAME}" \
--target "${GIT_SHA}" \
--verify-tag \
--notes "Release notes: https://pkl-lang.org/main/current/release-notes/changelog.html#release-${TAG_NAME}" \
*/build/executable/*
"""#
}
}
}

94
.github/jobs/GradleJob.pkl vendored Normal file
View File

@@ -0,0 +1,94 @@
abstract module GradleJob
extends "PklJob.pkl"
import "@gha/actions/Common.pkl"
import "@gha/actions/Setup.pkl"
import "@gha/Workflow.pkl"
/// Whether this is a release build or not.
isRelease: Boolean = false
/// The architecture to use
arch: "amd64" | "aarch64" = "amd64"
/// The OS to run on.
os: "macOS" | "linux" | "windows" = "linux"
// TODO flip this to `true` when nightly macOS is available
/// Whether to run on nightly macOS.
nightlyMacOS: Boolean(implies(os == "macOS")) = false
extraGradleArgs: Listing<String>
steps: Listing<*Workflow.Step | Workflow.TypedStep>
/// The fetch depth to use when doing a git checkout.
fetchDepth: Int?
fixed gradleArgs =
new Listing {
"--info"
"--stacktrace"
"--no-daemon"
"-DpklMultiJdkTesting=true"
when (isRelease) {
"-DreleaseBuild=true"
}
...extraGradleArgs
}.join(" ")
fixed job {
env {
["LANG"] = "en_US.UTF-8"
when (os == "windows") {
["JAVA_HOME"] = "/jdk"
}
}
when (os == "macOS") {
`if` =
let (cond = "github.repository_owner == 'apple'")
if (super.`if` != null)
"(\(super.`if`)) && \(cond)"
else
cond
}
`runs-on` =
if (os == "linux" && arch == "amd64")
"ubuntu-latest"
else if (os == "linux" && arch == "aarch64")
"ubuntu-24.04-arm"
else if (os == "windows")
"windows-latest"
else
new Listing {
"self-hosted"
"macos"
when (nightlyMacOS) {
"nightly"
}
}
steps {
// full checkout (needed for spotless)
new Common.Checkout {
when (fetchDepth != null) {
with {
`fetch-depth` = fetchDepth
}
}
}
new Setup.Java {
with {
`java-version` = "21"
distribution = "temurin"
cache = "gradle"
architecture =
if (arch == "amd64")
"x64"
else
"aarch64"
}
}
...module.steps
}
}

29
.github/jobs/PklJob.pkl vendored Normal file
View File

@@ -0,0 +1,29 @@
abstract module PklJob
extends "@pkl.impl.ghactions/jobs/PklJob.pkl"
/// Identify any jobs that must complete successfully before this job will run.
///
/// It can be a string or array of strings.
/// If a job fails or is skipped, all jobs that need it are skipped unless the jobs use a conditional expression that
/// causes the job to continue.
/// If a run contains a series of jobs that need each other, a failure or skip applies to all jobs in the dependency
/// chain from the point of failure or skip onwards. If you would like a job to run even if a job it is dependent on
/// did not succeed, use the `always()` conditional expression in `jobs.<job_id>.if`.
///
/// See: <https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idneeds>
needs: (String | *Listing<String>)?
/// A conditional to prevent a job from running unless a condition is met.
///
/// You can use any supported context and expression to create a conditional.
/// For more information on which contexts are supported in this key, see
/// [Contexts reference](https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#context-availability).
@SourceCode { language = "GithubExpressionLanguage" }
`if`: String?
/// The underlying workflow job
fixed job {
`if` = module.`if`
needs = module.needs
}

18
.github/jobs/SimpleGradleJob.pkl vendored Normal file
View File

@@ -0,0 +1,18 @@
extends "GradleJob.pkl"
name: String = command
command: String
os = "linux"
steps {
new {
name = module.name
shell = "bash"
run =
"""
./gradlew \(module.gradleArgs) \(module.command)
"""
}
}

2
.github/scripts/cc_macos_amd64.sh vendored Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
clang -arch x86_64 "$@"

71
.github/scripts/install_musl.sh vendored Normal file
View File

@@ -0,0 +1,71 @@
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"

754
.github/workflows/build.yml generated vendored Normal file
View File

@@ -0,0 +1,754 @@
# Do not modify!
# This file was generated from a template using https://github.com/StefMa/pkl-gha
name: Build
'on':
push:
branches-ignore:
- main
- release/*
tags-ignore:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
gradle-check:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
gradle-check-windows:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check-windows
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check-windows
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
bench:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: bench:jmh
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true bench:jmh
gradle-compatibility:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: :pkl-gradle:build :pkl-gradle:compatibilityTestReleases
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true :pkl-gradle:build :pkl-gradle:compatibilityTestReleases
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-compatibility
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-compatibility
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
java-executables-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- uses: actions/checkout@v5
- name: gradle build java executables
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:build pkl-cli:build pkl-codegen-java:build pkl-codegen-kotlin:build
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-java
path: '*/build/executable/**/*'
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-java-executables-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-java-executables-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-amd64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-aarch64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-aarch64-snapshot:
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-alpine-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-alpine-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-alpine-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-alpine-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-windows-amd64-snapshot:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-windows-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-windows-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-windows-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-amd64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-aarch64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-aarch64-snapshot:
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-alpine-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-alpine-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-alpine-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-alpine-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-windows-amd64-snapshot:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-windows-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-windows-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-windows-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
publish-test-results:
if: '!failure() && !cancelled()'
needs:
- gradle-check
- gradle-check-windows
- gradle-compatibility
- java-executables-snapshot
- pkl-cli-macOS-amd64-snapshot
- pkl-cli-linux-amd64-snapshot
- pkl-cli-macOS-aarch64-snapshot
- pkl-cli-linux-aarch64-snapshot
- pkl-cli-alpine-linux-amd64-snapshot
- pkl-cli-windows-amd64-snapshot
- pkl-doc-macOS-amd64-snapshot
- pkl-doc-linux-amd64-snapshot
- pkl-doc-macOS-aarch64-snapshot
- pkl-doc-linux-aarch64-snapshot
- pkl-doc-alpine-linux-amd64-snapshot
- pkl-doc-windows-amd64-snapshot
permissions:
checks: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
pattern: test-results-xml-*
- name: Publish test results
if: '!cancelled()'
uses: EnricoMi/publish-unit-test-result-action@v2
with:
comment_mode: 'off'
files: test-results-xml-*/**/*.xml
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-publish-test-results
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore

850
.github/workflows/main.yml generated vendored Normal file
View File

@@ -0,0 +1,850 @@
# Do not modify!
# This file was generated from a template using https://github.com/StefMa/pkl-gha
name: Build (main)
'on':
push:
branches:
- main
tags-ignore:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
gradle-check:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
gradle-check-windows:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check-windows
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check-windows
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
bench:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: bench:jmh
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true bench:jmh
gradle-compatibility:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: :pkl-gradle:build :pkl-gradle:compatibilityTestReleases
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true :pkl-gradle:build :pkl-gradle:compatibilityTestReleases
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-compatibility
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-compatibility
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
java-executables-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- uses: actions/checkout@v5
- name: gradle build java executables
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:build pkl-cli:build pkl-codegen-java:build pkl-codegen-kotlin:build
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-java
path: '*/build/executable/**/*'
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-java-executables-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-java-executables-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-amd64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-aarch64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-aarch64-snapshot:
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-alpine-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-alpine-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-alpine-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-alpine-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-windows-amd64-snapshot:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-windows-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-windows-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-windows-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-amd64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-aarch64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-aarch64-snapshot:
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-alpine-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-alpine-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-alpine-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-alpine-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-windows-amd64-snapshot:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-windows-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-windows-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-windows-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
deploy-snapshot:
needs:
- gradle-check
- gradle-check-windows
- bench
- gradle-compatibility
- java-executables-snapshot
- pkl-cli-macOS-amd64-snapshot
- pkl-cli-linux-amd64-snapshot
- pkl-cli-macOS-aarch64-snapshot
- pkl-cli-linux-aarch64-snapshot
- pkl-cli-alpine-linux-amd64-snapshot
- pkl-cli-windows-amd64-snapshot
- pkl-doc-macOS-amd64-snapshot
- pkl-doc-linux-amd64-snapshot
- pkl-doc-macOS-aarch64-snapshot
- pkl-doc-linux-aarch64-snapshot
- pkl-doc-alpine-linux-amd64-snapshot
- pkl-doc-windows-amd64-snapshot
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
environment: maven-release
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- uses: actions/checkout@v5
- uses: actions/download-artifact@v6
with:
pattern: executable-**
merge-multiple: true
- env:
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true --no-parallel publishToSonatype
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-deploy-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-deploy-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
publish-test-results:
if: '!failure() && !cancelled()'
needs:
- gradle-check
- gradle-check-windows
- gradle-compatibility
- java-executables-snapshot
- pkl-cli-macOS-amd64-snapshot
- pkl-cli-linux-amd64-snapshot
- pkl-cli-macOS-aarch64-snapshot
- pkl-cli-linux-aarch64-snapshot
- pkl-cli-alpine-linux-amd64-snapshot
- pkl-cli-windows-amd64-snapshot
- pkl-doc-macOS-amd64-snapshot
- pkl-doc-linux-amd64-snapshot
- pkl-doc-macOS-aarch64-snapshot
- pkl-doc-linux-aarch64-snapshot
- pkl-doc-alpine-linux-amd64-snapshot
- pkl-doc-windows-amd64-snapshot
- deploy-snapshot
permissions:
checks: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
pattern: test-results-xml-*
- name: Publish test results
if: '!cancelled()'
uses: EnricoMi/publish-unit-test-result-action@v2
with:
comment_mode: 'off'
files: test-results-xml-*/**/*.xml
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-publish-test-results
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
trigger-downstream-builds:
if: github.repository_owner == 'apple'
needs:
- gradle-check
- gradle-check-windows
- bench
- gradle-compatibility
- java-executables-snapshot
- pkl-cli-macOS-amd64-snapshot
- pkl-cli-linux-amd64-snapshot
- pkl-cli-macOS-aarch64-snapshot
- pkl-cli-linux-aarch64-snapshot
- pkl-cli-alpine-linux-amd64-snapshot
- pkl-cli-windows-amd64-snapshot
- pkl-doc-macOS-amd64-snapshot
- pkl-doc-linux-amd64-snapshot
- pkl-doc-macOS-aarch64-snapshot
- pkl-doc-linux-aarch64-snapshot
- pkl-doc-alpine-linux-amd64-snapshot
- pkl-doc-windows-amd64-snapshot
- deploy-snapshot
- publish-test-results
runs-on: ubuntu-latest
steps:
- name: Create app token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.PKL_CI_CLIENT_ID }}
private-key: ${{ secrets.PKL_CI }}
owner: ${{ github.repository_owner }}
- name: Trigger pkl-lang.org build
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |-
gh workflow run \
--repo apple/pkl-lang.org \
--ref main \
--field source_run="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
main.yml

689
.github/workflows/prb.yml generated vendored Normal file
View File

@@ -0,0 +1,689 @@
# Do not modify!
# This file was generated from a template using https://github.com/StefMa/pkl-gha
name: Pull Request
'on':
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
gradle-check:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
gradle-check-windows:
if: contains(github.event.pull_request.body, '[windows]')
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check-windows
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check-windows
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-amd64-snapshot:
if: (contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-cli]') || contains(github.event.pull_request.body, '[native-pkl-cli-macOS]') || contains(github.event.pull_request.body, '[native-pkl-cli-macOS-amd64]') || contains(github.event.pull_request.body, '[native-pkl-cli-macOS-amd64]')) && github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-amd64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-amd64-snapshot:
if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-cli]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux-amd64]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux-amd64]')
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-aarch64-snapshot:
if: (contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-cli]') || contains(github.event.pull_request.body, '[native-pkl-cli-macOS]') || contains(github.event.pull_request.body, '[native-pkl-cli-macOS-aarch64]') || contains(github.event.pull_request.body, '[native-pkl-cli-macOS-aarch64]')) && github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-aarch64-snapshot:
if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-cli]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux-aarch64]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux-aarch64]')
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-alpine-linux-amd64-snapshot:
if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-cli]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux-amd64]') || contains(github.event.pull_request.body, '[native-pkl-cli-linux-amd64]') || contains(github.event.pull_request.body, '[native-pkl-cli-alpine-linux-amd64]')
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-alpine-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-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@v5
with:
name: test-results-html-pkl-cli-alpine-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-windows-amd64-snapshot:
if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-cli]') || contains(github.event.pull_request.body, '[native-pkl-cli-windows]') || contains(github.event.pull_request.body, '[native-pkl-cli-windows-amd64]') || contains(github.event.pull_request.body, '[native-pkl-cli-windows-amd64]')
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-windows-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-windows-amd64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-windows-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-amd64-snapshot:
if: (contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-doc]') || contains(github.event.pull_request.body, '[native-pkl-doc-macOS]') || contains(github.event.pull_request.body, '[native-pkl-doc-macOS-amd64]') || contains(github.event.pull_request.body, '[native-pkl-doc-macOS-amd64]')) && github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-amd64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-amd64-snapshot:
if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-doc]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux-amd64]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux-amd64]')
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-aarch64-snapshot:
if: (contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-doc]') || contains(github.event.pull_request.body, '[native-pkl-doc-macOS]') || contains(github.event.pull_request.body, '[native-pkl-doc-macOS-aarch64]') || contains(github.event.pull_request.body, '[native-pkl-doc-macOS-aarch64]')) && github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-aarch64-snapshot:
if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-doc]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux-aarch64]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux-aarch64]')
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-alpine-linux-amd64-snapshot:
if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-doc]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux-amd64]') || contains(github.event.pull_request.body, '[native-pkl-doc-linux-amd64]') || contains(github.event.pull_request.body, '[native-pkl-doc-alpine-linux-amd64]')
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-alpine-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-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@v5
with:
name: test-results-html-pkl-doc-alpine-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-windows-amd64-snapshot:
if: contains(github.event.pull_request.body, '[native]') || contains(github.event.pull_request.body, '[native-pkl-doc]') || contains(github.event.pull_request.body, '[native-pkl-doc-windows]') || contains(github.event.pull_request.body, '[native-pkl-doc-windows-amd64]') || contains(github.event.pull_request.body, '[native-pkl-doc-windows-amd64]')
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-windows-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-windows-amd64-snapshot
path: '**/build/test-results/**/*.xml'
if-no-files-found: ignore
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-windows-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
upload-event-file:
runs-on: ubuntu-latest
steps:
- name: Upload event file
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-event-file
path: ${{ github.event_path }}
check-pkl-github-actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup Pkl
id: setup-pkl
env:
PKL_VERSION: 0.30.0
PKL_FILENAME: pkl
PKL_DOWNLOAD_URL: https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64
shell: bash
run: |-
DIR="$(mktemp -d /tmp/pkl-$PKL_VERSION-XXXXXX)"
PKL_EXEC="$DIR/$PKL_FILENAME"
curl -sfL -o $PKL_EXEC "$PKL_DOWNLOAD_URL"
chmod +x $PKL_EXEC
echo "$DIR" >> "$GITHUB_PATH"
echo "pkl_exec=$PKL_EXEC" >> "$GITHUB_OUTPUT"
- shell: bash
run: pkl eval -m .github/ --project-dir .github/ .github/index.pkl
- name: check git status
shell: bash
run: |-
if [ -n "$(git status --porcelain)" ]; then
echo "Running pkl resulted in a diff! You likely need to run 'pkl eval' and commit the changes."
git diff --name-only
exit 1
fi

792
.github/workflows/release-branch.yml generated vendored Normal file
View File

@@ -0,0 +1,792 @@
# Do not modify!
# This file was generated from a template using https://github.com/StefMa/pkl-gha
name: Build (release branch)
'on':
push:
branches:
- release/*
tags-ignore:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
gradle-check:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
gradle-check-windows:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check-windows
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check-windows
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
bench:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: bench:jmh
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true bench:jmh
gradle-compatibility:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: :pkl-gradle:build :pkl-gradle:compatibilityTestReleases
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true :pkl-gradle:build :pkl-gradle:compatibilityTestReleases
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-compatibility
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-compatibility
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
java-executables-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- uses: actions/checkout@v5
- name: gradle build java executables
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:build pkl-cli:build pkl-codegen-java:build pkl-codegen-kotlin:build
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-java
path: '*/build/executable/**/*'
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-java-executables-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-java-executables-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-amd64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-aarch64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-aarch64-snapshot:
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-alpine-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-alpine-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-alpine-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-alpine-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-windows-amd64-snapshot:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-windows-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-windows-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-windows-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-amd64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-aarch64-snapshot:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-aarch64-snapshot:
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-aarch64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-aarch64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-alpine-linux-amd64-snapshot:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-alpine-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-alpine-linux-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-alpine-linux-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-windows-amd64-snapshot:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-windows-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-windows-amd64-snapshot
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-windows-amd64-snapshot
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
publish-test-results:
if: '!failure() && !cancelled()'
needs:
- gradle-check
- gradle-check-windows
- gradle-compatibility
- java-executables-snapshot
- pkl-cli-macOS-amd64-snapshot
- pkl-cli-linux-amd64-snapshot
- pkl-cli-macOS-aarch64-snapshot
- pkl-cli-linux-aarch64-snapshot
- pkl-cli-alpine-linux-amd64-snapshot
- pkl-cli-windows-amd64-snapshot
- pkl-doc-macOS-amd64-snapshot
- pkl-doc-linux-amd64-snapshot
- pkl-doc-macOS-aarch64-snapshot
- pkl-doc-linux-aarch64-snapshot
- pkl-doc-alpine-linux-amd64-snapshot
- pkl-doc-windows-amd64-snapshot
permissions:
checks: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
pattern: test-results-xml-*
- name: Publish test results
if: '!cancelled()'
uses: EnricoMi/publish-unit-test-result-action@v2
with:
comment_mode: 'off'
files: test-results-xml-*/**/*.xml
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-publish-test-results
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
trigger-downstream-builds:
if: github.repository_owner == 'apple'
needs:
- gradle-check
- gradle-check-windows
- bench
- gradle-compatibility
- java-executables-snapshot
- pkl-cli-macOS-amd64-snapshot
- pkl-cli-linux-amd64-snapshot
- pkl-cli-macOS-aarch64-snapshot
- pkl-cli-linux-aarch64-snapshot
- pkl-cli-alpine-linux-amd64-snapshot
- pkl-cli-windows-amd64-snapshot
- pkl-doc-macOS-amd64-snapshot
- pkl-doc-linux-amd64-snapshot
- pkl-doc-macOS-aarch64-snapshot
- pkl-doc-linux-aarch64-snapshot
- pkl-doc-alpine-linux-amd64-snapshot
- pkl-doc-windows-amd64-snapshot
- publish-test-results
runs-on: ubuntu-latest
steps:
- name: Create app token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.PKL_CI_CLIENT_ID }}
private-key: ${{ secrets.PKL_CI }}
owner: ${{ github.repository_owner }}
- name: Trigger pkl-lang.org build
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |-
gh workflow run \
--repo apple/pkl-lang.org \
--ref main \
--field source_run="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
main.yml

863
.github/workflows/release.yml generated vendored Normal file
View File

@@ -0,0 +1,863 @@
# Do not modify!
# This file was generated from a template using https://github.com/StefMa/pkl-gha
name: Release
'on':
push:
branches-ignore:
- '**'
tags:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
gradle-check:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
gradle-check-windows:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: check
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true check
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-check-windows
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-check-windows
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
bench:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: bench:jmh
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true bench:jmh
gradle-compatibility:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: :pkl-gradle:build :pkl-gradle:compatibilityTestReleases
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true :pkl-gradle:build :pkl-gradle:compatibilityTestReleases
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-gradle-compatibility
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-gradle-compatibility
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
java-executables-release:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- uses: actions/checkout@v5
- name: gradle build java executables
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:build pkl-cli:build pkl-codegen-java:build pkl-codegen-kotlin:build
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-java
path: '*/build/executable/**/*'
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-java-executables-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-java-executables-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-amd64-release:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-amd64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-amd64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-amd64-release:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-amd64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-amd64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-macOS-aarch64-release:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-macOS-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-macOS-aarch64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-macOS-aarch64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-linux-aarch64-release:
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-linux-aarch64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-linux-aarch64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-linux-aarch64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-alpine-linux-amd64-release:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.musl=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-alpine-linux-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-alpine-linux-amd64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-alpine-linux-amd64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-cli-windows-amd64-release:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-cli-windows-amd64
path: pkl-cli*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-cli-windows-amd64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-cli-windows-amd64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-amd64-release:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.targetArch=amd64 -Dpkl.native--native-compiler-path=${{ github.workspace }}/.github/scripts/cc_macos_amd64.sh pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-amd64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-amd64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-amd64-release:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-amd64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-amd64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-macOS-aarch64-release:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-macOS-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-macOS-aarch64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-macOS-aarch64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-linux-aarch64-release:
runs-on: ubuntu-24.04-arm
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: aarch64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-linux-aarch64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-linux-aarch64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-linux-aarch64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-alpine-linux-amd64-release:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- 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 --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.musl=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-alpine-linux-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-alpine-linux-amd64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-alpine-linux-amd64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
pkl-doc-windows-amd64-release:
runs-on: windows-latest
env:
LANG: en_US.UTF-8
JAVA_HOME: /jdk
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- name: gradle buildNative
shell: bash
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative
- name: Upload executable artifacts
uses: actions/upload-artifact@v5
with:
name: executable-pkl-doc-windows-amd64
path: pkl-doc*/build/executable/**/*
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-pkl-doc-windows-amd64-release
path: '**/build/test-results/**/*.xml'
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-pkl-doc-windows-amd64-release
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
deploy-release:
needs:
- gradle-check
- gradle-check-windows
- bench
- gradle-compatibility
- java-executables-release
- pkl-cli-macOS-amd64-release
- pkl-cli-linux-amd64-release
- pkl-cli-macOS-aarch64-release
- pkl-cli-linux-aarch64-release
- pkl-cli-alpine-linux-amd64-release
- pkl-cli-windows-amd64-release
- pkl-doc-macOS-amd64-release
- pkl-doc-linux-amd64-release
- pkl-doc-macOS-aarch64-release
- pkl-doc-linux-aarch64-release
- pkl-doc-alpine-linux-amd64-release
- pkl-doc-windows-amd64-release
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
environment: maven-release
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
architecture: x64
cache: gradle
- uses: actions/checkout@v5
- uses: actions/download-artifact@v6
with:
pattern: executable-**
merge-multiple: true
- env:
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}
run: ./gradlew --info --stacktrace --no-daemon -DpklMultiJdkTesting=true -DreleaseBuild=true publishToSonatype closeAndReleaseSonatypeStagingRepository
github-release:
needs: deploy-release
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
pattern: executable-**
merge-multiple: true
- name: Publish release on GitHub
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ github.ref_name }}
GIT_SHA: ${{ github.sha }}
GH_REPO: ${{ github.repository }}
run: |-
# exclude build_artifacts.txt from publish
rm -f */build/executable/*.build_artifacts.txt
find */build/executable/* -type d | xargs rm -rf
gh release create ${TAG_NAME} \
--title "${TAG_NAME}" \
--target "${GIT_SHA}" \
--verify-tag \
--notes "Release notes: https://pkl-lang.org/main/current/release-notes/changelog.html#release-${TAG_NAME}" \
*/build/executable/*
publish-test-results:
if: '!failure() && !cancelled()'
needs:
- gradle-check
- gradle-check-windows
- gradle-compatibility
- java-executables-release
- pkl-cli-macOS-amd64-release
- pkl-cli-linux-amd64-release
- pkl-cli-macOS-aarch64-release
- pkl-cli-linux-aarch64-release
- pkl-cli-alpine-linux-amd64-release
- pkl-cli-windows-amd64-release
- pkl-doc-macOS-amd64-release
- pkl-doc-linux-amd64-release
- pkl-doc-macOS-aarch64-release
- pkl-doc-linux-aarch64-release
- pkl-doc-alpine-linux-amd64-release
- pkl-doc-windows-amd64-release
permissions:
checks: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
pattern: test-results-xml-*
- name: Publish test results
if: '!cancelled()'
uses: EnricoMi/publish-unit-test-result-action@v2
with:
comment_mode: 'off'
files: test-results-xml-*/**/*.xml
- name: Upload Test Result HTML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-html-publish-test-results
path: '**/build/reports/tests/**/*'
if-no-files-found: ignore
trigger-downstream-builds:
if: github.repository_owner == 'apple'
needs:
- gradle-check
- gradle-check-windows
- bench
- gradle-compatibility
- java-executables-release
- pkl-cli-macOS-amd64-release
- pkl-cli-linux-amd64-release
- pkl-cli-macOS-aarch64-release
- pkl-cli-linux-aarch64-release
- pkl-cli-alpine-linux-amd64-release
- pkl-cli-windows-amd64-release
- pkl-doc-macOS-amd64-release
- pkl-doc-linux-amd64-release
- pkl-doc-macOS-aarch64-release
- pkl-doc-linux-aarch64-release
- pkl-doc-alpine-linux-amd64-release
- pkl-doc-windows-amd64-release
- deploy-release
- github-release
- publish-test-results
runs-on: ubuntu-latest
steps:
- name: Create app token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.PKL_CI_CLIENT_ID }}
private-key: ${{ secrets.PKL_CI }}
owner: ${{ github.repository_owner }}
- name: Trigger pkl-lang.org build
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |-
gh workflow run \
--repo apple/pkl-lang.org \
--ref main \
--field source_run="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
main.yml

36
.github/workflows/test_report.yml generated vendored Normal file
View File

@@ -0,0 +1,36 @@
# Do not modify!
# This file was generated from a template using https://github.com/StefMa/pkl-gha
name: PR Test Reports
'on':
workflow_run:
types:
- completed
workflows:
- Pull Request
permissions:
contents: read
jobs:
test-results:
name: Test Results
if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure'
permissions:
actions: read
checks: write
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: dawidd6/action-download-artifact@v11
with:
path: artifacts
name: test-results-.*
name_is_regex: true
run_id: ${{ github.event.workflow_run.id }}
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
comment_mode: 'off'
files: artifacts/**/*.xml
event_file: artifacts/test-results-event-file/event.json
event_name: ${{ github.event.workflow_run.event }}

View File

@@ -102,7 +102,8 @@ To install:
3. Select the zip file within `pkl-internal-intellij-plugin/build/distributions`.
== Resources
For automated build setup examples see our https://github.com/apple/pkl/blob/main/.circleci/[CircleCI] jobs like our https://github.com/apple/pkl/blob/main/.circleci/jobs/BuildNativeJob.pkl[BuildNativeJob.pkl], where we build Pkl automatically.
For automated build setup examples see our https://github.com/apple/pkl/blob/main/.github/[GitHub Actions] jobs like our https://github.com/apple/pkl/blob/main/.github/jobs/BuildNativeJob.pkl[BuildNativeJob.pkl], where we build Pkl automatically.
=== Truffle

View File

@@ -12,7 +12,7 @@
:uri-installation: https://pkl-lang.org/main/current/pkl-cli/index.html#installation
:uri-lang-reference: https://pkl-lang.org/main/current/language-reference/index.html
:uri-ci-artifacts: https://s01.oss.sonatype.org/content/groups/public/org/pkl-lang/
:uri-ci-pipeline: https://app.circleci.com/pipelines/github/apple/pkl
:uri-ci-pipeline: https://github.com/apple/pkl/actions
A configuration as code language with rich validation and tooling.
@@ -37,7 +37,10 @@ We'd love to hear from you!
* Create an {uri-github-issue}[issue]
* Ask a question on {uri-github-discussions}[GitHub Discussions]
== Development image:https://circleci.com/gh/apple/pkl.svg?style=svg["Apple", link="https://app.circleci.com/pipelines/github/apple/pkl"]
== Development
image:https://github.com/apple/pkl/actions/workflows/main.yml/badge.svg?style=svg["Build (main)", link="https://github.com/apple/pkl/actions/workflows/main.yml"]
* link:CONTRIBUTING.adoc[] for tips on pull requests and filing issues
* link:DEVELOPMENT.adoc[] for build instructions
* {uri-ci-artifacts}[Sonatype Repository] for the artifacts/binaries built by our {uri-ci-pipeline}[CI pipelines] (and those of our other tools and packages repositories).

View File

@@ -355,7 +355,7 @@ open class BuildInfo(private val project: Project) {
}
val hasMuslToolchain: Boolean by lazy {
// see "install musl" in .circleci/jobs/BuildNativeJob.pkl
// see .github/scripts/install_musl.sh
File(System.getProperty("user.home"), "staticdeps/bin/x86_64-linux-musl-gcc").exists()
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,8 +54,8 @@ publishing {
url.set("https://github.com/apple/pkl/issues")
}
ciManagement {
system.set("Circle CI")
url.set("https://app.circleci.com/pipelines/github/apple/pkl")
system.set("GitHub Actions")
url.set("https://github.com/apple/pkl/actions")
}
}
}

View File

@@ -27,6 +27,9 @@ spotless {
rootProject.file("buildSrc/src/main/resources/license-header.line-comment.txt"),
"/// ",
)
// disable ratcheting for Pkl sources
// make any change to pkl-formatter reformat the stdlib
ratchetFrom = null
}
}

View File

@@ -1,6 +1,6 @@
name: main
title: Main Project
version: 0.30.0-dev
prerelease: true
version: 0.30.1
prerelease: false
nav:
- nav.adoc

View File

@@ -3,10 +3,10 @@
// the following attributes must be updated immediately before a release
// pkl version corresponding to current git commit without -dev suffix or git hash
:pkl-version-no-suffix: 0.30.0
:pkl-version-no-suffix: 0.30.1
// tells whether pkl version corresponding to current git commit
// is a release version (:is-release-version: '') or dev version (:!is-release-version:)
:!is-release-version:
:is-release-version: ''
// the remaining attributes do not need to be updated regularly

View File

@@ -788,6 +788,17 @@ The <<command-eval>>, <<command-test>>, <<command-repl>>, <<command-download-pac
include::../../pkl-cli/partials/cli-project-options.adoc[]
[[root-options]]
=== Root options
The root `pkl` command supports the following options:
.-v, --version
[%collapsible]
====
Display version information.
====
== Evaluating Modules
Say we have the following module:

View File

@@ -109,12 +109,6 @@ Duration, in seconds, after which evaluation of a source module will be timed ou
Note that a timeout is treated the same as a program error in that any subsequent source modules will not be evaluated.
====
.-v, --version
[%collapsible]
====
Display version information.
====
.-w, --working-dir
[%collapsible]
====

View File

@@ -1,6 +1,6 @@
= Pkl 0.30 Release Notes
:version: 0.30
:version-minor: 0.30.0
:version-minor: 0.30.1
:release-date: November 3rd, 2025
:yaml-binary-scalar: https://yaml.org/type/binary.html

View File

@@ -1,6 +1,26 @@
= Changelog
include::ROOT:partial$component-attributes.adoc[]
[[release-0.30.1]]
== 0.30.1 (2025-12-03)
=== Fixes
* Fixes formatting of `Map` constructors with line comments (https://github.com/apple/pkl/pull/1312[#1312]).
* Fixes a crash when parsing empty parenthesized types (https://github.com/apple/pkl/pull/1323[#1323]).
* Fixes a parser issue allowing too many newlines between tokens (https://github.com/apple/pkl/pull/1328[#1328]).
* Fixes parsing of URIs with schemes containing `+`, `-`, or `.` (https://github.com/apple/pkl/pull/1335[#1335]).
* Fixes a crash when creating very large `List` instances (https://github.com/apple/pkl/pull/1337[#1337]).
=== Contributors ❤️
Thank you to all the contributors for this release!
* https://github.com/bioball[@bioball]
* https://github.com/HT154[@HT154]
* https://github.com/spyoungtech[@spyoungtech]
* https://github.com/stackoverflow[@stackoverflow]
[[release-0.30.0]]
== 0.30.0 (2025-10-30)

View File

@@ -1,7 +1,7 @@
# suppress inspection "UnusedProperty" for whole file
group=org.pkl-lang
version=0.30.0
version=0.30.1
# google-java-format requires jdk.compiler exports
org.gradle.jvmargs= \

View File

@@ -2,15 +2,15 @@
"catalogs": {},
"aliases": {
"pkl": {
"script-ref": "org.pkl-lang:pkl-cli-java:0.29.1",
"script-ref": "org.pkl-lang:pkl-cli-java:0.30.1",
"java-agents": []
},
"pkl-codegen-java": {
"script-ref": "org.pkl-lang:pkl-codegen-java:0.29.1",
"script-ref": "org.pkl-lang:pkl-codegen-java:0.30.1",
"java-agents": []
},
"pkl-codegen-kotlin": {
"script-ref": "org.pkl-lang:pkl-codegen-kotlin:0.29.1",
"script-ref": "org.pkl-lang:pkl-codegen-kotlin:0.30.1",
"java-agents": []
}
},

View File

@@ -138,8 +138,7 @@ fun Exec.useRootDirAndSuppressOutput() {
}
// 0.28 Preparing for JDK21 toolchains revealed that `testStartJavaExecutable` may pass, even though
// the evaluator fails. To catch this, we need to test the evaluator. We render the CircleCI config
// as a realistic test of the fat JAR.
// the evaluator fails. To catch this, we eval a simple expression using the fat jar.
val testEvalJavaExecutable by
setupJavaExecutableRun("testEvalJavaExecutable", evalTestFlags) { useRootDirAndSuppressOutput() }

View File

@@ -120,6 +120,9 @@ tasks.test {
excludeEngines("AlpineLanguageSnippetTestsEngine")
excludeEngines("WindowsLanguageSnippetTestsEngine")
}
// testing very large lists requires more memory than the default 512m!
maxHeapSize = "1g"
}
val testJavaExecutable by
@@ -135,6 +138,9 @@ val testJavaExecutable by
// executable;
// to verify that we don't want to include them here)
(configurations.testRuntimeClasspath.get() - configurations.runtimeClasspath.get())
// testing very large lists requires more memory than the default 512m!
maxHeapSize = "1g"
}
tasks.check { dependsOn(testJavaExecutable) }

View File

@@ -33,7 +33,7 @@ import org.pkl.parser.syntax.Module;
@TruffleLanguage.Registration(
id = "pkl",
name = "Pkl",
version = "0.30.0-dev",
version = "0.30.1",
characterMimeTypes = VmLanguage.MIME_TYPE,
contextPolicy = ContextPolicy.SHARED)
public final class VmLanguage extends TruffleLanguage<VmContext> {

View File

@@ -19,9 +19,6 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.organicdesign.fp.collections.RrbTree;
import org.organicdesign.fp.collections.RrbTree.ImRrbt;
import org.organicdesign.fp.collections.RrbTree.MutRrbt;
import org.organicdesign.fp.collections.UnmodCollection;
import org.organicdesign.fp.collections.UnmodIterable;
import org.pkl.core.ast.ConstantNode;
@@ -29,6 +26,9 @@ import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.runtime.Iterators.ReverseTruffleIterator;
import org.pkl.core.runtime.Iterators.TruffleIterator;
import org.pkl.core.util.Nullable;
import org.pkl.core.util.paguro.RrbTree;
import org.pkl.core.util.paguro.RrbTree.ImRrbt;
import org.pkl.core.util.paguro.RrbTree.MutRrbt;
// currently the backing collection is realized at the end of each VmList operation
// this trades efficiency for ease of understanding, as it eliminates the complexity

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,13 +22,13 @@ import java.util.function.Consumer;
import org.organicdesign.fp.collections.ImMap;
import org.organicdesign.fp.collections.MutMap;
import org.organicdesign.fp.collections.PersistentHashMap;
import org.organicdesign.fp.collections.RrbTree;
import org.organicdesign.fp.collections.RrbTree.ImRrbt;
import org.organicdesign.fp.collections.RrbTree.MutRrbt;
import org.pkl.core.ast.ConstantNode;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.util.CollectionUtils;
import org.pkl.core.util.Nullable;
import org.pkl.core.util.paguro.RrbTree;
import org.pkl.core.util.paguro.RrbTree.ImRrbt;
import org.pkl.core.util.paguro.RrbTree.MutRrbt;
public final class VmMap extends VmValue implements Iterable<Map.Entry<Object, Object>> {
public static final VmMap EMPTY = new VmMap(PersistentHashMap.empty(), RrbTree.empty());

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,15 +21,15 @@ import java.util.Set;
import org.organicdesign.fp.collections.ImSet;
import org.organicdesign.fp.collections.MutSet;
import org.organicdesign.fp.collections.PersistentHashSet;
import org.organicdesign.fp.collections.RrbTree;
import org.organicdesign.fp.collections.RrbTree.ImRrbt;
import org.organicdesign.fp.collections.RrbTree.MutRrbt;
import org.pkl.core.ast.ConstantNode;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.runtime.Iterators.ReverseTruffleIterator;
import org.pkl.core.runtime.Iterators.TruffleIterator;
import org.pkl.core.util.CollectionUtils;
import org.pkl.core.util.Nullable;
import org.pkl.core.util.paguro.RrbTree;
import org.pkl.core.util.paguro.RrbTree.ImRrbt;
import org.pkl.core.util.paguro.RrbTree.MutRrbt;
public final class VmSet extends VmCollection {
public static final VmSet EMPTY = new VmSet(PersistentHashSet.empty(), RrbTree.empty());

View File

@@ -48,7 +48,7 @@ import org.pkl.core.runtime.VmExceptionBuilder;
public final class IoUtils {
// Don't match paths like `C:\`, which are drive letters on Windows.
private static final Pattern uriLike = Pattern.compile("\\w+:[^\\\\].*");
private static final Pattern uriLike = Pattern.compile("[\\w+.-]+:[^\\\\].*");
private static final Pattern windowsPathLike = Pattern.compile("\\w:\\\\.*");

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
/**
* This package contains source code from:
*
* <p>https://github.com/GlenKPeterson/Paguro
*
* <p>Paguro contains some code that is licensed under the Eclipse Public License 1.0. This code is
* not included in the Pkl source. Only Paguro code licensed under Apache 2.0 is included here.
*
* <p>Original license:
*
* <p>Copyright 2016-05-28 PlanBase Inc. & Glen Peterson
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License.
*
* <p>You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
*
* <p>See the License for the specific language governing permissions and limitations under the
* License.
*/
@NonnullByDefault
package org.pkl.core.util.paguro;
import org.pkl.core.util.NonnullByDefault;

View File

@@ -52,4 +52,10 @@ examples {
new Resource { base64 = "AQIDBA==" }.bytes
}
// test parsing of URIs.
// see https://github.com/apple/pkl/pull/1335
["absolute URI scheme with plus"] {
module.catch(() -> read("foo+bar///?baz=buz"))
}
}

View File

@@ -238,6 +238,7 @@ examples {
List().repeat(1)
List().repeat(5)
module.catch(() -> list1.repeat(-1))
List(0).repeat(118866785).length // triggers an overflow wraparound in original paguro impl
}
["sortWith()"] {

View File

@@ -0,0 +1,5 @@
binop_result: Int = 1
/*comment*/-
/*comment*/ 1

View File

@@ -0,0 +1 @@
foo: Int|()|String = "foo"

View File

@@ -36,4 +36,7 @@ examples {
"AQIDBA=="
Bytes(1, 2, 3, 4)
}
["absolute URI scheme with plus"] {
"Cannot find resource `foo+bar///?baz=buz`."
}
}

View File

@@ -192,6 +192,7 @@ examples {
List()
List()
"Expected a positive number, but got `-1`."
118866785
}
["sortWith()"] {
List()

View File

@@ -0,0 +1,6 @@
Pkl Error
Invalid token at position. Expected a class, typealias, method, or property.
x | /*comment*/-
^
at binopDifferentLine (file:///$snippetsDir/input/errors/binopDifferentLine.pkl)

View File

@@ -0,0 +1,6 @@
Pkl Error
Unexpected token `)`. Expected a type.
x | foo: Int|()|String = "foo"
^
at emptyParenthesizedTypeAnnotation (file:///$snippetsDir/input/errors/emptyParenthesizedTypeAnnotation.pkl)

View File

@@ -69,19 +69,27 @@ publishing {
val testNativeExecutable by
tasks.registering(Test::class) {
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath
inputs.dir("src/test/files/DocGeneratorTest/input")
outputs.dir("src/test/files/DocGeneratorTest/output")
systemProperty("org.pkl.doc.NativeExecutableTest", "true")
include(listOf("**/NativeExecutableTest.class"))
filter { includeTestsMatching("org.pkl.doc.NativeExecutableTest") }
}
val testJavaExecutable by
tasks.registering(Test::class) {
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath
dependsOn(tasks.javaExecutable)
inputs.dir("src/test/files/DocGeneratorTest/input")
outputs.dir("src/test/files/DocGeneratorTest/output")
systemProperty("org.pkl.doc.JavaExecutableTest", "true")
include(listOf("**/JavaExecutableTest.class"))
filter { includeTestsMatching("org.pkl.doc.JavaExecutableTest") }
}
tasks.check { dependsOn(testJavaExecutable) }

View File

@@ -229,9 +229,14 @@ internal class Builder(sourceText: String, private val grammarVersion: GrammarVe
if (children.size == 1) return format(children[0])
val firstNode = node.firstProperChild()!!
return if (firstNode.text() == "Map") {
val nodes = mutableListOf<FormatNode>()
nodes += format(firstNode)
nodes += formatArgumentList(children[1], twoBy2 = true)
val nodes =
formatGenericWithGen(children, null) { node, _ ->
if (node.type == NodeType.ARGUMENT_LIST) {
formatArgumentList(node, twoBy2 = true)
} else {
format(node)
}
}
Nodes(nodes)
} else {
Nodes(formatGeneric(children, null))
@@ -591,7 +596,7 @@ internal class Builder(sourceText: String, private val grammarVersion: GrammarVe
twoBy2: Boolean = false,
): FormatNode {
val children = node.children
val shouldMultiline = shouldMultlineNodes(node) { it.isTerminal(",") }
val shouldMultiline = shouldMultilineNodes(node) { it.isTerminal(",") }
val sep: (Node, Node) -> FormatNode = { _, _ ->
if (shouldMultiline) forceSpaceyLine() else spaceOrLine()
}
@@ -626,7 +631,7 @@ internal class Builder(sourceText: String, private val grammarVersion: GrammarVe
}
}
private fun shouldMultlineNodes(node: Node, predicate: (Node) -> Boolean): Boolean {
private fun shouldMultilineNodes(node: Node, predicate: (Node) -> Boolean): Boolean {
for (idx in 0..<node.children.lastIndex) {
val prev = node.children[idx]
val next = node.children[idx + 1]
@@ -684,13 +689,24 @@ internal class Builder(sourceText: String, private val grammarVersion: GrammarVe
if (node.isTerminal(",")) {
commas++
if (commas == 2) {
val suffixes = mutableListOf<Node>()
while (tmp.isNotEmpty() && tmp.last().type.isAffix) {
// trailing comments should not be paired
suffixes += tmp.removeLast()
}
res += Node(NodeType.ARGUMENT_LIST_ELEMENTS, tmp)
while (suffixes.isNotEmpty()) {
res += suffixes.removeFirst()
}
res += node
commas = 0
tmp = mutableListOf()
} else {
tmp += node
}
} else if (tmp.isEmpty() && node.type.isAffix) {
// leading comments should not be paired
res += node
} else {
tmp += node
}
@@ -1021,7 +1037,7 @@ internal class Builder(sourceText: String, private val grammarVersion: GrammarVe
private fun formatBinaryOpExpr(node: Node): FormatNode {
val flat = flattenBinaryOperatorExprs(node)
val shouldMultiline = shouldMultlineNodes(node) { it.type == NodeType.OPERATOR }
val shouldMultiline = shouldMultilineNodes(node) { it.type == NodeType.OPERATOR }
val nodes =
formatGeneric(flat) { prev, next ->
val sep = if (shouldMultiline) forceSpaceyLine() else spaceOrLine()

View File

@@ -2,3 +2,19 @@
foo = Map(1000, "some random string", 20000, "another random string", 30000, "yet another random string")
incorrect = Map("This has", 1000000, "an incorrect number", 2000000, "of parameters", 30000000, "passed to Map")
bar =
Map(
// leading
1,
2,
// between
3,
4, // trailing
5,
6,
7, // mid
8,
9,
10
)

View File

@@ -12,3 +12,15 @@ incorrect =
"of parameters", 30000000,
"passed to Map",
)
bar =
Map(
// leading
1, 2,
// between
3, 4, // trailing
5, 6,
7, // mid
8,
9, 10,
)

View File

@@ -1393,6 +1393,9 @@ public class Parser {
children.add(ret);
typ = new Type.FunctionType(children, tk.span.endWith(ret.span()));
} else {
if (children.isEmpty()) {
throw new ParserError(ErrorMessages.create("unexpectedTokenForType", ")"), end);
}
typ = new ParenthesizedType((Type) children.get(0), tk.span.endWith(end));
}
}
@@ -1808,11 +1811,13 @@ public class Parser {
private FullToken forceNext() {
var tk = lexer.next();
precededBySemicolon = false;
var newLines = lexer.newLinesBetween;
while (tk.isAffix()) {
precededBySemicolon = precededBySemicolon || tk == Token.SEMICOLON;
tk = lexer.next();
newLines += lexer.newLinesBetween;
}
return new FullToken(tk, lexer.span(), lexer.newLinesBetween);
return new FullToken(tk, lexer.span(), newLines);
}
// Like next, but don't ignore comments

View File

@@ -93,6 +93,7 @@ class ParserComparisonTest {
"stringError1.pkl",
"annotationIsNotExpression2.pkl",
"amendsRequiresParens.pkl",
"errors/binopDifferentLine.pkl",
"errors/parser18.pkl",
"errors/nested1.pkl",
"errors/invalidCharacterEscape.pkl",
@@ -105,6 +106,7 @@ class ParserComparisonTest {
"errors/moduleWithHighMinPklVersionAndParseErrors.pkl",
"errors/underscore.pkl",
"errors/shebang.pkl",
"errors/emptyParenthesizedTypeAnnotation.pkl",
"notAUnionDefault.pkl",
"multipleDefaults.pkl",
"modules/invalidModule1.pkl",

View File

@@ -170,8 +170,8 @@ publishing {
url.set("https://github.com/apple/pkl/issues")
}
ciManagement {
system.set("Circle CI")
url.set("https://app.circleci.com/pipelines/github/apple/pkl")
system.set("GitHub Actions")
url.set("https://github.com/apple/pkl/actions")
}
}
}

View File

@@ -36,7 +36,7 @@
///
/// Warning: Although this module is ready for initial use,
/// benchmark results may be inaccurate or inconsistent.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.Benchmark
import "pkl:platform" as _platform

View File

@@ -63,7 +63,7 @@
/// @Deprecated { message = "Use `com.example.Birds.Parrot` instead" }
/// amends "pkl:PackageInfo"
/// ```
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.DocPackageInfo
// used by doc comments

View File

@@ -31,7 +31,7 @@
///
/// title = "Title displayed in the header of each page"
/// ```
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.DocsiteInfo
import "pkl:reflect"

View File

@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
/// Common settings for Pkl's own evaluator.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
@Since { version = "0.26.0" }
module pkl.EvaluatorSettings

View File

@@ -64,7 +64,7 @@
/// value = project
/// }
/// ```
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.Project
import "pkl:EvaluatorSettings" as EvaluatorSettingsModule

View File

@@ -19,7 +19,7 @@
/// These tools differentiate from [pkl:reflect][reflect] in that they parse Pkl modules, but do not
/// execute any code within these modules.
@Since { version = "0.27.0" }
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.analyze
// used by doc comments

View File

@@ -17,7 +17,7 @@
/// Fundamental properties, methods, and classes for writing Pkl programs.
///
/// Members of this module are automatically available in every Pkl module.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.base
import "pkl:jsonnet"

View File

@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
/// A JSON parser.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.json
/// A JSON parser.

View File

@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
/// A [Jsonnet](https://jsonnet.org) renderer.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.jsonnet
/// Constructs an [ImportStr].

View File

@@ -18,7 +18,7 @@
///
/// Note that some mathematical functions, such as `sign()`, `abs()`, and `round()`,
/// are directly defined in classes [Number], [Int], and [Float].
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.math
/// The minimum [Int] value: `-9223372036854775808`.

View File

@@ -28,7 +28,7 @@
/// The `pkl-binary` format uses MessagePack encoding.
/// Its specification is available at
/// <https://pkl-lang.org/main/current/bindings-specification/binary-encoding.html>.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.pklbinary
/// Render values as `pkl-binary`.

View File

@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
/// Information about the platform that the current program runs on.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.platform
/// The platform that the current program runs on.

View File

@@ -16,7 +16,7 @@
/// A renderer for [Protocol Buffers](https://developers.google.com/protocol-buffers).
/// Note: This module is _experimental_ and not ready for production use.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.protobuf
import "pkl:reflect"

View File

@@ -26,7 +26,7 @@
/// - Documentation generators (such as *Pkldoc*)
/// - Code generators (such as *pkl-codegen-java* and *pkl-codegen-kotlin*)
/// - Domain-specific schema validators
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.reflect
import "pkl:base"

View File

@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
/// Information about the Pkl release that the current program runs on.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.release
import "pkl:semver"

View File

@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
/// Parsing, comparison, and manipulation of [semantic version](https://semver.org/spec/v2.0.0.html) numbers.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.semver
/// Tells whether [version] is a valid semantic version number.
@@ -200,7 +200,8 @@ class Version {
else if (preRelease == other.preRelease)
false
else
let (result =
let (
result =
preReleaseIdentifiers
.zip(other.preReleaseIdentifiers)
.fold(null, (result, next) ->

View File

@@ -19,7 +19,7 @@
/// Every settings file must amend this module.
/// Unless CLI commands and build tool plugins are explicitly configured with a settings file,
/// they will use `~/.pkl/settings.pkl` or the defaults specified in this module.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.settings
import "pkl:EvaluatorSettings"

View File

@@ -15,14 +15,15 @@
//===----------------------------------------------------------------------===//
/// Utilities for generating shell scripts.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.shell
/// Escapes [str] by enclosing it in single quotes.
///
/// Also handles single quotes occurring within [str].
function escapeWithSingleQuotes(str: String): String =
let (processChar = (acc, ch) ->
let (
processChar = (acc, ch) ->
if (acc.isEmpty)
List(List(ch))
else if (acc.last.last != "'" && ch != "'")

View File

@@ -18,7 +18,7 @@
///
/// To write tests, amend this module and define [facts] or [examples] (or both).
/// To run tests, evaluate the amended module.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
open module pkl.test
/// Named groups of boolean expressions that are expected to evaluate to [true].

View File

@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
/// An XML renderer.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.xml
/// Renders values as XML.

View File

@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
/// A YAML 1.2 compliant YAML parser.
@ModuleInfo { minPklVersion = "0.30.0" }
@ModuleInfo { minPklVersion = "0.30.1" }
module pkl.yaml
/// A YAML parser.