Skip to content

Fix release deploy pipeline (#90) #2

Fix release deploy pipeline (#90)

Fix release deploy pipeline (#90) #2

Workflow file for this run

# 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:
test-pkl-0-25-3:
name: Test Pkl 0.25.3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup Pkl
id: setup-pkl
env:
PKL_VERSION: 0.25.3
PKL_FILENAME: pkl
PKL_DOWNLOAD_URL: https://github.com/apple/pkl/releases/download/0.25.3/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"
- name: swift test
run: |-
mkdir -p .out/test-results/
swift test -vv --parallel --num-workers 1 --xunit-output .out/test-results/xunit.xml -Xswiftc -warnings-as-errors
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-test-pkl-0-25-3
path: .out/test-results/**/*.xml
container:
image: swift:6.1-rhel-ubi9
test-pkl-0-30-0:
name: Test Pkl 0.30.0
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"
- name: swift test
run: |-
mkdir -p .out/test-results/
swift test -vv --parallel --num-workers 1 --xunit-output .out/test-results/xunit.xml -Xswiftc -warnings-as-errors
- run: git config --global --add safe.directory $(pwd)
- run: make test-snippets
- run: make test-pkl
- run: make generate-fixtures
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-test-pkl-0-30-0
path: .out/test-results/**/*.xml
container:
image: swift:6.1-rhel-ubi9
test-sim-ios-simulator:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
XCODE_VERSION: '26.1'
DEVELOPER_DIR: /Applications/Xcode_26.1.app
steps:
- uses: actions/checkout@v5
- run: brew install gmp libyaml
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- run: gem install xcpretty
- name: xcodebuild test
env:
LC_CTYPE: en_US.UTF-8
run: |-
xcodebuild -scheme pkl-swift-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 17' ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=YES COMPILER_INDEX_STORE_ENABLE=NO test \
| xcpretty --report junit --output .out/test-results/test-sim-ios-simulator.xml
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-test-sim-ios-simulator
path: .out/test-results/**/*.xml
test-sim-watchos-simulator:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
XCODE_VERSION: '26.1'
DEVELOPER_DIR: /Applications/Xcode_26.1.app
steps:
- uses: actions/checkout@v5
- run: brew install gmp libyaml
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- run: gem install xcpretty
- name: xcodebuild test
env:
LC_CTYPE: en_US.UTF-8
run: |-
xcodebuild -scheme pkl-swift-Package -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 11 (42mm)' ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=YES COMPILER_INDEX_STORE_ENABLE=NO test \
| xcpretty --report junit --output .out/test-results/test-sim-watchos-simulator.xml
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-test-sim-watchos-simulator
path: .out/test-results/**/*.xml
test-sim-tvos-simulator:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
XCODE_VERSION: '26.1'
DEVELOPER_DIR: /Applications/Xcode_26.1.app
steps:
- uses: actions/checkout@v5
- run: brew install gmp libyaml
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- run: gem install xcpretty
- name: xcodebuild test
env:
LC_CTYPE: en_US.UTF-8
run: |-
xcodebuild -scheme pkl-swift-Package -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=YES COMPILER_INDEX_STORE_ENABLE=NO test \
| xcpretty --report junit --output .out/test-results/test-sim-tvos-simulator.xml
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-test-sim-tvos-simulator
path: .out/test-results/**/*.xml
test-sim-mac-catalyst:
if: github.repository_owner == 'apple'
runs-on:
- self-hosted
- macos
env:
XCODE_VERSION: '26.1'
DEVELOPER_DIR: /Applications/Xcode_26.1.app
steps:
- uses: actions/checkout@v5
- run: brew install gmp libyaml
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- run: gem install xcpretty
- name: xcodebuild test
env:
LC_CTYPE: en_US.UTF-8
run: |-
xcodebuild -scheme pkl-swift-Package -sdk macosx -destination 'platform=macOS,variant=Mac Catalyst,arch=arm64' ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO ARCH=arm64 VALID_ARCHS=arm64 SUPPORTS_MACCATALYST=YES TARGETED_DEVICE_FAMILY=2 CODE_SIGN_IDENTITY=- test \
| xcpretty --report junit --output .out/test-results/test-sim-mac-catalyst.xml
- name: Upload Test Result XML
if: '!cancelled()'
uses: actions/upload-artifact@v5
with:
name: test-results-xml-test-sim-mac-catalyst
path: .out/test-results/**/*.xml
test-format-license-headers:
name: hawkeye-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- run: hawkeye check --config licenserc.toml --fail-if-unknown
container:
image: ghcr.io/korandoru/hawkeye@sha256:c3ab994c0d81f3d116aabf9afc534e18648e3e90d7525d741c1e99dd8166ec85
test-format-swift:
name: test-format-swift
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: make swiftformat-lint
container:
image: swift:6.1-rhel-ubi9
test-format-pkl:
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"
- run: make pkl-format-lint
build-pkl-package:
needs:
- test-pkl-0-25-3
- test-pkl-0-30-0
- test-sim-ios-simulator
- test-sim-watchos-simulator
- test-sim-tvos-simulator
- test-sim-mac-catalyst
- test-format-license-headers
- test-format-swift
- test-format-pkl
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"
- run: pkl project package --output-path out/pkl-package/ codegen/src/
- uses: actions/upload-artifact@v5
with:
name: pkl-swift-build-artifacts-pkl-package
path: out
build-pkl-gen-swift-macos:
if: github.repository_owner == 'apple'
needs:
- test-pkl-0-25-3
- test-pkl-0-30-0
- test-sim-ios-simulator
- test-sim-watchos-simulator
- test-sim-tvos-simulator
- test-sim-mac-catalyst
- test-format-license-headers
- test-format-swift
- test-format-pkl
runs-on:
- self-hosted
- macos
env:
XCODE_VERSION: '26.1'
DEVELOPER_DIR: /Applications/Xcode_26.1.app
steps:
- uses: actions/checkout@v5
- run: |-
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
- uses: actions/upload-artifact@v5
with:
name: pkl-swift-build-artifacts-pkl-gen-swift-macos
path: out
build-pkl-gen-swift-linux-aarch64:
name: Build pkl-gen-swift linux/aarch64
needs:
- test-pkl-0-25-3
- test-pkl-0-30-0
- test-sim-ios-simulator
- test-sim-watchos-simulator
- test-sim-tvos-simulator
- test-sim-mac-catalyst
- test-format-license-headers
- test-format-swift
- test-format-pkl
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- run: |-
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
- uses: actions/upload-artifact@v5
with:
name: pkl-swift-build-artifacts-pkl-gen-swift-linux-aarch64
path: out
container:
image: swift:6.1-rhel-ubi9
build-pkl-gen-swift-linux-amd64:
name: Build pkl-gen-swift linux/amd64
needs:
- test-pkl-0-25-3
- test-pkl-0-30-0
- test-sim-ios-simulator
- test-sim-watchos-simulator
- test-sim-tvos-simulator
- test-sim-mac-catalyst
- test-format-license-headers
- test-format-swift
- test-format-pkl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: |-
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
- uses: actions/upload-artifact@v5
with:
name: pkl-swift-build-artifacts-pkl-gen-swift-linux-amd64
path: out
container:
image: swift:6.1-rhel-ubi9
deploy-github-release:
needs:
- build-pkl-package
- build-pkl-gen-swift-macos
- build-pkl-gen-swift-linux-aarch64
- build-pkl-gen-swift-linux-amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v6
with:
path: out
pattern: pkl-swift-build-artifacts-*
merge-multiple: true
- env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |-
EXPECTED_VERSION=$(cat VERSION.txt)
if [ "${EXPECTED_VERSION}" != "${{ github.ref_name }}" ]; then
echo "Mismatching versions!"
echo "VERSION.txt has ${EXPECTED_VERSION}"
echo "Git tag is ${{ github.ref_name }}"
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@${{ github.ref_name }}" \
--title "pkl.swift@${{ github.ref_name }}" \
--target "${{ github.sha }}" \
--notes "This holds the release assets for the pkl.swift Pkl package." \
out/pkl-package/*
echo "Creating release for Swift library"
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--target "${{ github.sha }}" \
--verify-tag \
--notes "Release notes: https://pkl-lang.org/swift/current/CHANGELOG.html#release-${{ github.ref_name }}" \
out/pkl-gen-swift/*
publish-test-results:
if: '!failure() && !cancelled()'
needs:
- test-pkl-0-25-3
- test-pkl-0-30-0
- test-sim-ios-simulator
- test-sim-watchos-simulator
- test-sim-tvos-simulator
- test-sim-mac-catalyst
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
trigger-downstream-builds:
if: github.repository_owner == 'apple'
needs:
- test-pkl-0-25-3
- test-pkl-0-30-0
- test-sim-ios-simulator
- test-sim-watchos-simulator
- test-sim-tvos-simulator
- test-sim-mac-catalyst
- test-format-license-headers
- test-format-swift
- test-format-pkl
- build-pkl-package
- build-pkl-gen-swift-macos
- build-pkl-gen-swift-linux-aarch64
- build-pkl-gen-swift-linux-amd64
- deploy-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
- name: Trigger pkl-package-docs build
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |-
gh workflow run \
--repo apple/pkl-package-docs \
--ref main \
--field source_run="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
main.yml