Skip to content
Open
Show file tree
Hide file tree
Changes from 16 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
97 changes: 97 additions & 0 deletions .github/workflows/ubuntu-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md

name: "Linux CI"

on:
push:
branches:
- master
- development
- grdb_linux_changes
paths:
- 'GRDB/**'
- 'Tests/**'
- '.github/workflows/**'
- 'Makefile'
- 'Package.swift'
- 'SQLiteCustom/src'
pull_request:
paths:
- 'GRDB/**'
- 'Tests/**'
- '.github/workflows/**'
- 'Makefile'
- 'Package.swift'
- 'SQLiteCustom/src'

concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be false, because it is often useful to see when one variant passes and another fails (e.g., if a change breaks for Swift 6.0 but not 6.1)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, changed cancel-in-progress to false

permissions:
contents: read

jobs:
build-and-test-on-linux:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
swift: ["6.2", "6.1"]
steps:
- name: Checkout Repository
uses: actions/checkout@v5

- name: Install Swift Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
binutils \
git \
gnupg2 \
libc6-dev \
libcurl4-openssl-dev \
libedit2 \
libgcc-13-dev \
libpython3-dev \
libsqlite3-0 \
libstdc++-13-dev \
libxml2-dev \
libz3-dev \
pkg-config \
python3-lldb \
tzdata \
unzip \
zip \
zlib1g-dev \
wget \
curl \
ca-certificates \
util-linux

- name: Cache Swiftly toolchains
id: cache-swiftly
uses: actions/cache@v4
with:
path: ${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}
key: swiftly-${{ matrix.os }}-${{ matrix.swift }}

- name: Install Swift Using Swiftly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could alternatively just use uses: swift-actions/setup-swift@next as per swift-actions/setup-swift#710. I've been using it in other actions, and it seems quite stable.

@thinkpractice thinkpractice Nov 7, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did use setup-swift@v2 before but that didn't support swift 6.2. Also, it threw some random errors with the gpg verification (?) of swift, which made the pipeline fail. UPDATE apparently this gpg issue is also mentioned here, i.e. "Investigate GPG issues on linux". That's why I decided to add the swiftly code myself. I agree it would be better to use the setup-swift action in the future. I guess then @next selects the latest v3 version that uses swiftly as well? I saw on its PR that it's not yet merged into main right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and I saw there's a possibility to cache the swiftly install but it seems with the current code it doesn't do anything. Not sure whether the path I added (${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}) is evaluated correctly or whether it's an issue with the cache action itself. @marcprux, @groue does any of you have some experience with this?

if: steps.cache-swiftly.outputs.cache-hit != 'true'
run: |
curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz
tar zxf swiftly-$(uname -m).tar.gz
./swiftly init --quiet-shell-followup -y --skip-install
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"
hash -r
swiftly install ${{ matrix.swift }} --assume-yes --use
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"

- name: Build SPM Package
run: |
swift build -c release

- name: Run tests
run: |
swift test -c release
12 changes: 1 addition & 11 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ let darwinPlatforms: [Platform] = [
]
var swiftSettings: [SwiftSetting] = [
.define("SQLITE_ENABLE_FTS5"),
// Until Xcode has proper support for package traits, we must enable
// SQLITE_ENABLE_SNAPSHOT by default so that Xcode projects that build
// a Darwin app can depend on GRDB and profit from WAL snapshots.
// Package traits who want to disable snapshots must set SQLITE_DISABLE_SNAPSHOT.
// TODO: when Xcode support traits, remove all mentions of SQLITE_DISABLE_SNAPSHOT and update as below:
// .define("SQLITE_ENABLE_SNAPSHOT", .when(platforms: darwinPlatforms, traits: ["GRDBSQLite"])),
.define("SQLITE_ENABLE_SNAPSHOT"),
// Not all Linux distributions have support for WAL snapshots.
.define("SQLITE_DISABLE_SNAPSHOT", .when(platforms: [.linux])),
Expand Down Expand Up @@ -58,10 +52,6 @@ let package = Package(
.library(name: "GRDB", targets: ["GRDB"]),
.library(name: "GRDB-dynamic", type: .dynamic, targets: ["GRDB"]),
],
traits: [
"GRDBSQLite",
.default(enabledTraits: ["GRDBSQLite"]),
],
dependencies: dependencies,
targets: [
.systemLibrary(
Expand All @@ -70,7 +60,7 @@ let package = Package(
.target(
name: "GRDB",
dependencies: [
.target(name: "GRDBSQLite", condition: .when(traits: ["GRDBSQLite"])),
.target(name: "GRDBSQLite"),
],
path: "GRDB",
resources: [.copy("PrivacyInfo.xcprivacy")],
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<a href="https://developer.apple.com/swift/"><img alt="Swift 6.1" src="https://img.shields.io/badge/swift-6.1-orange.svg?style=flat"></a>
<a href="https://github.com/groue/GRDB.swift/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/groue/GRDB.swift.svg?maxAge=2592000"></a>
<a href="https://github.com/groue/GRDB.swift/actions/workflows/CI.yml"><img alt="CI Status" src="https://github.com/groue/GRDB.swift/actions/workflows/CI.yml/badge.svg?branch=master"></a>
<a href="https://github.com/groue/GRDB.swift/actions/workflows/ubuntu-ci.yml"><img alt="Linux Status" src="https://github.com/groue/GRDB.swift/actions/workflows/ubuntu-ci.yml/badge.svg?branch=master"></a>
</p>

---
Expand Down