Skip to content

Commit 8bf03af

Browse files
authored
Additional updates: Add permissions, remove unneeded TSan workaround, bump Postgres version matrix, simplify config for downstream deps, bump macOS runner versions, add code coverage for macOS tests
1 parent a4b19fb commit 8bf03af

File tree

1 file changed

+23
-39
lines changed

1 file changed

+23
-39
lines changed

.github/workflows/test.yml

Lines changed: 23 additions & 39 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/swift-codecov-action@v0.3
4746
with:
@@ -53,17 +52,14 @@ jobs:
5352
matrix:
5453
postgres-image:
5554
- postgres:18
56-
- postgres:17
57-
- postgres:15
58-
- postgres:13
55+
- postgres:16
56+
- postgres:14
5957
include:
6058
- postgres-image: postgres:18
6159
postgres-auth: scram-sha-256
62-
- postgres-image: postgres:17
63-
postgres-auth: scram-sha-256
64-
- postgres-image: postgres:15
60+
- postgres-image: postgres:16
6561
postgres-auth: md5
66-
- postgres-image: postgres:13
62+
- postgres-image: postgres:14
6763
postgres-auth: trust
6864
container:
6965
image: swift:6.2-noble
@@ -72,30 +68,14 @@ jobs:
7268
env:
7369
# Unfortunately, fluent-postgres-driver details leak through here
7470
POSTGRES_DB: 'test_database'
75-
POSTGRES_DB_A: 'test_database'
76-
POSTGRES_DB_B: 'test_database'
7771
POSTGRES_USER: 'test_username'
78-
POSTGRES_USER_A: 'test_username'
79-
POSTGRES_USER_B: 'test_username'
8072
POSTGRES_PASSWORD: 'test_password'
81-
POSTGRES_PASSWORD_A: 'test_password'
82-
POSTGRES_PASSWORD_B: 'test_password'
8373
POSTGRES_HOSTNAME: 'psql-a'
84-
POSTGRES_HOSTNAME_A: 'psql-a'
8574
POSTGRES_HOSTNAME_B: 'psql-b'
8675
POSTGRES_SOCKET: '/var/run/postgresql/.s.PGSQL.5432'
8776
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
8877
services:
89-
psql-a:
90-
image: ${{ matrix.postgres-image }}
91-
volumes: [ 'pgrunshare:/var/run/postgresql' ]
92-
env:
93-
POSTGRES_USER: 'test_username'
94-
POSTGRES_DB: 'test_database'
95-
POSTGRES_PASSWORD: 'test_password'
96-
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
97-
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }}
98-
psql-b:
78+
psql-a: &psql_service_spec
9979
image: ${{ matrix.postgres-image }}
10080
volumes: [ 'pgrunshare:/var/run/postgresql' ]
10181
env:
@@ -104,6 +84,7 @@ jobs:
10484
POSTGRES_PASSWORD: 'test_password'
10585
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
10686
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }}
87+
psql-b: *psql_service_spec
10788
steps:
10889
- name: Display OS and Swift versions
10990
run: |
@@ -136,18 +117,18 @@ jobs:
136117
matrix:
137118
postgres-formula:
138119
# Only test one version on macOS, let Linux do the rest
139-
- postgresql@16
120+
- postgresql@17
140121
postgres-auth:
141122
# Only test one auth method on macOS, Linux tests will cover the others
142123
- scram-sha-256
143124
macos-version:
144-
- 'macos-14'
145-
- 'macos-15'
125+
- macos-15
126+
- macos-26
146127
include:
147-
- macos-version: 'macos-14'
148-
xcode-version: 'latest-stable'
149-
- macos-version: 'macos-15'
150-
xcode-version: 'latest-stable'
128+
- macos-version: macos-15
129+
xcode-version: latest-stable
130+
- macos-version: macos-26
131+
xcode-version: latest-stable
151132
runs-on: ${{ matrix.macos-version }}
152133
env:
153134
POSTGRES_HOSTNAME: 127.0.0.1
@@ -164,16 +145,19 @@ jobs:
164145
xcode-version: ${{ matrix.xcode-version }}
165146
- name: Install Postgres, setup DB and auth, and wait for server start
166147
run: |
167-
export PATH="$(brew --prefix)/opt/${POSTGRES_FORMULA}/bin:$PATH" PGDATA=/tmp/vapor-postgres-test
168-
brew install --overwrite "${POSTGRES_FORMULA}"
169-
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}"
170150
initdb --locale=C --auth-host "${POSTGRES_AUTH_METHOD}" -U "${POSTGRES_USER}" --pwfile=<(echo "${POSTGRES_PASSWORD}")
171151
pg_ctl start --wait
172152
timeout-minutes: 15
173153
- name: Checkout code
174154
uses: actions/checkout@v5
175155
- name: Run all tests
176-
run: swift test
156+
run: swift test --enable-code-coverage
157+
- name: Submit code coverage
158+
uses: vapor/swift-codecov-action@v0.3
159+
with:
160+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
177161

178162
api-breakage:
179163
if: github.event_name == 'pull_request'

0 commit comments

Comments
 (0)