Skip to content

Commit

Permalink
Dialect trigger + version fixes (#85)
Browse files Browse the repository at this point in the history
* add sql dialect trigger + fix breakage

* update ci

* update ci

* fix dependent ci

* use diff path

* fix path
  • Loading branch information
tanner0101 authored Jul 16, 2020
1 parent 60f7005 commit d6f72bb
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 25 deletions.
107 changes: 83 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,91 @@
name: test
on:
- pull_request
pull_request:
push:
branches:
- master
defaults:
run:
shell: bash
jobs:
sqlite-kit_bionic:
container:
image: vapor/swift:5.2-bionic
dependents:
runs-on: ubuntu-latest
container: swift:5.2-bionic
strategy:
fail-fast: false
matrix:
dependent:
- fluent-sqlite-driver
steps:
- run: apt update -y; apt install -y libsqlite3-dev
- uses: actions/checkout@v1
- run: swift test --enable-test-discovery --sanitize=thread
sqlite-kit_xenial:
container:
image: vapor/swift:5.2-xenial
- name: Install dependencies
run: apt-get -q update && apt-get -q install -y libsqlite3-dev
- name: Check out SQLiteKit
uses: actions/checkout@v2
with:
path: sqlite-kit
- name: Check out dependent
uses: actions/checkout@v2
with:
repository: vapor/${{ matrix.dependent }}
path: dependent
- name: Use local package
run: swift package edit sqlite-kit --path ../sqlite-kit
working-directory: dependent
- name: Run tests with Thread Sanitizer
run: swift test --enable-test-discovery --sanitize=thread
working-directory: dependent
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
# 5.2 Stable
- swift:5.2-xenial
- swift:5.2-bionic
# 5.2 Unstable
- swiftlang/swift:nightly-5.2-xenial
- swiftlang/swift:nightly-5.2-bionic
# 5.3 Unstable
- swiftlang/swift:nightly-5.3-xenial
- swiftlang/swift:nightly-5.3-bionic
# Master Unsable
- swiftlang/swift:nightly-master-xenial
- swiftlang/swift:nightly-master-bionic
- swiftlang/swift:nightly-master-focal
- swiftlang/swift:nightly-master-centos8
- swiftlang/swift:nightly-master-amazonlinux2
container: ${{ matrix.image }}
steps:
- run: apt update -y; apt install -y libsqlite3-dev
- uses: actions/checkout@v1
- run: swift test --enable-test-discovery --sanitize=thread
fluent-sqlite-driver:
container:
image: vapor/swift:5.2
runs-on: ubuntu-latest
- name: Install Ubuntu dependencies
run: apt-get -q update && apt-get -q install -y libsqlite3-dev
if: ${{ endsWith(matrix.image, 'xenial') || endsWith(matrix.image, 'bionic') || endsWith(matrix.image, 'focal') }}
- name: Install CentOS deps
run: dnf install -y sqlite-devel
if: ${{ endsWith(matrix.image, 'centos8') }}
- name: Update AmazonLinux2's too-old SQLite and compensate for its Postgres
if: ${{ endsWith(matrix.image, 'amazonlinux2') }}
working-directory: /root
# Cribbed from the Fedora RPM, leaves out a lot. System's Tcl is too old to run SQLite's tests.
run: |
yum install -y sqlite-devel
yum install -y file tcl-devel make
curl -L 'https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release' | tar xz && cd sqlite
export CFLAGS="-DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_SECURE_DELETE=1"
./configure --prefix=/usr --libdir=/usr/lib64 --enable-fts3 --enable-all --with-tcl=/usr/lib64
make all install
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests with Thread Sanitizer
run: swift test --enable-test-discovery --sanitize=thread
macOS:
runs-on: macos-latest
steps:
- run: apt update -y; apt install -y libsqlite3-dev
- run: git clone -b master https://github.com/vapor/fluent-sqlite-driver.git
working-directory: ./
- run: swift package edit sqlite-kit --revision ${{ github.sha }}
working-directory: ./fluent-sqlite-driver
- run: swift test --enable-test-discovery --sanitize=thread
working-directory: ./fluent-sqlite-driver
- name: Select latest available Xcode
uses: maxim-lobanov/[email protected]
with:
xcode-version: latest
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests with Thread Sanitizer
run: swift test --enable-test-discovery --sanitize=thread
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Package.pins
Package.resolved
DerivedData
.swiftpm
Tests/LinuxMain.swift

4 changes: 4 additions & 0 deletions Sources/SQLiteKit/SQLiteDialect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public struct SQLiteDialect: SQLDialect {
allowsBatch: false
)
}

public var triggerSyntax: SQLTriggerSyntax {
return .init(create: [.supportsBody, .supportsCondition])
}

public init() { }
}
2 changes: 1 addition & 1 deletion Sources/SQLiteKit/SQLiteRow+SQLRow.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extension SQLiteRow: SQLRow {
public var allColumns: [String] {
.init(self.columns.offsets.keys)
self.columns.map { $0.name }
}

public func decodeNil(column: String) throws -> Bool {
Expand Down

0 comments on commit d6f72bb

Please sign in to comment.