Files
pkl/.github/jobs/BuildNativeJob.pkl
T
Daniel Chao 79dd95c4e6 Fix deploy build (#1798)
* Fix issue where the DeployJob and GithubRelease jobs download
  artifacts using a glob that only matches one artifact
* Make NativeImageBuild task only produce outputs as declared by build;
  ensure there's no build_artifacts.txt, sources/ dir, etc.
2026-07-28 20:42:50 +00:00

80 lines
1.9 KiB
Plaintext

extends "GradleJob.pkl"
import "@gha/catalog.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
/// Path pattern for artifact uploads (glob passed to actions/upload-artifact)
buildDir: String = "\(project)*/build/executable/**/*"
local needsCCompiler = project == "libpkl"
extraGradleArgs {
when (musl) {
"-Dpkl.musl=true"
}
}
preSteps {
when (os == "linux" && !musl) {
new {
name = "Install deps"
run =
"dnf install -y git binutils gcc glibc-devel zlib-devel libstdc++-static glibc-langpack-en"
}
}
}
steps {
when (musl) {
new {
name = "Install musl and zlib"
run = read("../scripts/install_musl.sh").text
}
}
// workaround for https://github.com/actions/checkout/issues/1048
when (os == "linux" && !musl) {
new {
name = "Fix git ownership"
// language=bash
run = #"git status || git config --system --add safe.directory "$GITHUB_WORKSPACE""#
}
}
when (needsCCompiler && os == "windows") {
new {
name = "Set up MSVC"
uses = "ilammy/msvc-dev-cmd@v1"
}
}
new {
name = "gradle buildNative"
shell = "bash"
run = "./gradlew \(module.gradleArgs) \(project):buildNative"
}
(catalog.`actions/upload-artifact@v5`) {
name = "Upload built artifacts"
with {
name =
if (musl)
"deploy-artifacts-\(project)-alpine-\(module.os)-\(module.arch)"
else
"deploy-artifacts-\(project)-\(module.os)-\(module.arch)"
// Need to insert a wildcard to make actions/upload-artifact preserve the folder hierarchy.
// See https://github.com/actions/upload-artifact/issues/206
path = module.buildDir
}
}
}
fixed job {
when (os == "linux" && !musl) {
container {
image = "redhat/ubi8:8.10"
}
}
}