Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: CI

on:
push:
pull_request:

permissions:
contents: read

jobs:
linux:
# Builds the app, then runs it against a MySQL 8.4 service and drives the whole API
# (Scripts/smoke-test.sh).
name: Linux (Swift ${{ matrix.swift }}, ${{ matrix.configuration }})
runs-on: ubuntu-24.04
container: swift:${{ matrix.swift }}-noble
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# The oldest supported Swift (swift-tools-version 6.2) and the newest.
swift: ["6.2", "6.4"]
configuration: [debug, release]
services:
mysql:
image: mysql:8.4
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: perfect_template
MYSQL_USER: perfect
MYSQL_PASSWORD: perfect
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1"
--health-interval 5s --health-timeout 5s --health-retries 30
env:
# The job runs in a container, so the service is reached by name on its own port.
DB_HOST: mysql
DB_PORT: "3306"
# Dates must round-trip whatever the process's time zone is.
TZ: America/Denver
steps:
- uses: actions/checkout@v7

- name: Install client library
run: |
apt-get update
apt-get install -y --no-install-recommends pkg-config libmysqlclient-dev curl

- name: Toolchain
run: swift --version

- name: Build (warnings are errors)
run: swift build -c ${{ matrix.configuration }} -Xswiftc -warnings-as-errors

- name: Smoke test
run: |
bin="$(swift build -c ${{ matrix.configuration }} --show-bin-path)/PerfectTemplate"
"$bin" > server.log 2>&1 &
server=$!
Scripts/smoke-test.sh || { cat server.log; exit 1; }
kill "$server"

macos:
# GitHub's macOS runners have no MySQL server, so the smoke test checks that the app
# starts without one and answers 503 for database routes.
name: macOS (Xcode ${{ matrix.xcode }}, ${{ matrix.configuration }})
runs-on: macos-26
timeout-minutes: 30
env:
TZ: America/Denver
strategy:
fail-fast: false
matrix:
# The oldest Xcode with Swift 6.2, and the runner's default.
xcode: ["26.0.1", "26.6"]
configuration: [debug, release]
steps:
- uses: actions/checkout@v7

- name: Select Xcode
run: |
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
swift --version

- name: Install client library
run: |
brew install mysql-client pkgconf
# mysql-client is keg-only, so pkg-config can't find mysqlclient.pc without this.
echo "PKG_CONFIG_PATH=$(brew --prefix mysql-client)/lib/pkgconfig" >> "$GITHUB_ENV"

# Homebrew's libmysqlclient is built for the runner's macOS, so ld warns that it is
# newer than the package's macOS 12 deployment target. That is a linker warning;
# -warnings-as-errors only applies to the Swift compiler, so it doesn't fail the build.
- name: Build (warnings are errors)
run: swift build -c ${{ matrix.configuration }} -Xswiftc -warnings-as-errors

- name: Smoke test (no database)
run: |
bin="$(swift build -c ${{ matrix.configuration }} --show-bin-path)/PerfectTemplate"
"$bin" > server.log 2>&1 &
server=$!
Scripts/smoke-test.sh --no-db || { cat server.log; exit 1; }
kill "$server"
75 changes: 5 additions & 70 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,71 +1,6 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata

## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md

fastlane/report.xml
fastlane/screenshots

Packages/
PerfectTemplate.xcodeproj
Tests/
webroot/
Package.pins
Package.resolved
.DS_Store
.swiftpm/
*.o
*.d
*.DS_Store
*.log
195 changes: 195 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading