Skip to content

Commit db1eae1

Browse files
zunda-pixelgwynne
andauthored
Add Postgres v18 for tests (#597)
Co-authored-by: Gwynne Raskind <[email protected]> Co-authored-by: Gwynne Raskind <[email protected]>
1 parent 4795a0b commit db1eae1

File tree

2 files changed

+28
-38
lines changed

2 files changed

+28
-38
lines changed

.github/workflows/api-docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
push:
44
branches:
55
- main
6+
permissions:
7+
contents: read
8+
id-token: write
69

710
jobs:
811
build-and-deploy:

.github/workflows/test.yml

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
- "*"
1212
env:
1313
LOG_LEVEL: info
14+
permissions:
15+
contents: read
1416

1517
jobs:
1618
linux-unit:
@@ -37,11 +39,8 @@ jobs:
3739
- name: Check out package
3840
uses: actions/checkout@v5
3941
- name: Run unit tests with Thread Sanitizer
40-
shell: bash
4142
run: |
42-
# https://github.com/swiftlang/swift/issues/74042 was never fixed in 5.10 and swift-crypto hits it in 6.0 as well
43-
SANITIZE="$([[ "${SWIFT_VERSION}" =~ ^swift-(5|6\.0) ]] || echo '--sanitize=thread')"
44-
swift test --filter='^(PostgresNIOTests|ConnectionPoolModuleTests)' ${SANITIZE} --enable-code-coverage
43+
swift test --filter='^(PostgresNIOTests|ConnectionPoolModuleTests)' --sanitize=thread --enable-code-coverage
4544
- name: Submit code coverage
4645
uses: vapor/[email protected]
4746
with:
@@ -52,15 +51,15 @@ jobs:
5251
fail-fast: false
5352
matrix:
5453
postgres-image:
55-
- postgres:17
56-
- postgres:15
57-
- postgres:13
54+
- postgres:18
55+
- postgres:16
56+
- postgres:14
5857
include:
59-
- postgres-image: postgres:17
58+
- postgres-image: postgres:18
6059
postgres-auth: scram-sha-256
61-
- postgres-image: postgres:15
60+
- postgres-image: postgres:16
6261
postgres-auth: md5
63-
- postgres-image: postgres:13
62+
- postgres-image: postgres:14
6463
postgres-auth: trust
6564
container:
6665
image: swift:6.2-noble
@@ -69,30 +68,14 @@ jobs:
6968
env:
7069
# Unfortunately, fluent-postgres-driver details leak through here
7170
POSTGRES_DB: 'test_database'
72-
POSTGRES_DB_A: 'test_database'
73-
POSTGRES_DB_B: 'test_database'
7471
POSTGRES_USER: 'test_username'
75-
POSTGRES_USER_A: 'test_username'
76-
POSTGRES_USER_B: 'test_username'
7772
POSTGRES_PASSWORD: 'test_password'
78-
POSTGRES_PASSWORD_A: 'test_password'
79-
POSTGRES_PASSWORD_B: 'test_password'
8073
POSTGRES_HOSTNAME: 'psql-a'
81-
POSTGRES_HOSTNAME_A: 'psql-a'
8274
POSTGRES_HOSTNAME_B: 'psql-b'
8375
POSTGRES_SOCKET: '/var/run/postgresql/.s.PGSQL.5432'
8476
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
8577
services:
86-
psql-a:
87-
image: ${{ matrix.postgres-image }}
88-
volumes: [ 'pgrunshare:/var/run/postgresql' ]
89-
env:
90-
POSTGRES_USER: 'test_username'
91-
POSTGRES_DB: 'test_database'
92-
POSTGRES_PASSWORD: 'test_password'
93-
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
94-
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }}
95-
psql-b:
78+
psql-a: &psql_service_spec
9679
image: ${{ matrix.postgres-image }}
9780
volumes: [ 'pgrunshare:/var/run/postgresql' ]
9881
env:
@@ -101,6 +84,7 @@ jobs:
10184
POSTGRES_PASSWORD: 'test_password'
10285
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
10386
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }}
87+
psql-b: *psql_service_spec
10488
steps:
10589
- name: Display OS and Swift versions
10690
run: |
@@ -133,18 +117,18 @@ jobs:
133117
matrix:
134118
postgres-formula:
135119
# Only test one version on macOS, let Linux do the rest
136-
- postgresql@16
120+
- postgresql@17
137121
postgres-auth:
138122
# Only test one auth method on macOS, Linux tests will cover the others
139123
- scram-sha-256
140124
macos-version:
141-
- 'macos-14'
142-
- 'macos-15'
125+
- macos-15
126+
- macos-26
143127
include:
144-
- macos-version: 'macos-14'
145-
xcode-version: 'latest-stable'
146-
- macos-version: 'macos-15'
147-
xcode-version: 'latest-stable'
128+
- macos-version: macos-15
129+
xcode-version: latest-stable
130+
- macos-version: macos-26
131+
xcode-version: latest-stable
148132
runs-on: ${{ matrix.macos-version }}
149133
env:
150134
POSTGRES_HOSTNAME: 127.0.0.1
@@ -161,16 +145,19 @@ jobs:
161145
xcode-version: ${{ matrix.xcode-version }}
162146
- name: Install Postgres, setup DB and auth, and wait for server start
163147
run: |
164-
export PATH="$(brew --prefix)/opt/${POSTGRES_FORMULA}/bin:$PATH" PGDATA=/tmp/vapor-postgres-test
165-
brew install --overwrite "${POSTGRES_FORMULA}"
166-
brew link --overwrite --force "${POSTGRES_FORMULA}"
148+
export PGDATA=/tmp/vapor-postgres-test
149+
brew install --overwrite "${POSTGRES_FORMULA}" && brew link --overwrite --force "${POSTGRES_FORMULA}"
167150
initdb --locale=C --auth-host "${POSTGRES_AUTH_METHOD}" -U "${POSTGRES_USER}" --pwfile=<(echo "${POSTGRES_PASSWORD}")
168151
pg_ctl start --wait
169152
timeout-minutes: 15
170153
- name: Checkout code
171154
uses: actions/checkout@v5
172155
- name: Run all tests
173-
run: swift test
156+
run: swift test --enable-code-coverage
157+
- name: Submit code coverage
158+
uses: vapor/[email protected]
159+
with:
160+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
174161

175162
api-breakage:
176163
if: github.event_name == 'pull_request'

0 commit comments

Comments
 (0)