Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 43 additions & 18 deletions .circleci/config.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import "pkl:semver"

local swiftTest = new RunStep {
name = "swift test"
command = """
command =
"""
mkdir -p .out/test-results/
swift test -vv --parallel --num-workers 1 --xunit-output .out/test-results/xunit.xml -Xswiftc -warnings-as-errors
"""
Expand All @@ -33,11 +34,13 @@ local class PklDistribution {
fixed normalizedVersion: String = version.replaceAll(".", "-")

/// The URL to download this distribution
fixed downloadUrl: String = "https://github.com/apple/pkl/releases/download/\(version)/pkl-linux-amd64"
fixed downloadUrl: String =
"https://github.com/apple/pkl/releases/download/\(version)/pkl-linux-amd64"

fixed downloadRunStep: RunStep = new {
name = "Downloading pkl-\(version)"
command = """
command =
"""
PKL=$(mktemp /tmp/pkl-\(version)-XXXXXX)
curl -L "\(downloadUrl)" > $PKL
chmod +x $PKL
Expand All @@ -47,26 +50,28 @@ local class PklDistribution {
}

local pklCurrent: PklDistribution = new {
version = "0.29.0"
version = "0.30.0"
}

local pklDistributions: Listing<PklDistribution> = new {
new { version = "0.25.3" }
pklCurrent
}

local typealias Platform ="iOS Simulator"|"watchOS Simulator"|"tvOS Simulator"|"visionOS Simulator"|"Mac Catalyst"
local typealias Platform =
"iOS Simulator" | "watchOS Simulator" | "tvOS Simulator" | "visionOS Simulator" | "Mac Catalyst"

local class SimulatorRuntime {
name: String
platform: Platform
fixed sdk: String = Map(
"iOS Simulator", "iphonesimulator",
"watchOS Simulator", "watchsimulator",
"tvOS Simulator", "appletvsimulator",
"visionOS Simulator", "xrsimulator",
"Mac Catalyst", "macosx"
)[platform]
fixed sdk: String =
Map(
"iOS Simulator", "iphonesimulator",
"watchOS Simulator", "watchsimulator",
"tvOS Simulator", "appletvsimulator",
"visionOS Simulator", "xrsimulator",
"Mac Catalyst", "macosx"
)[platform]
hidden destination: String = "platform=\(platform),name=\(name)"
settings: Mapping<String, Any> = new {
["ONLY_ACTIVE_ARCH"] = "YES"
Expand Down Expand Up @@ -239,8 +244,8 @@ jobs {
}
}
}
["test-format"] {

["test-format-swift"] {
docker {
new {
image = "swift:6.1-rhel-ubi9"
Expand All @@ -254,6 +259,22 @@ jobs {
}
}

["test-format-pkl"] {
docker {
new {
image = "cimg/base:2024.01"
}
}
steps {
"checkout"
pklCurrent.downloadRunStep
new RunStep {
name = "Check Formatting"
command = "make pkl-format-lint"
}
}
}

["pkl-gen-swift-macos"] {
macos {
xcode = "16.4.0"
Expand All @@ -263,7 +284,8 @@ jobs {
"checkout"
new RunStep {
name = "Build pkl-gen-swift"
command = """
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
Expand All @@ -285,7 +307,8 @@ jobs {
"checkout"
new RunStep {
name = "Build pkl-gen-swift"
command = """
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-\(arch).bin
Expand All @@ -305,7 +328,8 @@ jobs {
pklCurrent.downloadRunStep
new RunStep {
// TODO remove skip-publish-check after initial release
command = #"$PKL_EXEC project package --skip-publish-check --output-path out/pkl-package/ codegen/src/"#
command =
#"$PKL_EXEC project package --skip-publish-check --output-path out/pkl-package/ codegen/src/"#
}
new PersistToWorkspaceStep {
paths {
Expand All @@ -326,7 +350,8 @@ jobs {
new RunStep {
name = "Do release"
// language=bash
command = #"""
command =
#"""
EXPECTED_VERSION=$(cat VERSION.txt)

if [ "${EXPECTED_VERSION}" != "${CIRCLE_TAG}" ]; then
Expand Down
73 changes: 51 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ jobs:
resource_class: xlarge
docker:
- image: swift:6.1-rhel-ubi9
test-pkl-0-29-0:
test-pkl-0-30-0:
steps:
- checkout
- run:
command: |-
PKL=$(mktemp /tmp/pkl-0.29.0-XXXXXX)
curl -L "https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-amd64" > $PKL
PKL=$(mktemp /tmp/pkl-0.30.0-XXXXXX)
curl -L "https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64" > $PKL
chmod +x $PKL
echo "export PKL_EXEC=$PKL" >> $BASH_ENV
name: Downloading pkl-0.29.0
name: Downloading pkl-0.30.0
- run:
command: |-
mkdir -p .out/test-results/
Expand Down Expand Up @@ -120,13 +120,28 @@ jobs:
command: /bin/hawkeye check --fail-if-unknown
docker:
- image: ghcr.io/korandoru/hawkeye
test-format:
test-format-swift:
steps:
- checkout
- run:
command: make swiftformat-lint
docker:
- image: swift:6.1-rhel-ubi9
test-format-pkl:
steps:
- checkout
- run:
command: |-
PKL=$(mktemp /tmp/pkl-0.30.0-XXXXXX)
curl -L "https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64" > $PKL
chmod +x $PKL
echo "export PKL_EXEC=$PKL" >> $BASH_ENV
name: Downloading pkl-0.30.0
- run:
command: make pkl-format-lint
name: Check Formatting
docker:
- image: cimg/base:2024.01
pkl-gen-swift-macos:
steps:
- checkout
Expand Down Expand Up @@ -180,11 +195,11 @@ jobs:
- checkout
- run:
command: |-
PKL=$(mktemp /tmp/pkl-0.29.0-XXXXXX)
curl -L "https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-amd64" > $PKL
PKL=$(mktemp /tmp/pkl-0.30.0-XXXXXX)
curl -L "https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64" > $PKL
chmod +x $PKL
echo "export PKL_EXEC=$PKL" >> $BASH_ENV
name: Downloading pkl-0.29.0
name: Downloading pkl-0.30.0
- run:
command: $PKL_EXEC project package --skip-publish-check --output-path out/pkl-package/ codegen/src/
- persist_to_workspace:
Expand Down Expand Up @@ -265,7 +280,7 @@ workflows:
- test-pkl-0-25-3:
requires:
- hold
- test-pkl-0-29-0:
- test-pkl-0-30-0:
requires:
- hold
- test-ios-simulator:
Expand All @@ -283,7 +298,10 @@ workflows:
- test-license-headers:
requires:
- hold
- test-format:
- test-format-swift:
requires:
- hold
- test-format-pkl:
requires:
- hold
when:
Expand All @@ -293,13 +311,14 @@ workflows:
main:
jobs:
- test-pkl-0-25-3
- test-pkl-0-29-0
- test-pkl-0-30-0
- test-ios-simulator
- test-watchos-simulator
- test-tvos-simulator
- test-mac-catalyst
- test-license-headers
- test-format
- test-format-swift
- test-format-pkl
when:
equal:
- main
Expand All @@ -312,7 +331,7 @@ workflows:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- test-pkl-0-29-0:
- test-pkl-0-30-0:
filters:
branches:
ignore: /.*/
Expand Down Expand Up @@ -348,7 +367,13 @@ workflows:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- test-format:
- test-format-swift:
filters:
branches:
ignore: /.*/
tags:
only: /^v?\d+\.\d+\.\d+$/
- test-format-pkl:
filters:
branches:
ignore: /.*/
Expand All @@ -357,13 +382,14 @@ workflows:
- pkl-package:
requires:
- test-pkl-0-25-3
- test-pkl-0-29-0
- test-pkl-0-30-0
- test-ios-simulator
- test-watchos-simulator
- test-tvos-simulator
- test-mac-catalyst
- test-license-headers
- test-format
- test-format-swift
- test-format-pkl
filters:
branches:
ignore: /.*/
Expand All @@ -372,13 +398,14 @@ workflows:
- pkl-gen-swift-macos:
requires:
- test-pkl-0-25-3
- test-pkl-0-29-0
- test-pkl-0-30-0
- test-ios-simulator
- test-watchos-simulator
- test-tvos-simulator
- test-mac-catalyst
- test-license-headers
- test-format
- test-format-swift
- test-format-pkl
filters:
branches:
ignore: /.*/
Expand All @@ -387,13 +414,14 @@ workflows:
- pkl-gen-swift-linux-amd64:
requires:
- test-pkl-0-25-3
- test-pkl-0-29-0
- test-pkl-0-30-0
- test-ios-simulator
- test-watchos-simulator
- test-tvos-simulator
- test-mac-catalyst
- test-license-headers
- test-format
- test-format-swift
- test-format-pkl
filters:
branches:
ignore: /.*/
Expand All @@ -402,13 +430,14 @@ workflows:
- pkl-gen-swift-linux-aarch64:
requires:
- test-pkl-0-25-3
- test-pkl-0-29-0
- test-pkl-0-30-0
- test-ios-simulator
- test-watchos-simulator
- test-tvos-simulator
- test-mac-catalyst
- test-license-headers
- test-format
- test-format-swift
- test-format-pkl
filters:
branches:
ignore: /.*/
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,10 @@ swiftformat-lint:
license-format: .build/tools/hawkeye
.build/tools/hawkeye format

format: swiftformat license-format
pkl-format:
$(PKL_EXEC) format --grammar-version 1 --write .

pkl-format-lint:
$(PKL_EXEC) format --grammar-version 1 --diff-name-only .

format: swiftformat license-format pkl-format
Comment on lines +126 to +132
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add .PHONY in front of all of these targets

1 change: 0 additions & 1 deletion Tests/PklSwiftTests/Fixtures/AnyType.pkl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class Bird {
species: String
}
Expand Down
3 changes: 1 addition & 2 deletions Tests/PklSwiftTests/Fixtures/Collections.pkl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

res1: List<Int> = List(1, 2, 3)

res2: Listing<Int> = new { 2; 3; 4; }
res2: Listing<Int> = new { 2; 3; 4 }

res3: List<List<Int>> = List(List(1), List(2), List(3))

Expand Down
2 changes: 1 addition & 1 deletion Tests/PklSwiftTests/Fixtures/Collections2.pkl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
res: Bytes = Bytes(1, 2, 3, 255)
res: Bytes = Bytes(1, 2, 3, 255)
2 changes: 1 addition & 1 deletion Tests/PklSwiftTests/Fixtures/ExtendedModule.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ extends "OpenModule.pkl"

foo = "foo"

bar = 10
bar = 10
3 changes: 1 addition & 2 deletions Tests/PklSwiftTests/Fixtures/Imports/UnusedClassDefs.pkl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
typealias ReferencedAlias = String

class ThisClassShouldAlsoGenerate {
}
class ThisClassShouldAlsoGenerate {}
2 changes: 1 addition & 1 deletion Tests/PklSwiftTests/Fixtures/OpenModule.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ open module OpenModule

foo: String

bar: Int
bar: Int
Loading