-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove use of legacy codepath when establishing Postgres connections (#…
…249) * Switch to using SQLKit (and thus going through `execute()` instead of `send()`) for setting search paths * The usual CI cleanup bit
- Loading branch information
Showing
4 changed files
with
104 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,100 +27,120 @@ jobs: | |
api-breakage: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
runs-on: ubuntu-latest | ||
container: swift:5.8-jammy | ||
container: swift:jammy | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: { 'fetch-depth': 0 } | ||
- name: Run API breakage check action | ||
uses: vapor/ci/.github/actions/ci-swift-check-api-breakage@reusable-workflows | ||
uses: vapor/ci/.github/actions/ci-swift-check-api-breakage@main | ||
|
||
code-coverage: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
runs-on: ubuntu-latest | ||
container: swift:jammy | ||
services: | ||
psql-a: | ||
image: postgres:15 | ||
env: | ||
POSTGRES_USER: test_username | ||
POSTGRES_DB: test_database | ||
POSTGRES_PASSWORD: test_password | ||
POSTGRES_HOST_AUTH_METHOD: scram-sha-256 | ||
POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Run unit tests for coverage data | ||
run: swift test --enable-code-coverage | ||
- name: Upload coverage data | ||
uses: vapor/[email protected] | ||
|
||
gh-codeql: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runner_os: | ||
- ubuntu-latest | ||
- macos-13 | ||
runs-on: ${{ matrix.runner_os }} | ||
permissions: | ||
security-events: write | ||
steps: | ||
- name: Select appropriate Xcode version | ||
if: ${{ startsWith(matrix.runner_os, 'macos') }} | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: { xcode-version: '~14.3' } | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: { languages: swift } | ||
- name: Perform build | ||
run: swift build | ||
- name: Run CodeQL analyze | ||
uses: github/codeql-action/analyze@v2 | ||
|
||
# Run Linux unit tests against various configurations | ||
linux-unit: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: ['postgres:15', 'postgres:13', 'postgres:11'] | ||
swiftver: [ | ||
'swift:5.7-jammy', 'swift:5.8-jammy', | ||
'swiftlang/swift:nightly-5.9-jammy', | ||
'swiftlang/swift:nightly-main-jammy' | ||
] | ||
include: [ | ||
{dbimage: 'postgres:15', dbauth: 'scram-sha-256'}, | ||
{dbimage: 'postgres:13', dbauth: 'md5'}, | ||
{dbimage: 'postgres:11', dbauth: 'trust'} | ||
] | ||
postgres-image: | ||
- postgres:15 | ||
- postgres:13 | ||
- postgres:11 | ||
swift-image: | ||
- swift:5.7-jammy | ||
- swift:5.8-jammy | ||
- swiftlang/swift:nightly-5.9-jammy | ||
- swiftlang/swift:nightly-main-jammy | ||
include: | ||
- postgres-image: postgres:15 | ||
postgres-auth: scram-sha-256 | ||
- postgres-image: postgres:13 | ||
postgres-auth: md5 | ||
- postgres-image: postgres:11 | ||
postgres-auth: trust | ||
runs-on: ubuntu-latest | ||
container: ${{ matrix.swiftver }} | ||
container: ${{ matrix.swift-image }} | ||
services: | ||
psql-a: | ||
image: ${{ matrix.dbimage }} | ||
image: ${{ matrix.postgres-image }} | ||
env: | ||
POSTGRES_USER: 'test_username' | ||
POSTGRES_DB: 'test_database' | ||
POSTGRES_PASSWORD: 'test_password' | ||
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.dbauth }} | ||
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.dbauth }} | ||
psql-b: | ||
image: ${{ matrix.dbimage }} | ||
env: | ||
POSTGRES_USER: 'test_username' | ||
POSTGRES_DB: 'test_database' | ||
POSTGRES_PASSWORD: 'test_password' | ||
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.dbauth }} | ||
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.dbauth }} | ||
POSTGRES_USER: test_username | ||
POSTGRES_DB: test_database | ||
POSTGRES_PASSWORD: test_password | ||
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }} | ||
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }} | ||
steps: | ||
- name: Check out package | ||
uses: actions/checkout@v3 | ||
- name: Run local tests | ||
run: swift test --enable-code-coverage | ||
- name: Note Swift version | ||
if: ${{ contains(matrix.swiftver, 'nightly') }} | ||
run: | | ||
echo "SWIFT_PLATFORM=$(. /etc/os-release && echo "${ID}${VERSION_ID}")" >>"${GITHUB_ENV}" | ||
echo "SWIFT_VERSION=$(cat /.swift_tag)" >>"${GITHUB_ENV}" | ||
- name: Upload code coverage | ||
uses: vapor/[email protected] | ||
env: | ||
POSTGRES_VERSION: ${{ matrix.dbimage }} | ||
POSTGRES_AUTH_METHOD: ${{ matrix.dbauth }} | ||
with: | ||
cc_env_vars: 'SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,POSTGRES_VERSION,POSTGRES_AUTH_METHOD' | ||
run: swift test | ||
|
||
# Test integration with dependent package on Linux | ||
linux-integration: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: ['postgres:15'] | ||
dbauth: ['scram-sha-256'] | ||
swiftver: [ | ||
'swift:5.7-jammy', 'swift:5.8-jammy', | ||
'swiftlang/swift:nightly-5.9-jammy', | ||
'swiftlang/swift:nightly-main-jammy' | ||
] | ||
runs-on: ubuntu-latest | ||
container: ${{ matrix.swiftver }} | ||
container: swift:5.8-jammy | ||
services: | ||
psql-a: | ||
image: ${{ matrix.dbimage }} | ||
image: postgres:15 | ||
env: | ||
POSTGRES_USER: 'test_username' | ||
POSTGRES_DB: 'test_database' | ||
POSTGRES_PASSWORD: 'test_password' | ||
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.dbauth }} | ||
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.dbauth }} | ||
POSTGRES_USER: test_username | ||
POSTGRES_DB: test_database | ||
POSTGRES_PASSWORD: test_password | ||
POSTGRES_HOST_AUTH_METHOD: scram-sha-256 | ||
POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 | ||
psql-b: | ||
image: ${{ matrix.dbimage }} | ||
image: postgres:15 | ||
env: | ||
POSTGRES_USER: 'test_username' | ||
POSTGRES_DB: 'test_database' | ||
POSTGRES_PASSWORD: 'test_password' | ||
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.dbauth }} | ||
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.dbauth }} | ||
POSTGRES_USER: test_username | ||
POSTGRES_DB: test_database | ||
POSTGRES_PASSWORD: test_password | ||
POSTGRES_HOST_AUTH_METHOD: scram-sha-256 | ||
POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 | ||
steps: | ||
- name: Check out package | ||
uses: actions/checkout@v3 | ||
|
@@ -133,43 +153,31 @@ jobs: | |
- name: Run fluent-postgres-kit tests | ||
run: swift test --package-path fluent-postgres-driver | ||
|
||
# Run macOS unit tests against various configurations | ||
macos-unit: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: ['postgresql@14'] | ||
dbauth: ['scram-sha-256'] | ||
macos: ['macos-13'] | ||
xcode: ['latest-stable'] | ||
runs-on: ${{ matrix.macos }} | ||
xcode-version: | ||
- '~14.3' | ||
- '15.0-beta' | ||
runs-on: macos-13 | ||
env: | ||
POSTGRES_HOSTNAME: 127.0.0.1 | ||
POSTGRES_DB: postgres | ||
steps: | ||
- name: Select latest available Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.xcode }} | ||
xcode-version: ${{ matrix.xcode-version }} | ||
- name: Install Postgres, setup DB and auth, and wait for server start | ||
env: | ||
POSTGRES_VERSION: ${{ matrix.dbimage }} | ||
POSTGRES_AUTH_METHOD: ${{ matrix.dbauth }} | ||
run: | | ||
export PATH="$(brew --prefix)/opt/${POSTGRES_VERSION}/bin:$PATH" PGDATA=/tmp/vapor-postgres-test | ||
(brew unlink postgresql || true) && brew install "${POSTGRES_VERSION}" && brew link --force "${POSTGRES_VERSION}" | ||
initdb --locale=C --auth-host "${POSTGRES_AUTH_METHOD}" -U "${POSTGRES_USER}" --pwfile=<(echo "${POSTGRES_PASSWORD}") | ||
export PATH="$(brew --prefix)/opt/postgresql@14/bin:$PATH" PGDATA=/tmp/vapor-postgres-test | ||
(brew unlink postgresql || true) && brew install "postgresql@14" && brew link --force "postgresql@14" | ||
initdb --locale=C --auth-host "scram-sha-256" -U "${POSTGRES_USER}" --pwfile=<(echo "${POSTGRES_PASSWORD}") | ||
pg_ctl start --wait | ||
timeout-minutes: 2 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Run local tests | ||
run: swift test --enable-code-coverage | ||
- name: Upload code coverage | ||
uses: vapor/[email protected] | ||
env: | ||
POSTGRES_VERSION: ${{ matrix.dbimage }} | ||
POSTGRES_AUTH_METHOD: ${{ matrix.dbauth }} | ||
with: | ||
cc_env_vars: 'MD_APPLE_SDK_ROOT,SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,POSTGRES_VERSION,POSTGRES_AUTH_METHOD' | ||
run: swift test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters