mirror of
https://github.com/apple/pkl.git
synced 2026-04-10 10:53:40 +02:00
Initial commit
This commit is contained in:
154
.circleci/config.pkl
Normal file
154
.circleci/config.pkl
Normal file
@@ -0,0 +1,154 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 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 ".../pkl-project-commons/packages/pkl.impl.circleci/PklCI.pkl"
|
||||
|
||||
import "jobs/BuildNativeJob.pkl"
|
||||
import "jobs/GradleCheckJob.pkl"
|
||||
import "jobs/DeployJob.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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
triggerDocsBuild = "both"
|
||||
|
||||
triggerPackageDocsBuild = "release"
|
||||
|
||||
local buildNativeJobs: Mapping<String, BuildNativeJob> = new {
|
||||
for (_dist in List("release", "snapshot")) {
|
||||
for (_arch in List("amd64", "aarch64")) {
|
||||
for (_os in List("macOS", "linux")) {
|
||||
["pkl-cli-\(_os)-\(_arch)-\(_dist)"] {
|
||||
arch = _arch
|
||||
os = _os
|
||||
isRelease = _dist == "release"
|
||||
}
|
||||
}
|
||||
}
|
||||
["pkl-cli-linux-alpine-amd64-\(_dist)"] {
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
musl = true
|
||||
isRelease = _dist == "release"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local gradleCheckJobs: Mapping<String, GradleCheckJob> = new {
|
||||
["gradle-check-jdk11"] {
|
||||
javaVersion = "11.0"
|
||||
isRelease = false
|
||||
}
|
||||
["gradle-check-jdk17"] {
|
||||
javaVersion = "17.0"
|
||||
isRelease = false
|
||||
}
|
||||
}
|
||||
|
||||
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 \
|
||||
:pkl-gradle:compatibilityTestCandidate
|
||||
"""#
|
||||
}.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 = #"""
|
||||
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}" \
|
||||
pkl-cli/build/executable/*
|
||||
"""#
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
870
.circleci/config.yml
Normal file
870
.circleci/config.yml
Normal file
@@ -0,0 +1,870 @@
|
||||
# Generated from CircleCI.pkl. DO NOT EDIT.
|
||||
version: '2.1'
|
||||
orbs:
|
||||
pr-approval: apple/pr-approval@0.1.0
|
||||
jobs:
|
||||
pkl-cli-macOS-amd64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: /usr/sbin/softwareupdate --install-rosetta --agree-to-license
|
||||
name: Installing Rosetta 2
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DreleaseBuild=true pkl-cli:macExecutableAmd64 pkl-core:testMacExecutableAmd64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
resource_class: macos.m1.large.gen1
|
||||
macos:
|
||||
xcode: 15.2.0
|
||||
pkl-cli-linux-amd64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-amd64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
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 -L \
|
||||
https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.20.1_1.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/x86_64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -L https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
|
||||
# install musl
|
||||
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
|
||||
curl -L https://musl.libc.org/releases/musl-1.2.2.tar.gz -o /tmp/musl.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_musl-1.2.2 \
|
||||
&& cd /tmp/dep_musl-1.2.2 \
|
||||
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "musl-1.2.2: configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "musl-1.2.2: make..." && make -s -j4 \
|
||||
&& echo "musl-1.2.2: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_musl-1.2.2
|
||||
|
||||
# native-image expects to find an executable at this path.
|
||||
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-amd64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DreleaseBuild=true pkl-cli:linuxExecutableAmd64 pkl-core:testLinuxExecutableAmd64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: oraclelinux:8-slim
|
||||
pkl-cli-macOS-aarch64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: git apply patches/graalVm23.patch
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DreleaseBuild=true pkl-cli:macExecutableAarch64 pkl-core:testMacExecutableAarch64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
resource_class: macos.m1.large.gen1
|
||||
macos:
|
||||
xcode: 15.2.0
|
||||
pkl-cli-linux-aarch64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-aarch64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
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 -L \
|
||||
https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.20.1_1.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/aarch64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -L https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-aarch64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DreleaseBuild=true pkl-cli:linuxExecutableAarch64 pkl-core:testLinuxExecutableAarch64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: arm.xlarge
|
||||
docker:
|
||||
- image: arm64v8/oraclelinux:8-slim
|
||||
pkl-cli-linux-alpine-amd64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-amd64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
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 -L \
|
||||
https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.20.1_1.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/x86_64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -L https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
|
||||
# install musl
|
||||
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
|
||||
curl -L https://musl.libc.org/releases/musl-1.2.2.tar.gz -o /tmp/musl.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_musl-1.2.2 \
|
||||
&& cd /tmp/dep_musl-1.2.2 \
|
||||
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "musl-1.2.2: configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "musl-1.2.2: make..." && make -s -j4 \
|
||||
&& echo "musl-1.2.2: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_musl-1.2.2
|
||||
|
||||
# native-image expects to find an executable at this path.
|
||||
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-amd64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DreleaseBuild=true pkl-cli:alpineExecutableAmd64 pkl-core:testAlpineExecutableAmd64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: oraclelinux:8-slim
|
||||
pkl-cli-macOS-amd64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: /usr/sbin/softwareupdate --install-rosetta --agree-to-license
|
||||
name: Installing Rosetta 2
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace pkl-cli:macExecutableAmd64 pkl-core:testMacExecutableAmd64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
resource_class: macos.m1.large.gen1
|
||||
macos:
|
||||
xcode: 15.2.0
|
||||
pkl-cli-linux-amd64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-amd64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
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 -L \
|
||||
https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.20.1_1.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/x86_64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -L https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
|
||||
# install musl
|
||||
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
|
||||
curl -L https://musl.libc.org/releases/musl-1.2.2.tar.gz -o /tmp/musl.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_musl-1.2.2 \
|
||||
&& cd /tmp/dep_musl-1.2.2 \
|
||||
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "musl-1.2.2: configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "musl-1.2.2: make..." && make -s -j4 \
|
||||
&& echo "musl-1.2.2: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_musl-1.2.2
|
||||
|
||||
# native-image expects to find an executable at this path.
|
||||
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-amd64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace pkl-cli:linuxExecutableAmd64 pkl-core:testLinuxExecutableAmd64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: oraclelinux:8-slim
|
||||
pkl-cli-macOS-aarch64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: git apply patches/graalVm23.patch
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace pkl-cli:macExecutableAarch64 pkl-core:testMacExecutableAarch64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
resource_class: macos.m1.large.gen1
|
||||
macos:
|
||||
xcode: 15.2.0
|
||||
pkl-cli-linux-aarch64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-aarch64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
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 -L \
|
||||
https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.20.1_1.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/aarch64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -L https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-aarch64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace pkl-cli:linuxExecutableAarch64 pkl-core:testLinuxExecutableAarch64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: arm.xlarge
|
||||
docker:
|
||||
- image: arm64v8/oraclelinux:8-slim
|
||||
pkl-cli-linux-alpine-amd64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-amd64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
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 -L \
|
||||
https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.20.1_1.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/x86_64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -L https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
|
||||
# install musl
|
||||
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
|
||||
curl -L https://musl.libc.org/releases/musl-1.2.2.tar.gz -o /tmp/musl.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_musl-1.2.2 \
|
||||
&& cd /tmp/dep_musl-1.2.2 \
|
||||
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "musl-1.2.2: configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "musl-1.2.2: make..." && make -s -j4 \
|
||||
&& echo "musl-1.2.2: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_musl-1.2.2
|
||||
|
||||
# native-image expects to find an executable at this path.
|
||||
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-amd64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace pkl-cli:alpineExecutableAmd64 pkl-core:testAlpineExecutableAmd64
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: oraclelinux:8-slim
|
||||
gradle-check-jdk11:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: ./gradlew --info --stacktrace check
|
||||
name: gradle check
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
docker:
|
||||
- image: cimg/openjdk:11.0
|
||||
gradle-check-jdk17:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: ./gradlew --info --stacktrace check
|
||||
name: gradle check
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
docker:
|
||||
- image: cimg/openjdk:17.0
|
||||
bench:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: ./gradlew --info --stacktrace bench:jmh
|
||||
name: bench:jmh
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
docker:
|
||||
- image: cimg/openjdk:11.0
|
||||
gradle-compatibility:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: |-
|
||||
./gradlew --info --stacktrace :pkl-gradle:build \
|
||||
:pkl-gradle:compatibilityTestReleases \
|
||||
:pkl-gradle:compatibilityTestCandidate
|
||||
name: gradle compatibility
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
docker:
|
||||
- image: cimg/openjdk:11.0
|
||||
deploy-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: '.'
|
||||
- run:
|
||||
command: ./gradlew --info --stacktrace publishToSonatype
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
docker:
|
||||
- image: cimg/openjdk:11.0
|
||||
deploy-release:
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: '.'
|
||||
- run:
|
||||
command: ./gradlew --info --stacktrace -DreleaseBuild=true publishToSonatype closeAndReleaseSonatypeStagingRepository
|
||||
- run:
|
||||
command: |-
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \;
|
||||
name: Gather test results
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
docker:
|
||||
- image: cimg/openjdk:11.0
|
||||
github-release:
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: '.'
|
||||
- run:
|
||||
command: |-
|
||||
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}" \
|
||||
pkl-cli/build/executable/*
|
||||
name: Publish release on GitHub
|
||||
docker:
|
||||
- image: maniator/gh:v2.40.1
|
||||
trigger-docsite-build:
|
||||
steps:
|
||||
- run:
|
||||
command: |-
|
||||
curl --location \
|
||||
--request POST \
|
||||
--header "Content-Type: application/json" \
|
||||
-u "${CIRCLE_TOKEN}:" \
|
||||
--data '{ "branch": "main" }' \
|
||||
"https://circleci.com/api/v2/project/github/apple/pkl-lang.org/pipeline"
|
||||
name: Triggering docsite build
|
||||
docker:
|
||||
- image: cimg/base:current
|
||||
trigger-package-docs-build:
|
||||
steps:
|
||||
- run:
|
||||
command: |-
|
||||
curl --location \
|
||||
--request POST \
|
||||
--header "Content-Type: application/json" \
|
||||
-u "${CIRCLE_TOKEN}:" \
|
||||
--data '{ "branch": "main" }' \
|
||||
"https://circleci.com/api/v2/project/github/apple/pkl-package-docs/pipeline"
|
||||
name: Triggering docsite build
|
||||
docker:
|
||||
- image: cimg/base:current
|
||||
workflows:
|
||||
prb:
|
||||
jobs:
|
||||
- hold:
|
||||
type: approval
|
||||
- pr-approval/authenticate:
|
||||
context: pkl-pr-approval
|
||||
- gradle-check-jdk11:
|
||||
requires:
|
||||
- hold
|
||||
- pr-approval/authenticate
|
||||
- gradle-check-jdk17:
|
||||
requires:
|
||||
- hold
|
||||
- pr-approval/authenticate
|
||||
when:
|
||||
matches:
|
||||
value: << pipeline.git.branch >>
|
||||
pattern: ^pull/\d+(/head)?$
|
||||
main:
|
||||
jobs:
|
||||
- gradle-check-jdk11
|
||||
- gradle-check-jdk17
|
||||
- bench
|
||||
- pkl-cli-macOS-amd64-snapshot
|
||||
- pkl-cli-linux-amd64-snapshot
|
||||
- pkl-cli-macOS-aarch64-snapshot
|
||||
- pkl-cli-linux-aarch64-snapshot
|
||||
- pkl-cli-linux-alpine-amd64-snapshot
|
||||
- deploy-snapshot:
|
||||
requires:
|
||||
- gradle-check-jdk11
|
||||
- gradle-check-jdk17
|
||||
- bench
|
||||
- pkl-cli-macOS-amd64-snapshot
|
||||
- pkl-cli-linux-amd64-snapshot
|
||||
- pkl-cli-macOS-aarch64-snapshot
|
||||
- pkl-cli-linux-aarch64-snapshot
|
||||
- pkl-cli-linux-alpine-amd64-snapshot
|
||||
context: pkl-maven-release
|
||||
- trigger-docsite-build:
|
||||
requires:
|
||||
- deploy-snapshot
|
||||
context:
|
||||
- pkl-pr-approval
|
||||
when:
|
||||
equal:
|
||||
- main
|
||||
- << pipeline.git.branch >>
|
||||
release:
|
||||
jobs:
|
||||
- gradle-check-jdk11:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- gradle-check-jdk17:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- bench:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-cli-macOS-amd64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-cli-linux-amd64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-cli-macOS-aarch64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-cli-linux-aarch64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-cli-linux-alpine-amd64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- github-release:
|
||||
requires:
|
||||
- gradle-check-jdk11
|
||||
- gradle-check-jdk17
|
||||
- bench
|
||||
- pkl-cli-macOS-amd64-release
|
||||
- pkl-cli-linux-amd64-release
|
||||
- pkl-cli-macOS-aarch64-release
|
||||
- pkl-cli-linux-aarch64-release
|
||||
- pkl-cli-linux-alpine-amd64-release
|
||||
context: pkl-github-release
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- deploy-release:
|
||||
requires:
|
||||
- github-release
|
||||
context: pkl-maven-release
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- trigger-package-docs-build:
|
||||
requires:
|
||||
- deploy-release
|
||||
context:
|
||||
- pkl-pr-approval
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
167
.circleci/jobs/BuildNativeJob.pkl
Normal file
167
.circleci/jobs/BuildNativeJob.pkl
Normal file
@@ -0,0 +1,167 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 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"
|
||||
|
||||
// TODO(oss) replace these with package imports
|
||||
import ".../pkl-pantry/packages/com.circleci.v2/CircleCI.pkl"
|
||||
import ".../pkl-pantry/packages/pkl.experimental.uri/URI.pkl"
|
||||
|
||||
/// The OS to run on
|
||||
os: "macOS"|"linux"
|
||||
|
||||
/// The architecture to use
|
||||
arch: "amd64"|"aarch64"
|
||||
|
||||
/// Whether to link to musl. Otherwise, links to glibc.
|
||||
musl: Boolean = false
|
||||
|
||||
local setupLinuxEnvironment: CircleCI.RunStep =
|
||||
let (jdkVersion = "11.0.20.1+1")
|
||||
let (muslVersion = "1.2.2")
|
||||
let (zlibVersion = "1.2.13")
|
||||
let (jdkVersionEncoded = URI.encodeComponent(jdkVersion))
|
||||
let (jdkVersionAlt = jdkVersion.replaceLast("+", "_"))
|
||||
let (majorJdkVersion = jdkVersion.split(".").first)
|
||||
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 -L \
|
||||
https://github.com/adoptium/temurin\#(majorJdkVersion)-binaries/releases/download/jdk-\#(jdkVersionEncoded)/OpenJDK\#(majorJdkVersion)U-jdk_\#(if (arch == "amd64") "x64" else "aarch64")_linux_hotspot_\#(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 -L 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 -L 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")
|
||||
}
|
||||
|
||||
steps {
|
||||
when (os == "linux") {
|
||||
new CircleCI.RestoreCacheStep {
|
||||
name = "Restore static deps from cache"
|
||||
key = "staticdeps-\(arch)"
|
||||
}
|
||||
setupLinuxEnvironment
|
||||
new CircleCI.SaveCacheStep {
|
||||
name = "Save statics deps to cache"
|
||||
key = "staticdeps-\(arch)"
|
||||
paths {
|
||||
"~/staticdeps"
|
||||
}
|
||||
}
|
||||
}
|
||||
when (os == "macOS" && arch == "amd64") {
|
||||
new CircleCI.RunStep {
|
||||
name = "Installing Rosetta 2"
|
||||
command = """
|
||||
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
|
||||
"""
|
||||
}
|
||||
}
|
||||
// If building macOS/aarch64, we need to use GraalVM 23.
|
||||
// We can't use GraalVM 23 for any other build because we need to support Java 11, which was
|
||||
// dropped in GraalVM 23.
|
||||
when (os == "macOS" && arch == "aarch64") {
|
||||
new CircleCI.RunStep {
|
||||
command = "git apply patches/graalVm23.patch"
|
||||
}
|
||||
}
|
||||
new CircleCI.RunStep {
|
||||
name = "gradle buildNative"
|
||||
local _os =
|
||||
if (os == "macOS") "mac"
|
||||
else if (musl) "alpine"
|
||||
else "linux"
|
||||
local jobName = "\(_os)Executable\(arch.capitalize())"
|
||||
command = #"""
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew \#(module.gradleArgs) pkl-cli:\#(jobName) pkl-core:test\#(jobName.capitalize())
|
||||
"""#
|
||||
}
|
||||
new CircleCI.PersistToWorkspaceStep {
|
||||
root = "."
|
||||
paths {
|
||||
"pkl-cli/build/executable/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
job {
|
||||
when (os == "macOS") {
|
||||
macos {
|
||||
xcode = "15.2.0"
|
||||
}
|
||||
// Use M1 for all architectures. We build amd64/aarch64 based on the GraalVM version,
|
||||
// which gets patched in via `git apply patches/graalVm23.patch`.
|
||||
resource_class = "macos.m1.large.gen1"
|
||||
} else {
|
||||
docker {
|
||||
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"
|
||||
}
|
||||
}
|
||||
35
.circleci/jobs/DeployJob.pkl
Normal file
35
.circleci/jobs/DeployJob.pkl
Normal file
@@ -0,0 +1,35 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 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 ".../pkl-pantry/packages/com.circleci.v2/CircleCI.pkl"
|
||||
|
||||
local self = this
|
||||
|
||||
command: String
|
||||
|
||||
job {
|
||||
docker {
|
||||
new { image = "cimg/openjdk:11.0" }
|
||||
}
|
||||
}
|
||||
|
||||
steps {
|
||||
new CircleCI.AttachWorkspaceStep { at = "." }
|
||||
new CircleCI.RunStep {
|
||||
command = "./gradlew \(self.gradleArgs) \(module.command)"
|
||||
}
|
||||
}
|
||||
35
.circleci/jobs/GradleCheckJob.pkl
Normal file
35
.circleci/jobs/GradleCheckJob.pkl
Normal file
@@ -0,0 +1,35 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 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 ".../pkl-pantry/packages/com.circleci.v2/CircleCI.pkl"
|
||||
|
||||
javaVersion: "11.0"|"17.0"
|
||||
|
||||
steps {
|
||||
new CircleCI.RunStep {
|
||||
name = "gradle check"
|
||||
command = "./gradlew \(module.gradleArgs) check"
|
||||
}
|
||||
}
|
||||
|
||||
job {
|
||||
docker {
|
||||
new {
|
||||
image = "cimg/openjdk:\(javaVersion)"
|
||||
}
|
||||
}
|
||||
}
|
||||
53
.circleci/jobs/GradleJob.pkl
Normal file
53
.circleci/jobs/GradleJob.pkl
Normal file
@@ -0,0 +1,53 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 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 ".../pkl-pantry/packages/com.circleci.v2/CircleCI.pkl"
|
||||
|
||||
/// Whether this is a release build or not.
|
||||
isRelease: Boolean = false
|
||||
|
||||
fixed gradleArgs = new Listing {
|
||||
"--info"
|
||||
"--stacktrace"
|
||||
when (isRelease) {
|
||||
"-DreleaseBuild=true"
|
||||
}
|
||||
}.join(" ")
|
||||
|
||||
steps: Listing<CircleCI.Step>
|
||||
|
||||
job: CircleCI.Job = new {
|
||||
environment {
|
||||
["LANG"] = "en_US.UTF-8"
|
||||
}
|
||||
steps {
|
||||
"checkout"
|
||||
...module.steps
|
||||
new CircleCI.RunStep {
|
||||
// find all test results and write them to the home dir
|
||||
name = "Gather test results"
|
||||
command = """
|
||||
mkdir ~/test-results/
|
||||
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/ \\;
|
||||
"""
|
||||
`when` = "always"
|
||||
}
|
||||
new CircleCI.StoreTestResults {
|
||||
path = "~/test-results"
|
||||
}
|
||||
}
|
||||
}
|
||||
37
.circleci/jobs/SimpleGradleJob.pkl
Normal file
37
.circleci/jobs/SimpleGradleJob.pkl
Normal file
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 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 ".../pkl-pantry/packages/com.circleci.v2/CircleCI.pkl"
|
||||
|
||||
name: String = command
|
||||
|
||||
command: String
|
||||
|
||||
steps {
|
||||
new CircleCI.RunStep {
|
||||
name = module.name
|
||||
command = """
|
||||
./gradlew \(module.gradleArgs) \(module.command)
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
job {
|
||||
docker {
|
||||
new { image = "cimg/openjdk:11.0" }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user