Skip to content

Change frame modifier parameters from Int to Double (fixes #356) (#520) #1085

Change frame modifier parameters from Int to Double (fixes #356) (#520)

Change frame modifier parameters from Int to Double (fixes #356) (#520) #1085

name: Build, test, and docs
on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches-ignore:
- 'gh-pages'
workflow_dispatch:
jobs:
macos:
runs-on: macos-15
steps:
- name: Setup Xcode 16.3 (Swift 6.1)
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: '16.3'
- name: Swift version
run: swift --version
- uses: actions/checkout@v3
- name: Install Dependencies
run: brew install pkg-config gtk4 gtk+3 || echo "This step 'fails' every time but it's just a brew linking error - not important."
- name: Build SwiftCrossUI
run: swift build --target SwiftCrossUI
working-directory: ./Examples
- name: Build AppKitBackend and extract symbol graphs
uses: ./.github/actions/extract-symbol-graphs
with:
target: AppKitBackend
upload: true
working-directory: ./Examples
- name: Test
run: SCUI_TEST_GTK3BACKEND=1 ./Scripts/test.sh
- name: Build other targets and examples
run: |
swift build --target GtkCodeGen && \
cd Examples && \
swift build --target GtkBackend && \
swift build --target Gtk3Backend && \
swift build --target GtkExample && \
# Work around SwiftPM incremental build issue
swift package clean && \
swift build --target CounterExample && \
swift build --target ControlsExample && \
swift build --target RandomNumberGeneratorExample && \
swift build --target WindowingExample && \
swift build --target GreetingGeneratorExample && \
swift build --target NavigationExample && \
swift build --target SplitExample && \
swift build --target StressTestExample && \
swift build --target SpreadsheetExample && \
swift build --target NotesExample && \
swift build --target PathsExample && \
swift build --target WebViewExample && \
swift build --target HoverExample && \
swift build --target AdvancedCustomizationExample
uikit:
runs-on: macos-15
strategy:
matrix:
device-type:
- iPhone
- iPad
- TV
- Vision
steps:
- name: Setup Xcode 16.4 (Swift 6.1.2)
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: '16.4'
- name: Swift version
run: swift --version
- name: Install xcbeautify
run: brew install xcbeautify
- uses: actions/checkout@v3
- name: Build
run: |
set -uxo pipefail
device_type=${{ matrix.device-type }}
set +e
deviceid=$(xcrun simctl list devices $device_type available | grep -v -- -- | tail -n 1 | grep -oE '[0-9A-F\-]{36}')
if [ $? -eq 0 ]; then
(
set -e
buildtarget () {
# Use the same derived data path as DocC compilation so that we don't duplicate work.
xcodebuild -derivedDataPath /tmp/data -skipMacroValidation -scheme "$1" -destination "id=$deviceid" build | xcbeautify --renderer github-actions
}
buildtarget SwiftCrossUI
buildtarget UIKitBackend
cd Examples
buildtarget CounterExample
buildtarget GreetingGeneratorExample
buildtarget NavigationExample
buildtarget StressTestExample
buildtarget NotesExample
buildtarget PathsExample
buildtarget WebViewExample
buildtarget HoverExample
buildtarget AdvancedCustomizationExample
if [ $device_type != TV ]; then
# Slider is not implemented for tvOS
buildtarget ControlsExample
buildtarget RandomNumberGeneratorExample
fi
if [ $device_type = iPad ]; then
# NavigationSplitView is only implemented for iPad
buildtarget SplitExample
fi
)
else
echo "No $device_type simulators found" >&2
false
fi
- name: Extract UIKitBackend symbol graphs
if: ${{ matrix.device-type == 'iPhone' }}
uses: ./.github/actions/extract-symbol-graphs
with:
target: UIKitBackend
upload: true
xcodebuild: true
xcodebuild-device-type: ${{ matrix.device-type }}
uikit-catalyst:
runs-on: macos-15
steps:
- name: Setup Xcode 16.4 (Swift 6.1)
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: '16.4'
- name: Swift version
run: swift --version
- name: Install xcbeautify
run: brew install xcbeautify
- uses: actions/checkout@v3
- name: Build
run: |
set -uxo pipefail
buildtarget () {
# Use the same derived data path as DocC compilation so that we don't duplicate work.
xcodebuild -derivedDataPath /tmp/data -skipMacroValidation -scheme "$1" -destination "variant=Mac Catalyst,arch=arm64,platform=macOS" build | xcbeautify --renderer github-actions
}
buildtarget SwiftCrossUI
buildtarget UIKitBackend
cd Examples
buildtarget CounterExample
buildtarget GreetingGeneratorExample
buildtarget NavigationExample
buildtarget StressTestExample
buildtarget NotesExample
buildtarget PathsExample
buildtarget ControlsExample
buildtarget RandomNumberGeneratorExample
buildtarget WebViewExample
buildtarget HoverExample
buildtarget AdvancedCustomizationExample
buildtarget SplitExample
windows:
runs-on: windows-latest
defaults:
run: # Use powershell because bash is not supported: https://github.com/compnerd/gha-setup-swift/issues/18#issuecomment-1705524890
shell: pwsh
steps:
- name: Setup VS Dev Environment
uses: seanmiddleditch/gha-setup-vsdevenv@v5
- name: Setup
uses: compnerd/gha-setup-swift@v0.3.0
with:
branch: swift-6.1-release
tag: 6.1-RELEASE
- name: Swift version
run: swift --version
- name: Compute vcpkg Triplet
id: triplet
uses: ASzc/change-string-case-action@v5
with:
string: ${{ runner.arch }}-${{ runner.os }}
- uses: actions/checkout@v3
- name: Restore Dependency Cache
id: cache
uses: actions/cache/restore@v3
with:
path: vcpkg_installed
key: vcpkg-${{ steps.triplet.outputs.lowercase }}-${{ hashFiles('vcpkg.json') }}
- name: Apply GNOME-pango checksum fix (issue caused by Anubis)
if: steps.cache.outputs.cache-hit != 'true'
run: |
# This fix is from @Kwizatz: https://github.com/microsoft/vcpkg/issues/47984#issuecomment-3471327762
mkdir C:\vcpkg\downloads
curl -o C:\vcpkg\downloads\GNOME-pango-1.56.1.tar.gz "https://gitlab.gnome.org//GNOME/pango/-/archive/1.56.1/pango-1.56.1.tar.gz"
curl -o C:\vcpkg\downloads\GNOME-gdk-pixbuf-2.42.12.tar.gz "https://gitlab.gnome.org//GNOME/gdk-pixbuf/-/archive/2.42.12/gdk-pixbuf-2.42.12.tar.gz"
curl -o C:\vcpkg\downloads\GNOME-atk-2.38.0.tar.gz "https://gitlab.gnome.org/Archive/atk/-/archive/2.38.0/atk-2.38.0.tar.gz"
curl -o C:\vcpkg\downloads\GNOME-gtk-4.16.3.tar.gz "https://gitlab.gnome.org//GNOME/gtk/-/archive/4.16.3/gtk-4.16.3.tar.gz"
- name: Build and Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
env:
VCPKG_DEFAULT_TRIPLET: ${{ steps.triplet.outputs.lowercase }}
run: vcpkg install
- name: Save Dependency Cache
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: vcpkg_installed
key: vcpkg-${{ steps.triplet.outputs.lowercase }}-${{ hashFiles('vcpkg.json') }}
- name: Build SwiftCrossUI
env:
PKG_CONFIG_PATH: ${{ github.workspace }}/vcpkg_installed/${{ steps.triplet.outputs.lowercase }}/lib/pkgconfig
run: swift build --target SwiftCrossUI -v
- name: Build WinUIBackend and extract symbol graphs
uses: ./.github/actions/extract-symbol-graphs
with:
target: WinUIBackend
upload: true
linux:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
runs-on: ${{ matrix.os }}
steps:
# The Ubuntu image comes with Swift, but it's installed as root and DocC
# doesn't like that, so we install our own copy as a user.
# Related issue: https://github.com/swiftlang/swift-docc/issues/1136
- name: Install Swift
uses: SwiftyLab/setup-swift@latest
with:
swift-version: "6.1.0"
- name: Swift version
run: swift --version
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt update && \
# Gtk 3/4 dependencies
sudo apt install -y libgtk-4-dev libgtk-3-dev clang && \
# Headless testing dependencies
sudo apt-get install -y xvfb x11-xserver-utils
- name: Build GtkCodeGen
run: swift build --target GtkCodeGen
- name: Build SwiftCrossUI
run: swift build --target SwiftCrossUI
working-directory: ./Examples
- name: Build GtkBackend and extract symbol graphs
if: ${{ matrix.os == 'ubuntu-24.04' }}
uses: ./.github/actions/extract-symbol-graphs
with:
target: GtkBackend
upload: true
working-directory: ./Examples
- name: Build GtkBackend
if: ${{ matrix.os != 'ubuntu-24.04' }}
run: swift build --target GtkBackend
working-directory: ./Examples
- name: Build Gtk3Backend and extract symbol graphs
if: ${{ matrix.os == 'ubuntu-24.04' }}
uses: ./.github/actions/extract-symbol-graphs
with:
target: Gtk3Backend
upload: true
working-directory: ./Examples
- name: Build Gtk3Backend
if: ${{ matrix.os != 'ubuntu-24.04' }}
run: swift build --target Gtk3Backend
working-directory: ./Examples
- name: Test
# Use xvfb to get a virtual x11 context for the Gtk3Backend tests
run: SCUI_TEST_GTK3BACKEND=1 xvfb-run --auto-servernum ./Scripts/test.sh
- name: Build examples
working-directory: ./Examples
run: |
swift build --target GtkExample && \
# Work around SwiftPM incremental build issue
swift package clean && \
swift build --target CounterExample && \
swift build --target ControlsExample && \
swift build --target RandomNumberGeneratorExample && \
swift build --target WindowingExample && \
swift build --target GreetingGeneratorExample && \
swift build --target NavigationExample && \
swift build --target SplitExample && \
swift build --target StressTestExample && \
swift build --target SpreadsheetExample && \
swift build --target NotesExample && \
swift build --target PathsExample && \
swift build --target HoverExample && \
swift build --target AdvancedCustomizationExample
assemble-docs:
runs-on: macos-15
needs: [macos, uikit, windows, linux]
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
steps:
- name: Setup Xcode version
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
# Contains Swift 6.1. We need a recent DocC to have access to '--output-path'
# in the 'docc merge' command
xcode-version: '16.3'
- uses: actions/checkout@v3
- name: Swift Version
run: swift --version
- name: Compile SwiftCrossUI docs
uses: ./.github/actions/compile-docs
with:
target: SwiftCrossUI
use-swiftpm: true
- name: Compile AppKitBackend docs
uses: ./.github/actions/compile-docs
with:
target: AppKitBackend
use-symbol-graph-artifact: true
- name: Compile UIKitBackend docs
uses: ./.github/actions/compile-docs
with:
target: UIKitBackend
use-symbol-graph-artifact: true
- name: Compile GtkBackend docs
uses: ./.github/actions/compile-docs
with:
target: GtkBackend
use-symbol-graph-artifact: true
- name: Compile Gtk3Backend docs
uses: ./.github/actions/compile-docs
with:
target: Gtk3Backend
use-symbol-graph-artifact: true
- name: Compile WinUIBackend docs
uses: ./.github/actions/compile-docs
with:
target: WinUIBackend
use-symbol-graph-artifact: true
- name: Merge DocC archives
run: |
mkdir DocsBuild
xcrun docc merge \
SwiftCrossUI.doccarchive \
AppKitBackend.doccarchive \
UIKitBackend.doccarchive \
GtkBackend.doccarchive \
Gtk3Backend.doccarchive \
WinUIBackend.doccarchive \
--output-path DocsBuild
- name: Assemble GitHub Pages artifact
run: |
set -eux
cp Pages/google5d79e0866e2627dd.html DocsBuild/google5d79e0866e2627dd.html
cp Pages/CNAME DocsBuild/CNAME
cp Pages/index.html DocsBuild/index.html
- name: Upload GitHub Pages artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: DocsBuild/
deploy-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
needs: assemble-docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4