Skip to content

Collapse the renderMetatile overloads into one #45

Collapse the renderMetatile overloads into one

Collapse the renderMetatile overloads into one #45

Workflow file for this run

# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
name: Swift
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- name: Install SwiftFormat
run: |
curl -fsSL -o /tmp/swiftformat.zip \
https://github.com/nicklockwood/SwiftFormat/releases/download/0.64.5/swiftformat_linux.zip
unzip -q /tmp/swiftformat.zip -d /tmp/swiftformat
install -m 0755 /tmp/swiftformat/swiftformat_linux /usr/local/bin/swiftformat
swiftformat --version
- name: Lint
run: swiftformat Sources Tests --swift-version 6.3 --lint
macos:
name: Test (macOS)
runs-on: macos-latest
# The macOS test runner has been observed to hang before executing the
# first test (Swift Testing parallel executor produces no output); cap
# the job so a stuck run fails fast instead of burning the 6-hour
# runner limit.
timeout-minutes: 20
steps:
- uses: actions/checkout@v5
- name: Setup Swift
uses: swift-actions/setup-swift@v3
with:
swift-version: "6.3.3"
# The mapnik formula does not ship fonts; the DejaVu cask provides the
# "DejaVu Sans Book" face the test stylesheets reference.
- name: Install mapnik
run: |
brew install mapnik
brew install --cask font-dejavu-sans
- name: Record toolchain versions
id: versions
run: |
echo "mapnik=$(brew list --versions mapnik | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- name: Cache SwiftPM build
uses: actions/cache@v5
with:
# Keyed on the mapnik version too: .build holds objects compiled
# against the system library, so a mapnik bump must invalidate it.
path: |
.build
key: ${{ runner.os }}-swift-6.3.3-mapnik-${{ steps.versions.outputs.mapnik }}-${{ hashFiles('Package.swift') }}
restore-keys: |
${{ runner.os }}-swift-6.3.3-mapnik-${{ steps.versions.outputs.mapnik }}-
- name: Build
run: CC=clang CXX=clang++ swift build
- name: Test
# --no-parallel: Swift Testing's parallel executor hung with no output
# before the first test on the macOS runner with Swift 6.3.3.
run: CC=clang CXX=clang++ swift test --no-parallel
- name: Build (release)
run: CC=clang CXX=clang++ swift build -c release
linux:
name: Test (Linux)
runs-on: ubuntu-latest
timeout-minutes: 30
# Run in the official Swift image instead of installing a toolchain with
# swift-actions/setup-swift: on Linux that action downloads Swiftly and
# verifies its GPG signature without importing swift.org's keys first, so
# every run fails with "Can't check signature: No public key"
# (swift-actions/setup-swift#798). The image also matches the Swift
# version exactly and is what the sibling packages use.
container: swift:6.3.3
steps:
- uses: actions/checkout@v5
- name: Install mapnik
# The container runs as root, so no sudo. Ubuntu 24.04 (the image's
# base) ships mapnik 3.1 with the AGG and cairo headers the shim
# includes.
run: |
apt-get update
apt-get install -y libmapnik-dev mapnik-utils fonts-dejavu-core
- name: Record toolchain versions
id: versions
run: |
echo "mapnik=$(pkg-config --modversion libmapnik 2>/dev/null || echo unknown)" >> "$GITHUB_OUTPUT"
- name: Cache SwiftPM build
uses: actions/cache@v5
with:
# Keyed on the mapnik version too: .build holds objects compiled
# against the system library, so a mapnik bump must invalidate it.
path: |
.build
key: ${{ runner.os }}-swift-6.3.3-mapnik-${{ steps.versions.outputs.mapnik }}-${{ hashFiles('Package.swift') }}
restore-keys: |
${{ runner.os }}-swift-6.3.3-mapnik-${{ steps.versions.outputs.mapnik }}-
- name: Build
run: CC=clang CXX=clang++ swift build
- name: Test
run: CC=clang CXX=clang++ swift test --no-parallel
- name: Build (release)
run: CC=clang CXX=clang++ swift build -c release
sanitizer:
name: Thread sanitizer
runs-on: ubuntu-latest
timeout-minutes: 30
container:
image: swift:6.3.3
# TSan needs to disable ASLR, which requires the personality syscall
# that Docker's default seccomp profile blocks.
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v5
- name: Install mapnik
run: |
apt-get update
apt-get install -y libmapnik-dev mapnik-utils fonts-dejavu-core
# MapnikPool, WorkQueue, MapnikDatasource and TilelistBuilder are
# @unchecked Sendable with hand-rolled locking, so a TSan run is the only
# thing that can catch a regression there.
#
# TSan needs a specific memory layout and cannot always disable ASLR
# itself, so run it under `setarch -R` (util-linux is in the base image).
- name: Test
run: |
CC=clang CXX=clang++ swift build --sanitize=thread --build-tests
setarch "$(uname -m)" -R \
swift test --sanitize=thread --no-parallel --skip-build
docs:
name: Documentation
runs-on: ubuntu-latest
timeout-minutes: 20
container: swift:6.3.3
steps:
- uses: actions/checkout@v5
- name: Install mapnik
run: |
apt-get update
apt-get install -y libmapnik-dev mapnik-utils fonts-dejavu-core
# swift-docc-plugin is not a package dependency (it would be pulled into
# every consumer's build), so add it for this job only.
- name: Add swift-docc-plugin
run: |
swift package --disable-sandbox \
add-dependency https://github.com/swiftlang/swift-docc-plugin --from 1.4.0
- name: Build documentation
run: |
CC=clang CXX=clang++ swift package generate-documentation \
--target Mapnik --warnings-as-errors