Warn about deprecation of old config methods instead of breaking existing code #213
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: info | |
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: | |
include: | |
- dbimage: postgres:15 | |
dbauth: scram-sha-256 | |
runs-on: ubuntu-latest | |
container: swift:5.8-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 }} | |
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: 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_env_vars: 'SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,POSTGRES_VERSION,POSTGRES_AUTH_METHOD' | |
cc_fail_ci_if_error: 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 } | |
- name: Run API breakage check action | |
uses: vapor/ci/.github/actions/ci-swift-check-api-breakage@reusable-workflows | |
linux-all: | |
if: github.event_name == 'pull_request' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {dbimage: 'postgres:11', dbauth: 'trust', swiftver: 'swift:5.7-focal'} | |
- {dbimage: 'postgres:13', dbauth: 'md5', swiftver: 'swift:5.7-jammy'} | |
- {dbimage: 'postgres:15', dbauth: 'scram-sha-256', swiftver: 'swift:5.8-jammy'} | |
- {dbimage: 'postgres:15', dbauth: 'scram-sha-256', swiftver: 'swiftlang/swift:nightly-5.9-jammy'} | |
- {dbimage: 'postgres:15', dbauth: 'scram-sha-256', swiftver: '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 | |
- name: Run all tests | |
run: swift test --sanitize=thread | |
macos-all: | |
if: github.event_name == 'pull_request' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dbimage: postgresql@14 | |
dbauth: scram-sha-256 | |
macos: macos-13 | |
xcode: latest-stable | |
runs-on: ${{ matrix.macos }} | |
env: | |
LOG_LEVEL: debug | |
POSTGRES_HOSTNAME: 127.0.0.1 | |
POSTGRES_HOSTNAME_A: 127.0.0.1 | |
POSTGRES_HOSTNAME_B: 127.0.0.1 | |
POSTGRES_DB: 'test_database_a' | |
POSTGRES_DB_A: 'test_database_a' | |
POSTGRES_DB_B: 'test_database_b' | |
POSTGRES_USER: 'test_username_a' | |
POSTGRES_USER_A: 'test_username_a' | |
POSTGRES_USER_B: 'test_username_b' | |
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.dbimage }}/bin:$PATH" PGDATA=/tmp/vapor-postgres-test PGUSER=postgres | |
(brew unlink postgresql || true) && brew install ${{ matrix.dbimage }} && brew link --force ${{ matrix.dbimage }} | |
initdb --locale=C --auth-host ${{ matrix.dbauth }} --username=postgres --pwfile=<(echo postgres) | |
pg_ctl start --wait | |
psql postgres <<<"CREATE ROLE $POSTGRES_USER_A LOGIN PASSWORD '$POSTGRES_PASSWORD_A';" | |
psql postgres <<<"CREATE ROLE $POSTGRES_USER_B LOGIN PASSWORD '$POSTGRES_PASSWORD_B';" | |
psql postgres <<<"CREATE DATABASE $POSTGRES_DB_A OWNER = $POSTGRES_USER_A;" | |
psql postgres <<<"CREATE DATABASE $POSTGRES_DB_B OWNER = $POSTGRES_USER_B;" | |
psql $POSTGRES_DB_A <<<"ALTER SCHEMA public OWNER TO $POSTGRES_USER_A;" | |
psql $POSTGRES_DB_B <<<"ALTER SCHEMA public OWNER TO $POSTGRES_USER_B;" | |
timeout-minutes: 2 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Run all tests | |
run: swift test --sanitize=thread |