From 6bedbd53c9cd26dbfd1bfe97067c70f9b10690e0 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 10:40:22 -0700 Subject: [PATCH 01/12] Add GitHub actions --- .github/workflows/ci.yml | 54 ++++++++++++++++++++++++++++++++++++ .github/workflows/format.yml | 28 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..1783cd40 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - '*' + workflow_dispatch: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + library: + name: macOS + strategy: + matrix: + xcode: ['16.3'] + config: ['debug', 'release'] + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + - name: Select Xcode ${{ matrix.xcode }} + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app + - name: Run ${{ matrix.config }} tests + run: swift test -c ${{ matrix.config }} + + linux: + name: Linux + strategy: + matrix: + swift: + - '6.1' + runs-on: ubuntu-latest + container: swift:${{ matrix.swift }} + steps: + - uses: actions/checkout@v4 + - name: Build + run: swift build + + check-macro-compatibility: + name: Check Macro Compatibility + runs-on: macos-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run Swift Macro Compatibility Check + uses: Matejkob/swift-macro-compatibility-check@v1 + with: + run-tests: false + major-versions-only: true diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..9b613e74 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,28 @@ +NB: Compatible swift-format requires Xcode 16.3, not yet available on GitHub +name: Format + +on: + push: + branches: + - main + +concurrency: + group: format-${{ github.ref }} + cancel-in-progress: true + +jobs: + swift_format: + name: swift-format + runs-on: macos-15 + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Select Xcode 16.3 + run: sudo xcode-select -s /Applications/Xcode_16.3.app + - name: Format + run: make format + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Run swift-format + branch: 'main' From ece89eb8e7619cb98fe2f0bff5c511e7ce409455 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 10:42:47 -0700 Subject: [PATCH 02/12] Remove macro compatibility check --- .github/workflows/ci.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1783cd40..79e165da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,15 +40,3 @@ jobs: - uses: actions/checkout@v4 - name: Build run: swift build - - check-macro-compatibility: - name: Check Macro Compatibility - runs-on: macos-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run Swift Macro Compatibility Check - uses: Matejkob/swift-macro-compatibility-check@v1 - with: - run-tests: false - major-versions-only: true From d7a42c85d2343c22924bc108b8398fecaf059604 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 10:48:22 -0700 Subject: [PATCH 03/12] Install SQLite on Linux --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79e165da..72b3da31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,5 +38,7 @@ jobs: container: swift:${{ matrix.swift }} steps: - uses: actions/checkout@v4 + - name: Install SQLite + run: sudo apt-get install -y libsqlite3-dev - name: Build run: swift build From f07fdcf8d3e50af49bc122bfea973ad37c232b2d Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 10:49:57 -0700 Subject: [PATCH 04/12] wip --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72b3da31..6605a46e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install SQLite - run: sudo apt-get install -y libsqlite3-dev + run: apt-get install -y libsqlite3-dev - name: Build run: swift build From e88deb96d116a6af680c3ee727ef0894d5d6c028 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 10:57:23 -0700 Subject: [PATCH 05/12] wip --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6605a46e..10377c42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install SQLite - run: apt-get install -y libsqlite3-dev + run: apt-get --fix-missing update && apt-get install -y libsqlite3-dev - name: Build run: swift build From 62c5cd25f12e16b64f2e4ce87fb08911f3650869 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 10:59:56 -0700 Subject: [PATCH 06/12] Don't run tests in release --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10377c42..7b030c1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,14 +19,15 @@ jobs: strategy: matrix: xcode: ['16.3'] - config: ['debug', 'release'] runs-on: macos-15 steps: - uses: actions/checkout@v4 - name: Select Xcode ${{ matrix.xcode }} run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app - - name: Run ${{ matrix.config }} tests - run: swift test -c ${{ matrix.config }} + - name: Run tests + run: swift test + - name: Build release + run: swift build -c release linux: name: Linux @@ -39,6 +40,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install SQLite - run: apt-get --fix-missing update && apt-get install -y libsqlite3-dev + run: apt update && apt -y install libsqlite3-dev - name: Build run: swift build From 9f91b2cd77a6477cb35b68e97c698b0438870b25 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 11:14:42 -0700 Subject: [PATCH 07/12] wip --- Package.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Package.swift b/Package.swift index 8e1cd79b..6192858a 100644 --- a/Package.swift +++ b/Package.swift @@ -114,6 +114,15 @@ for index in package.targets.indices { package.targets[index].swiftSettings = swiftSettings } +#if !os(Darwin) + package.targets.append( + .systemLibrary( + name: "SQLite3", + providers: [.apt(["libsqlite3-dev"])] + ) + ) +#endif + #if !os(Windows) // Add the documentation compiler plugin if possible package.dependencies.append( From 42fed09e975e5f33fe6b25fd93287448f98087c9 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 11:24:15 -0700 Subject: [PATCH 08/12] wip --- Package.swift | 6 ++++++ Sources/SQLite3/SQLite3.h | 4 ++++ Sources/SQLite3/module.modulemap | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 Sources/SQLite3/SQLite3.h create mode 100644 Sources/SQLite3/module.modulemap diff --git a/Package.swift b/Package.swift index 6192858a..be60aad7 100644 --- a/Package.swift +++ b/Package.swift @@ -121,6 +121,12 @@ for index in package.targets.indices { providers: [.apt(["libsqlite3-dev"])] ) ) + + for index in package.targets.indices { + if package.targets[index].name == "StructuredQueriesSQLite" { + package.targets[index].dependencies.append("SQLite3") + } + } #endif #if !os(Windows) diff --git a/Sources/SQLite3/SQLite3.h b/Sources/SQLite3/SQLite3.h new file mode 100644 index 00000000..f2fa59aa --- /dev/null +++ b/Sources/SQLite3/SQLite3.h @@ -0,0 +1,4 @@ +#ifndef SQLite3 +#define SQLite3 +#include +#endif diff --git a/Sources/SQLite3/module.modulemap b/Sources/SQLite3/module.modulemap new file mode 100644 index 00000000..38c96581 --- /dev/null +++ b/Sources/SQLite3/module.modulemap @@ -0,0 +1,4 @@ +module SQLite3 [system] { + header "SQLite3.h" + export * +} From b1fb7d409a8424d1c00167bdd88b492b9706af10 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 11:25:02 -0700 Subject: [PATCH 09/12] wip --- Sources/SQLite3/SQLite3.h | 4 ---- Sources/SQLite3/module.modulemap | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 Sources/SQLite3/SQLite3.h diff --git a/Sources/SQLite3/SQLite3.h b/Sources/SQLite3/SQLite3.h deleted file mode 100644 index f2fa59aa..00000000 --- a/Sources/SQLite3/SQLite3.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef SQLite3 -#define SQLite3 -#include -#endif diff --git a/Sources/SQLite3/module.modulemap b/Sources/SQLite3/module.modulemap index 38c96581..1549e159 100644 --- a/Sources/SQLite3/module.modulemap +++ b/Sources/SQLite3/module.modulemap @@ -1,4 +1,4 @@ module SQLite3 [system] { - header "SQLite3.h" + link "sqlite3" export * } From d73c7e5037adc193c7b677d826364640db6afe4b Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 11:30:47 -0700 Subject: [PATCH 10/12] wip --- Package.swift | 4 ++-- Sources/SQLite3/module.modulemap | 4 ---- Sources/StructuredQueriesSQLite/Database.swift | 7 ++++++- Sources/StructuredQueriesSQLite/SQLiteQueryDecoder.swift | 7 ++++++- Sources/StructuredQueriesSQLite3/module.modulemap | 4 ++++ 5 files changed, 18 insertions(+), 8 deletions(-) delete mode 100644 Sources/SQLite3/module.modulemap create mode 100644 Sources/StructuredQueriesSQLite3/module.modulemap diff --git a/Package.swift b/Package.swift index be60aad7..4ad6c7f3 100644 --- a/Package.swift +++ b/Package.swift @@ -117,14 +117,14 @@ for index in package.targets.indices { #if !os(Darwin) package.targets.append( .systemLibrary( - name: "SQLite3", + name: "StructuredQueriesSQLite3", providers: [.apt(["libsqlite3-dev"])] ) ) for index in package.targets.indices { if package.targets[index].name == "StructuredQueriesSQLite" { - package.targets[index].dependencies.append("SQLite3") + package.targets[index].dependencies.append("StructuredQueriesSQLite3") } } #endif diff --git a/Sources/SQLite3/module.modulemap b/Sources/SQLite3/module.modulemap deleted file mode 100644 index 1549e159..00000000 --- a/Sources/SQLite3/module.modulemap +++ /dev/null @@ -1,4 +0,0 @@ -module SQLite3 [system] { - link "sqlite3" - export * -} diff --git a/Sources/StructuredQueriesSQLite/Database.swift b/Sources/StructuredQueriesSQLite/Database.swift index 0bd73605..94bc106f 100644 --- a/Sources/StructuredQueriesSQLite/Database.swift +++ b/Sources/StructuredQueriesSQLite/Database.swift @@ -1,7 +1,12 @@ import Foundation -import SQLite3 import StructuredQueries +#if canImport(Darwin) + import SQLite3 +#else + import StructuredQueriesSQLite3 +#endif + public struct Database { @usableFromInline let storage: Storage diff --git a/Sources/StructuredQueriesSQLite/SQLiteQueryDecoder.swift b/Sources/StructuredQueriesSQLite/SQLiteQueryDecoder.swift index 12ab5a70..f891250b 100644 --- a/Sources/StructuredQueriesSQLite/SQLiteQueryDecoder.swift +++ b/Sources/StructuredQueriesSQLite/SQLiteQueryDecoder.swift @@ -1,6 +1,11 @@ -import SQLite3 import StructuredQueries +#if canImport(Darwin) + import SQLite3 +#else + import StructuredQueriesSQLite3 +#endif + @usableFromInline struct SQLiteQueryDecoder: QueryDecoder { @usableFromInline diff --git a/Sources/StructuredQueriesSQLite3/module.modulemap b/Sources/StructuredQueriesSQLite3/module.modulemap new file mode 100644 index 00000000..6f2629f6 --- /dev/null +++ b/Sources/StructuredQueriesSQLite3/module.modulemap @@ -0,0 +1,4 @@ +module StructuredQueriesSQLite3 [system] { + link "sqlite3" + export * +} From 7a3f7e6f9d2f85652b2e53073d0d94d78267a7d6 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 11:35:14 -0700 Subject: [PATCH 11/12] wip --- Sources/StructuredQueriesSQLite3/StructuredQueriesSQLite3.h | 4 ++++ Sources/StructuredQueriesSQLite3/module.modulemap | 1 + 2 files changed, 5 insertions(+) create mode 100644 Sources/StructuredQueriesSQLite3/StructuredQueriesSQLite3.h diff --git a/Sources/StructuredQueriesSQLite3/StructuredQueriesSQLite3.h b/Sources/StructuredQueriesSQLite3/StructuredQueriesSQLite3.h new file mode 100644 index 00000000..8e211139 --- /dev/null +++ b/Sources/StructuredQueriesSQLite3/StructuredQueriesSQLite3.h @@ -0,0 +1,4 @@ +#ifndef StructuredQueriesSQLite3 +#define StructuredQueriesSQLite3 +#include +#endif diff --git a/Sources/StructuredQueriesSQLite3/module.modulemap b/Sources/StructuredQueriesSQLite3/module.modulemap index 6f2629f6..bbb8d7df 100644 --- a/Sources/StructuredQueriesSQLite3/module.modulemap +++ b/Sources/StructuredQueriesSQLite3/module.modulemap @@ -1,4 +1,5 @@ module StructuredQueriesSQLite3 [system] { link "sqlite3" + header "StructuredQueriesSQLite3.h" export * } From 138927c5be4ac49339310e69792b85dfbf7868c1 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 21 Apr 2025 11:50:38 -0700 Subject: [PATCH 12/12] Update README --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 0996ceab..eea7c5d2 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ # StructuredQueries - - [![Slack](https://img.shields.io/badge/slack-chat-informational.svg?label=Slack&logo=slack)](https://www.pointfree.co/slack-invite) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fpointfreeco%2Fswift-structured-queries%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/pointfreeco/swift-structured-queries) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fpointfreeco%2Fswift-structured-queries%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/pointfreeco/swift-structured-queries)