Skip to content

Fix: Align View, ViewBuilder, ViewModifier, and ModifiedContent with SwiftUI #67

Fix: Align View, ViewBuilder, ViewModifier, and ModifiedContent with SwiftUI

Fix: Align View, ViewBuilder, ViewModifier, and ModifiedContent with SwiftUI #67

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ["*"]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
reference-snapshots:
name: SwiftUI reference snapshots
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Generate stable SwiftUI snapshots
env:
DEVELOPER_DIR: /Applications/Xcode_26.6.app/Contents/Developer
run: |
source scripts/toolchain.env
test "$DEVELOPER_DIR" = "$SWIFTUI_REFERENCE_XCODE_PATH"
test -d "$DEVELOPER_DIR"
API_BUILD_PATH="$RUNNER_TEMP/api-reference-tool"
swift build \
--package-path Tools/APICompatibility \
--build-path "$API_BUILD_PATH" \
-Xswiftc -warnings-as-errors
API_TOOL="$(swift build \
--package-path Tools/APICompatibility \
--build-path "$API_BUILD_PATH" \
--show-bin-path)/TUIkitAPICheck"
SNAPSHOT_OUTPUT="$RUNNER_TEMP/swiftui-reference-snapshots"
mkdir -p "$SNAPSHOT_OUTPUT"
./scripts/generate-swiftui-reference-snapshots.sh \
--tool "$API_TOOL" \
--developer-dir "$DEVELOPER_DIR" \
--output-root "$SNAPSHOT_OUTPUT"
- name: Upload stable SwiftUI snapshots
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: swiftui-reference-snapshots
path: |
${{ runner.temp }}/swiftui-reference-snapshots/snapshots
${{ runner.temp }}/swiftui-reference-snapshots/sources
${{ runner.temp }}/swiftui-reference-snapshots/sources.tsv
${{ runner.temp }}/swiftui-reference-snapshots/snapshot-set.json
if-no-files-found: error
macos:
name: macOS
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Select Swift 6.0.3
run: |
test -d /Applications/Xcode_16.2.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode_16.2.app/Contents/Developer
- name: Run deterministic quality gate
env:
TUIKIT_API_SNAPSHOT_OUTPUT: ${{ runner.temp }}/tuikit-macos-snapshots
run: ./scripts/test-linux.sh macos
- name: Upload macOS API snapshots
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: tuikit-macos-snapshots
path: |
${{ runner.temp }}/tuikit-macos-snapshots/snapshots
${{ runner.temp }}/tuikit-macos-snapshots/sources
if-no-files-found: error
- name: Upload discovered test list
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: discovered-tests
path: .build/quality/test-list.txt
if-no-files-found: error
- name: Archive DocC output
run: tar -czf "$RUNNER_TEMP/docc-output.tar.gz" -C docc-output .
- name: Upload DocC output
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: docc-output
path: ${{ runner.temp }}/docc-output.tar.gz
if-no-files-found: error
linux:
name: Linux
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Run deterministic quality gate
env:
TUIKIT_API_SNAPSHOT_OUTPUT: ${{ runner.temp }}/tuikit-linux-snapshots
run: ./scripts/test-linux.sh linux
- name: Upload Linux API snapshots
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: tuikit-linux-snapshots
path: |
${{ runner.temp }}/tuikit-linux-snapshots/snapshots
${{ runner.temp }}/tuikit-linux-snapshots/sources
if-no-files-found: error
api-compatibility:
name: API compatibility manifest
needs: [reference-snapshots, macos, linux]
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Select Swift 6.0.3
run: |
test -d /Applications/Xcode_16.2.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode_16.2.app/Contents/Developer
- name: Download stable SwiftUI snapshots
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: swiftui-reference-snapshots
path: ${{ runner.temp }}/swiftui-reference-snapshots
- name: Download macOS API snapshots
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: tuikit-macos-snapshots
path: ${{ runner.temp }}/tuikit-macos-snapshots
- name: Download Linux API snapshots
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: tuikit-linux-snapshots
path: ${{ runner.temp }}/tuikit-linux-snapshots
- name: Assemble and verify API inputs
env:
GH_TOKEN: ${{ github.token }}
run: |
API_BUILD_PATH="$RUNNER_TEMP/api-compatibility-tool"
swift build \
--package-path Tools/APICompatibility \
--build-path "$API_BUILD_PATH" \
-Xswiftc -warnings-as-errors
API_TOOL="$(swift build \
--package-path Tools/APICompatibility \
--build-path "$API_BUILD_PATH" \
--show-bin-path)/TUIkitAPICheck"
OUTPUT_ROOT="$RUNNER_TEMP/api-compatibility-inputs"
TUIKIT_OUTPUT="$OUTPUT_ROOT/tuikit"
REFERENCE_OUTPUT="$OUTPUT_ROOT/reference"
mkdir -p \
"$TUIKIT_OUTPUT/sources" \
"$TUIKIT_OUTPUT/snapshots" \
"$REFERENCE_OUTPUT"
cp "$RUNNER_TEMP/tuikit-macos-snapshots/sources/"*.tsv "$TUIKIT_OUTPUT/sources/"
cp "$RUNNER_TEMP/tuikit-linux-snapshots/sources/"*.tsv "$TUIKIT_OUTPUT/sources/"
cp "$RUNNER_TEMP/tuikit-macos-snapshots/snapshots/"*.json "$TUIKIT_OUTPUT/snapshots/"
cp "$RUNNER_TEMP/tuikit-linux-snapshots/snapshots/"*.json "$TUIKIT_OUTPUT/snapshots/"
./scripts/assemble-api-snapshot-set.sh \
--tool "$API_TOOL" \
--name "TUIkit Swift 6.0.3 macOS and Linux" \
--coverage Tools/APICompatibility/Configuration/tuikit-coverage.tsv \
--output-root "$TUIKIT_OUTPUT"
./scripts/verify-compatibility-owner-registry.sh \
--tool "$API_TOOL" \
--registry Tools/APICompatibility/Configuration/owners.json \
--repository phranck/TUIkit \
--gh "$(command -v gh)"
cp -R "$RUNNER_TEMP/swiftui-reference-snapshots/snapshots" "$REFERENCE_OUTPUT/"
cp -R "$RUNNER_TEMP/swiftui-reference-snapshots/sources" "$REFERENCE_OUTPUT/"
cp "$RUNNER_TEMP/swiftui-reference-snapshots/sources.tsv" "$REFERENCE_OUTPUT/"
cp "$RUNNER_TEMP/swiftui-reference-snapshots/snapshot-set.json" "$REFERENCE_OUTPUT/"
./scripts/verify-compatibility-manifest.sh \
--tool "$API_TOOL" \
--policy Tools/APICompatibility/Configuration/review-policy.json \
--owner-registry Tools/APICompatibility/Configuration/owners.json \
--reference-set "$REFERENCE_OUTPUT/snapshot-set.json" \
--tuikit-set "$TUIKIT_OUTPUT/snapshot-set.json" \
--contracts Tools/APICompatibility/Configuration/contracts.json \
--manifest Tools/APICompatibility/Configuration/compatibility-manifest.json
- name: Upload assembled API inputs
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: api-compatibility-inputs
path: ${{ runner.temp }}/api-compatibility-inputs
if-no-files-found: error
update-badge:
name: Update test badge
needs: [macos, linux, api-compatibility]
runs-on: macos-15
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.sha }}
fetch-depth: 0
- name: Verify tested revision is current
id: badge-provenance
env:
TESTED_SHA: ${{ github.sha }}
run: |
git fetch --no-tags origin main
REMOTE_MAIN_SHA="$(git rev-parse origin/main)"
if [[ "$REMOTE_MAIN_SHA" != "$TESTED_SHA" ]]; then
echo "stale=true" >> "$GITHUB_OUTPUT"
echo "Skipping stale badge update for $TESTED_SHA; current main is $REMOTE_MAIN_SHA"
exit 0
fi
echo "stale=false" >> "$GITHUB_OUTPUT"
- name: Download discovered test list
if: steps.badge-provenance.outputs.stale == 'false'
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: discovered-tests
path: .build/quality
- name: Update README test count
if: steps.badge-provenance.outputs.stale == 'false'
id: counts
run: |
./scripts/update-test-count.sh \
--test-list .build/quality/test-list.txt \
--readme README.md
TESTS=$(./scripts/update-test-count.sh \
--count-only \
--test-list .build/quality/test-list.txt)
echo "tests=$TESTS" >> "$GITHUB_OUTPUT"
- name: Commit if changed
if: steps.badge-provenance.outputs.stale == 'false'
run: |
git diff --quiet README.md && echo "No changes" && exit 0
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "Chore: Update test count badge to ${{ steps.counts.outputs.tests }} tests [skip ci]"
if git push origin HEAD:main; then
exit 0
fi
git fetch --no-tags origin main
REMOTE_MAIN_SHA="$(git rev-parse origin/main)"
if [[ "$REMOTE_MAIN_SHA" != "${{ github.sha }}" ]]; then
echo "Skipping badge push because main advanced to $REMOTE_MAIN_SHA"
exit 0
fi
echo "Badge push failed while main still points to $REMOTE_MAIN_SHA" >&2
exit 1
deploy-docs:
name: Deploy DocC
needs: [macos, linux, api-compatibility]
runs-on: macos-15
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Download DocC output
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: docc-output
path: ${{ runner.temp }}/docc-artifact
- name: Extract DocC output
run: |
mkdir -p docc-output
tar -xzf "$RUNNER_TEMP/docc-artifact/docc-output.tar.gz" -C docc-output
- name: Deploy to tuikit-docs
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
with:
deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
external_repository: phranck/tuikit-docs
publish_branch: gh-pages
publish_dir: docc-output
cname: docs.tuikit.dev