Remove all use of deprecated PostgresNIO APIs #169
Workflow file for this run
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
name: test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: { branches: ['*'] } | |
push: { branches: ['main'] } | |
env: | |
LOG_LEVEL: debug | |
SWIFT_DETERMINISTIC_HASHING: 1 | |
POSTGRES_HOSTNAME: 'psql-a' | |
POSTGRES_HOSTNAME_A: 'psql-a' | |
POSTGRES_HOSTNAME_B: 'psql-b' | |
POSTGRES_DB: 'test_database' | |
POSTGRES_DB_A: 'test_database' | |
POSTGRES_DB_B: 'test_database' | |
POSTGRES_USER: 'test_username' | |
POSTGRES_USER_A: 'test_username' | |
POSTGRES_USER_B: 'test_username' | |
POSTGRES_PASSWORD: 'test_password' | |
POSTGRES_PASSWORD_A: 'test_password' | |
POSTGRES_PASSWORD_B: 'test_password' | |
jobs: | |
# Baseline test run for code coverage stats | |
codecov: | |
strategy: | |
matrix: { dbimage: ['postgres:15'], dbauth: ['scram-sha-256'] } | |
runs-on: ubuntu-latest | |
container: swift:5.7-jammy | |
services: | |
psql-a: | |
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 }} | |
steps: | |
- name: Save Postgres version and method to env | |
run: | | |
echo POSTGRES_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV | |
echo POSTGRES_AUTH_METHOD='${{ matrix.dbauth }}' >> $GITHUB_ENV | |
- name: Check out package | |
uses: actions/checkout@v3 | |
- name: Run local tests with coverage | |
run: swift test --enable-code-coverage | |
- name: Submit coverage report to Codecov.io | |
uses: vapor/swift-codecov-action@v0.2 | |
with: | |
cc_flags: 'unittests' | |
cc_env_vars: 'SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,POSTGRES_VERSION,POSTGRES_AUTH_METHOD' | |
cc_fail_ci_if_error: true | |
cc_verbose: true | |
cc_dry_run: false | |
# Check for API breakage versus main | |
api-breakage: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
container: swift:5.8-jammy | |
steps: | |
- name: Check out package | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# https://github.com/actions/checkout/issues/766 | |
- name: Mark the workspace as safe | |
run: git config --global --add safe.directory ${GITHUB_WORKSPACE} | |
- name: Check for API breaking changes | |
run: swift package diagnose-api-breaking-changes origin/main | |
# Run Linux unit tests against various configurations | |
linux-unit: | |
if: github.event_name == 'pull_request' | |
strategy: | |
fail-fast: false | |
matrix: | |
dbimage: ['postgres:15', 'postgres:13', 'postgres:11'] | |
swiftver: [ | |
'swift:5.6-focal', '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'} | |
] | |
container: ${{ matrix.swiftver }} | |
runs-on: ubuntu-latest | |
services: | |
psql-a: | |
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 }} | |
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 }} | |
steps: | |
- name: Check out package | |
uses: actions/checkout@v3 | |
- name: Run local tests | |
run: swift test | |
# Test integration with dependent package on Linux | |
linux-integration: | |
if: github.event_name == 'pull_request' | |
strategy: | |
fail-fast: false | |
matrix: | |
dbimage: ['postgres:15'] | |
dbauth: ['scram-sha-256'] | |
swiftver: [ | |
'swift:5.6-focal', 'swift:5.7-jammy', 'swift:5.8-jammy', | |
'swiftlang/swift:nightly-5.9-jammy', | |
'swiftlang/swift:nightly-main-jammy' | |
] | |
container: ${{ matrix.swiftver }} | |
runs-on: ubuntu-latest | |
services: | |
psql-a: | |
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 }} | |
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 }} | |
steps: | |
- name: Check out package | |
uses: actions/checkout@v3 | |
with: { path: 'postgres-kit' } | |
- name: Check out fluent-postgres-driver dependent | |
uses: actions/checkout@v3 | |
with: { repository: 'vapor/fluent-postgres-driver', path: 'fluent-postgres-driver' } | |
- name: Use local package | |
run: swift package --package-path fluent-postgres-driver edit postgres-kit --path postgres-kit | |
- 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_name == 'pull_request' | |
strategy: | |
fail-fast: false | |
matrix: | |
dbimage: ['postgresql@14'] | |
dbauth: ['scram-sha-256'] | |
macos: ['macos-12'] | |
xcode: ['latest-stable'] | |
runs-on: ${{ matrix.macos }} | |
env: | |
POSTGRES_HOSTNAME: 127.0.0.1 | |
POSTGRES_DB: postgres | |
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.dbauth }} | |
steps: | |
- name: Select latest available Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ matrix.xcode }} | |
- name: Install Postgres, setup DB and auth, and wait for server start | |
run: | | |
export PATH="$(brew --prefix)/opt/${{ matrix.formula }}/bin:$PATH" PGDATA=/tmp/vapor-postgres-test | |
(brew unlink postgresql || true) && brew install ${{ matrix.dbimage }} && brew link --force ${{ matrix.dbimage }} | |
initdb --locale=C --auth-host ${{ matrix.dbauth }} -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 | |
test-exports: | |
name: Test exports | |
runs-on: ubuntu-latest | |
container: swift:5.8-jammy | |
steps: | |
- name: Check out Vapor | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
run: swift build -Xswiftc -DBUILDING_DOCC |