pkl-swift/.circleci/config.yml

294 lines
8.1 KiB
YAML

# Generated from CircleCI.pkl. DO NOT EDIT.
version: '2.1'
orbs:
pr-approval: apple/pr-approval@0.1.0
jobs:
test-pkl-0-25-3:
steps:
- checkout
- run:
command: |-
PKL=$(mktemp /tmp/pkl-0.25.3-XXXXXX)
curl -L "https://github.com/apple/pkl/releases/download/0.25.3/pkl-linux-amd64" > $PKL
chmod +x $PKL
echo "export PKL_EXEC=$PKL" >> $BASH_ENV
name: Downloading pkl-0.25.3
- run:
command: |-
mkdir -p .out/test-results/
swift test -vv --parallel --num-workers 1 --xunit-output .out/test-results/xunit.xml -Xswiftc -warnings-as-errors
name: swift test
- run:
command: make test-snippets
- run:
command: make test-pkl
- run:
command: make generate-fixtures
- store_test_results:
path: .out/test-results/
resource_class: xlarge
docker:
- image: swift:5.9-rhel-ubi9
test-pkl-0-27-2:
steps:
- checkout
- run:
command: |-
PKL=$(mktemp /tmp/pkl-0.27.2-XXXXXX)
curl -L "https://github.com/apple/pkl/releases/download/0.27.2/pkl-linux-amd64" > $PKL
chmod +x $PKL
echo "export PKL_EXEC=$PKL" >> $BASH_ENV
name: Downloading pkl-0.27.2
- run:
command: |-
mkdir -p .out/test-results/
swift test -vv --parallel --num-workers 1 --xunit-output .out/test-results/xunit.xml -Xswiftc -warnings-as-errors
name: swift test
- run:
command: make test-snippets
- run:
command: make test-pkl
- run:
command: make generate-fixtures
- store_test_results:
path: .out/test-results/
resource_class: xlarge
docker:
- image: swift:5.9-rhel-ubi9
pkl-gen-swift-macos:
steps:
- checkout
- run:
command: |-
make pkl-gen-swift-release
mkdir -p out/pkl-gen-swift/
cp $(make pkl-gen-swift-release-output) out/pkl-gen-swift/pkl-gen-swift-macos.bin
name: Build pkl-gen-swift
- persist_to_workspace:
root: '.'
paths:
- out/
resource_class: macos.m1.large.gen1
macos:
xcode: 15.2.0
pkl-gen-swift-linux-aarch64:
steps:
- checkout
- run:
command: |-
make pkl-gen-swift-release
mkdir -p out/pkl-gen-swift/
cp $(make pkl-gen-swift-release-output) out/pkl-gen-swift/pkl-gen-swift-linux-aarch64.bin
name: Build pkl-gen-swift
- persist_to_workspace:
root: '.'
paths:
- out/
resource_class: arm.xlarge
docker:
- image: swift:5.9-rhel-ubi9
pkl-gen-swift-linux-amd64:
steps:
- checkout
- run:
command: |-
make pkl-gen-swift-release
mkdir -p out/pkl-gen-swift/
cp $(make pkl-gen-swift-release-output) out/pkl-gen-swift/pkl-gen-swift-linux-amd64.bin
name: Build pkl-gen-swift
- persist_to_workspace:
root: '.'
paths:
- out/
resource_class: xlarge
docker:
- image: swift:5.9-rhel-ubi9
pkl-package:
steps:
- checkout
- run:
command: |-
PKL=$(mktemp /tmp/pkl-0.27.2-XXXXXX)
curl -L "https://github.com/apple/pkl/releases/download/0.27.2/pkl-linux-amd64" > $PKL
chmod +x $PKL
echo "export PKL_EXEC=$PKL" >> $BASH_ENV
name: Downloading pkl-0.27.2
- run:
command: $PKL_EXEC project package --skip-publish-check --output-path out/pkl-package/ codegen/src/
- persist_to_workspace:
root: '.'
paths:
- out/
docker:
- image: cimg/base:current
do-release:
steps:
- checkout
- attach_workspace:
at: '.'
- run:
command: |-
EXPECTED_VERSION=$(cat VERSION.txt)
if [ "${EXPECTED_VERSION}" != "${CIRCLE_TAG}" ]; then
echo "Mismatching versions!"
echo "VERSION.txt has ${EXPECTED_VERSION}"
echo "Git tag is ${CIRCLE_TAG}"
echo "Update VERSION.txt to match the tag, and re-tag."
exit 1
fi
echo "Creating release for Pkl package"
gh release create "pkl.swift@${CIRCLE_TAG}" \
--title "pkl.swift@${CIRCLE_TAG}" \
--target "${CIRCLE_SHA1}" \
--notes "This holds the release assets for the pkl.swift Pkl package." \
--repo "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" \
out/pkl-package/*
echo "Creating release for Swift library"
gh release create "${CIRCLE_TAG}" \
--title "${CIRCLE_TAG}" \
--target "${CIRCLE_SHA1}" \
--verify-tag \
--notes "Release notes: https://pkl-lang.org/swift/current/CHANGELOG.html#release-${CIRCLE_TAG}" \
--repo "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" \
out/pkl-gen-swift/*
name: Do release
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
- test-pkl-0-25-3:
requires:
- hold
- test-pkl-0-27-2:
requires:
- hold
when:
matches:
value: << pipeline.git.branch >>
pattern: ^pull/\d+(/head)?$
main:
jobs:
- test-pkl-0-25-3
- test-pkl-0-27-2
when:
equal:
- main
- << pipeline.git.branch >>
release:
jobs:
- test-pkl-0-25-3:
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- test-pkl-0-27-2:
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- pkl-package:
requires:
- test-pkl-0-25-3
- test-pkl-0-27-2
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- pkl-gen-swift-macos:
requires:
- test-pkl-0-25-3
- test-pkl-0-27-2
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- pkl-gen-swift-linux-amd64:
requires:
- test-pkl-0-25-3
- test-pkl-0-27-2
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- pkl-gen-swift-linux-aarch64:
requires:
- test-pkl-0-25-3
- test-pkl-0-27-2
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- do-release:
requires:
- pkl-package
- pkl-gen-swift-macos
- pkl-gen-swift-linux-amd64
- pkl-gen-swift-linux-aarch64
context:
- pkl-github-release
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- trigger-package-docs-build:
requires:
- do-release
context:
- pkl-pr-approval
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- trigger-docsite-build:
requires:
- trigger-package-docs-build
context:
- pkl-pr-approval
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/