mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 19:45:49 +00:00
ci: add Swift example builds on macOS
Auto-discover Swift examples via example/*/Package.swift alongside the existing zig and cmake discovery. The new build-examples-swift job runs on macOS, builds the xcframework with zig build -Demit-lib-vt, then runs swift run in each example directory to verify the xcframework links and functions correctly end-to-end.
This commit is contained in:
48
.github/workflows/test.yml
vendored
48
.github/workflows/test.yml
vendored
@@ -89,6 +89,7 @@ jobs:
|
||||
- build-examples-zig
|
||||
- build-examples-cmake
|
||||
- build-examples-cmake-windows
|
||||
- build-examples-swift
|
||||
- build-cmake
|
||||
- build-flatpak
|
||||
- build-libghostty-vt
|
||||
@@ -181,6 +182,7 @@ jobs:
|
||||
outputs:
|
||||
zig: ${{ steps.list.outputs.zig }}
|
||||
cmake: ${{ steps.list.outputs.cmake }}
|
||||
swift: ${{ steps.list.outputs.swift }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
@@ -193,6 +195,9 @@ jobs:
|
||||
cmake=$(ls example/*/CMakeLists.txt 2>/dev/null | xargs -n1 dirname | xargs -n1 basename | jq -R -s -c 'split("\n") | map(select(. != ""))')
|
||||
echo "$cmake" | jq .
|
||||
echo "cmake=$cmake" >> "$GITHUB_OUTPUT"
|
||||
swift=$(ls example/*/Package.swift 2>/dev/null | xargs -n1 dirname | xargs -n1 basename | jq -R -s -c 'split("\n") | map(select(. != ""))')
|
||||
echo "$swift" | jq .
|
||||
echo "swift=$swift" >> "$GITHUB_OUTPUT"
|
||||
|
||||
build-examples-zig:
|
||||
strategy:
|
||||
@@ -290,6 +295,49 @@ jobs:
|
||||
cmake -B build -DFETCHCONTENT_SOURCE_DIR_GHOSTTY=${{ github.workspace }}
|
||||
cmake --build build
|
||||
|
||||
build-examples-swift:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
dir: ${{ fromJSON(needs.list-examples.outputs.swift) }}
|
||||
name: Example ${{ matrix.dir }}
|
||||
runs-on: namespace-profile-ghostty-macos-tahoe
|
||||
needs: [test, list-examples]
|
||||
env:
|
||||
ZIG_LOCAL_CACHE_DIR: /Users/runner/zig/local-cache
|
||||
ZIG_GLOBAL_CACHE_DIR: /Users/runner/zig/global-cache
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Cache
|
||||
uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2
|
||||
with:
|
||||
cache: |
|
||||
xcode
|
||||
path: |
|
||||
/Users/runner/zig
|
||||
|
||||
# TODO(tahoe): https://github.com/NixOS/nix/issues/13342
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
with:
|
||||
determinate: true
|
||||
- uses: cachix/cachix-action@1eb2ef646ac0255473d23a5907ad7b04ce94065c # v17
|
||||
with:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
|
||||
- name: Xcode Select
|
||||
run: sudo xcode-select -s /Applications/Xcode_26.3.app
|
||||
|
||||
- name: Build XCFramework
|
||||
run: nix develop -c zig build -Demit-lib-vt
|
||||
|
||||
- name: Build and Run Example
|
||||
run: |
|
||||
cd example/${{ matrix.dir }}
|
||||
swift run
|
||||
|
||||
build-cmake:
|
||||
runs-on: namespace-profile-ghostty-sm
|
||||
needs: test
|
||||
|
||||
Reference in New Issue
Block a user