Adopt Async Shutdown #225
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: { types: [opened, reopened, synchronize, ready_for_review] } | |
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_a' | |
POSTGRES_DB_A: 'test_database_a' | |
POSTGRES_DB_B: 'test_database_b' | |
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: | |
api-breakage: | |
if: ${{ github.event_name == 'pull_request' && !(github.event.pull_request.draft || false) }} | |
runs-on: ubuntu-latest | |
container: swift:jammy | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: { 'fetch-depth': 0 } | |
- name: API breaking changes | |
run: | | |
git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
swift package diagnose-api-breaking-changes origin/main | |
linux-all: | |
if: ${{ !(github.event.pull_request.draft || false) }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- postgres-image-a: 'postgres:13' | |
postgres-image-b: 'postgres:14' | |
postgres-auth: 'trust' | |
swift-image: 'swift:5.8-focal' | |
- postgres-image-a: 'postgres:15' | |
postgres-image-b: 'postgres:16' | |
postgres-auth: 'md5' | |
swift-image: 'swift:5.10-jammy' | |
- postgres-image-a: 'postgres:15' | |
postgres-image-b: 'postgres:16' | |
postgres-auth: 'scram-sha-256' | |
swift-image: 'swiftlang/swift:nightly-6.0-jammy' | |
container: ${{ matrix.swift-image }} | |
runs-on: ubuntu-latest | |
services: | |
psql-a: | |
image: ${{ matrix.postgres-image-a }} | |
env: | |
POSTGRES_USER: 'test_username' | |
POSTGRES_DB: 'test_database_a' | |
POSTGRES_PASSWORD: 'test_password' | |
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }} | |
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }} | |
psql-b: | |
image: ${{ matrix.postgres-image-b }} | |
env: | |
POSTGRES_USER: 'test_username' | |
POSTGRES_DB: 'test_database_b' | |
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@v4 | |
- name: Run all tests | |
run: swift test --sanitize=thread --enable-code-coverage | |
- name: Submit coverage report to Codecov.io | |
uses: vapor/[email protected] | |
with: | |
codecov_token: ${{ secrets.CODECOV_TOKEN }} | |
macos-all: | |
if: ${{ !(github.event.pull_request.draft || false) }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- macos-version: macos-13 | |
xcode-version: '~14.3' | |
- macos-version: macos-14 | |
xcode-version: latest | |
runs-on: ${{ matrix.macos-version }} | |
env: | |
LOG_LEVEL: debug | |
POSTGRES_HOSTNAME: 127.0.0.1 | |
POSTGRES_HOSTNAME_A: 127.0.0.1 | |
POSTGRES_HOSTNAME_B: 127.0.0.1 | |
steps: | |
- name: Select latest available Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ matrix.xcode-version }} | |
- name: Install Postgres, setup DB and auth, and wait for server start | |
run: | | |
brew upgrade || true | |
export PATH="$(brew --prefix)/opt/postgresql@16/bin:$PATH" PGDATA=/tmp/vapor-postgres-test PGUSER="${POSTGRES_USER_A}" | |
(brew unlink postgresql@14 || true) && brew install postgresql@16 && brew link --force postgresql@16 | |
initdb --locale=C --auth-host "scram-sha-256" -U "${POSTGRES_USER_A}" --pwfile=<(echo "${POSTGRES_PASSWORD_A}") | |
pg_ctl start --wait | |
PGPASSWORD="${POSTGRES_PASSWORD_A}" createdb -w -O "${POSTGRES_USER_A}" "${POSTGRES_DB_A}" | |
PGPASSWORD="${POSTGRES_PASSWORD_A}" createdb -w -O "${POSTGRES_USER_B}" "${POSTGRES_DB_B}" | |
PGPASSWORD="${POSTGRES_PASSWORD_A}" psql -w "${POSTGRES_DB_A}" <<<"ALTER SCHEMA public OWNER TO ${POSTGRES_USER_A};" | |
PGPASSWORD="${POSTGRES_PASSWORD_A}" psql -w "${POSTGRES_DB_B}" <<<"ALTER SCHEMA public OWNER TO ${POSTGRES_USER_B};" | |
timeout-minutes: 15 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run all tests | |
run: swift test --sanitize=thread |