Add CI: host tests, consumer smoke test, Embedded Swift check
Three jobs in GitHub Actions: - Build & test on macOS against SDK headers fetched from Panic (cached), with the pkg-config module generated into PKG_CONFIG_PATH. - A consumer smoke test (Scripts/consumer-test.sh) generating a scratch package that depends on play-date, guarding setting propagation. - An Embedded Swift cross-compile for armv7em-none-none-eabi (Scripts/build-embedded.sh) on a swift.org snapshot toolchain — the check that enforces the Embedded Swift subset promise. Verified locally: the full module compiles for the device triple with no violations. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# The SDK is downloaded from Panic (it is not redistributable). Only the
|
||||
# C_API headers are used, so the Linux tarball works on every runner.
|
||||
PLAYDATE_SDK_VERSION: "3.1.1"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Build & test (macOS)
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# The manifest requires Swift 6.4 tools; pick the newest Xcode on the
|
||||
# runner. Adjust if the image's default already suffices.
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: latest
|
||||
|
||||
- name: Cache Playdate SDK
|
||||
id: sdk-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/PlaydateSDK
|
||||
key: playdate-sdk-${{ env.PLAYDATE_SDK_VERSION }}
|
||||
|
||||
- name: Download Playdate SDK headers
|
||||
if: steps.sdk-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
curl -sL "https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-${PLAYDATE_SDK_VERSION}.tar.gz" | tar xz -C "$HOME"
|
||||
mv "$HOME/PlaydateSDK-${PLAYDATE_SDK_VERSION}" "$HOME/PlaydateSDK"
|
||||
test -f "$HOME/PlaydateSDK/C_API/pd_api.h"
|
||||
|
||||
- name: Install pkg-config module
|
||||
run: |
|
||||
PLAYDATE_SDK_PATH="$HOME/PlaydateSDK" Scripts/install-pkgconfig.sh "$HOME/pkgconfig"
|
||||
echo "PKG_CONFIG_PATH=$HOME/pkgconfig" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build
|
||||
run: swift build
|
||||
|
||||
- name: Test
|
||||
run: swift test
|
||||
|
||||
- name: Consumer smoke test
|
||||
run: Scripts/consumer-test.sh
|
||||
|
||||
embedded:
|
||||
name: Embedded Swift cross-compile
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Embedded Swift for bare-metal ARM needs a swift.org development
|
||||
# snapshot; release/Xcode toolchains do not ship that stdlib.
|
||||
- name: Install Swift main snapshot (swiftly)
|
||||
run: |
|
||||
curl -sL "https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz" | tar xz
|
||||
./swiftly init -y --quiet-shell-followup
|
||||
. "$HOME/.local/share/swiftly/env.sh"
|
||||
swiftly install --use main-snapshot
|
||||
echo "$HOME/.local/share/swiftly/bin" >> "$GITHUB_PATH"
|
||||
|
||||
# newlib provides the libc headers pd_api.h includes on bare metal.
|
||||
- name: Install arm-none-eabi headers
|
||||
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libnewlib-arm-none-eabi
|
||||
|
||||
- name: Cache Playdate SDK
|
||||
id: sdk-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/PlaydateSDK
|
||||
key: playdate-sdk-${{ env.PLAYDATE_SDK_VERSION }}
|
||||
|
||||
- name: Download Playdate SDK headers
|
||||
if: steps.sdk-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
curl -sL "https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-${PLAYDATE_SDK_VERSION}.tar.gz" | tar xz -C "$HOME"
|
||||
mv "$HOME/PlaydateSDK-${PLAYDATE_SDK_VERSION}" "$HOME/PlaydateSDK"
|
||||
test -f "$HOME/PlaydateSDK/C_API/pd_api.h"
|
||||
|
||||
- name: Install pkg-config module
|
||||
run: |
|
||||
PLAYDATE_SDK_PATH="$HOME/PlaydateSDK" Scripts/install-pkgconfig.sh "$HOME/pkgconfig"
|
||||
echo "PKG_CONFIG_PATH=$HOME/pkgconfig" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cross-compile for armv7em-none-none-eabi
|
||||
run: Scripts/build-embedded.sh
|
||||
Reference in New Issue
Block a user