Skip to content

Commit ce59628

Browse files
authored
Fix several CI issues (#579)
* Fix several CI issues - Update the list of versions for Swift images - Update actions/checkout to v5 - Disable TSan when building with Swift 5.10 and 6.0 due to swift-crypto hitting a compiler crasher - Add macOS Sequoia tests - Remove Homebrew bug workaround (no longer needed) * Fix macOS test matrix * Tests can't safely make assumptions about stdlib capacity behavior
1 parent 8ee6118 commit ce59628

File tree

2 files changed

+25
-40
lines changed

2 files changed

+25
-40
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
- swift:5.10-jammy
2222
- swift:6.0-noble
2323
- swift:6.1-noble
24-
- swiftlang/swift:nightly-main-jammy
24+
- swiftlang/swift:nightly-6.2-noble
25+
- swiftlang/swift:nightly-main-noble
2526
container: ${{ matrix.swift-image }}
2627
runs-on: ubuntu-latest
2728
steps:
@@ -32,11 +33,16 @@ jobs:
3233
[[ -z "${SWIFT_VERSION}" ]] && SWIFT_VERSION="$(cat /.swift_tag 2>/dev/null || true)"
3334
printf 'OS: %s\nTag: %s\nVersion:\n' "${SWIFT_PLATFORM}-${RUNNER_ARCH}" "${SWIFT_VERSION}"
3435
swift --version
36+
- name: Install curl for Codecov
37+
run: apt-get update -y -q && apt-get install -y curl
3538
- name: Check out package
36-
uses: actions/checkout@v4
39+
uses: actions/checkout@v5
3740
- name: Run unit tests with Thread Sanitizer
41+
shell: bash
3842
run: |
39-
swift test --filter='^(PostgresNIOTests|ConnectionPoolModuleTests)' --sanitize=thread --enable-code-coverage
43+
# https://github.com/swiftlang/swift/issues/74042 was never fixed in 5.10 and swift-crypto hits it in 6.0 as well
44+
SANITIZE="$([[ "${SWIFT_VERSION}" =~ ^swift-(5|6\.0) ]] || echo '--sanitize=thread')"
45+
swift test --filter='^(PostgresNIOTests|ConnectionPoolModuleTests)' ${SANITIZE} --enable-code-coverage
4046
- name: Submit code coverage
4147
uses: vapor/swift-codecov-action@v0.3
4248
with:
@@ -103,15 +109,15 @@ jobs:
103109
[[ -z "${SWIFT_VERSION}" ]] && SWIFT_VERSION="$(cat /.swift_tag 2>/dev/null || true)"
104110
printf 'OS: %s\nTag: %s\nVersion:\n' "${SWIFT_PLATFORM}-${RUNNER_ARCH}" "${SWIFT_VERSION}" && swift --version
105111
- name: Check out package
106-
uses: actions/checkout@v4
112+
uses: actions/checkout@v5
107113
with: { path: 'postgres-nio' }
108114
- name: Run integration tests
109115
run: swift test --package-path postgres-nio --filter=^IntegrationTests
110116
- name: Check out postgres-kit dependent
111-
uses: actions/checkout@v4
117+
uses: actions/checkout@v5
112118
with: { repository: 'vapor/postgres-kit', path: 'postgres-kit' }
113119
- name: Check out fluent-postgres-driver dependent
114-
uses: actions/checkout@v4
120+
uses: actions/checkout@v5
115121
with: { repository: 'vapor/fluent-postgres-driver', path: 'fluent-postgres-driver' }
116122
- name: Use local package in dependents
117123
run: |
@@ -132,11 +138,14 @@ jobs:
132138
postgres-auth:
133139
# Only test one auth method on macOS, Linux tests will cover the others
134140
- scram-sha-256
135-
xcode-version:
136-
- '~15'
141+
macos-version:
142+
- 'macos-14'
143+
- 'macos-15'
137144
include:
138-
- xcode-version: '~15'
139-
macos-version: 'macos-14'
145+
- macos-version: 'macos-14'
146+
xcode-version: 'latest-stable'
147+
- macos-version: 'macos-15'
148+
xcode-version: 'latest-stable'
140149
runs-on: ${{ matrix.macos-version }}
141150
env:
142151
POSTGRES_HOSTNAME: 127.0.0.1
@@ -154,18 +163,13 @@ jobs:
154163
- name: Install Postgres, setup DB and auth, and wait for server start
155164
run: |
156165
export PATH="$(brew --prefix)/opt/${POSTGRES_FORMULA}/bin:$PATH" PGDATA=/tmp/vapor-postgres-test
157-
# ** BEGIN ** Work around bug in both Homebrew and GHA
158-
(brew upgrade python@3.11 || true) && (brew link --force --overwrite python@3.11 || true)
159-
(brew upgrade python@3.12 || true) && (brew link --force --overwrite python@3.12 || true)
160-
(brew upgrade || true)
161-
# ** END ** Work around bug in both Homebrew and GHA
162166
brew install --overwrite "${POSTGRES_FORMULA}"
163167
brew link --overwrite --force "${POSTGRES_FORMULA}"
164168
initdb --locale=C --auth-host "${POSTGRES_AUTH_METHOD}" -U "${POSTGRES_USER}" --pwfile=<(echo "${POSTGRES_PASSWORD}")
165169
pg_ctl start --wait
166170
timeout-minutes: 15
167171
- name: Checkout code
168-
uses: actions/checkout@v4
172+
uses: actions/checkout@v5
169173
- name: Run all tests
170174
run: swift test
171175

@@ -175,30 +179,11 @@ jobs:
175179
container: swift:noble
176180
steps:
177181
- name: Checkout
178-
uses: actions/checkout@v4
182+
uses: actions/checkout@v5
179183
with:
180184
fetch-depth: 0
181185
# https://github.com/actions/checkout/issues/766
182186
- name: API breaking changes
183187
run: |
184188
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
185189
swift package diagnose-api-breaking-changes origin/main
186-
187-
# gh-codeql:
188-
# if: ${{ false }}
189-
# runs-on: ubuntu-latest
190-
# container: swift:noble
191-
# permissions: { actions: write, contents: read, security-events: write }
192-
# steps:
193-
# - name: Check out code
194-
# uses: actions/checkout@v4
195-
# - name: Mark repo safe in non-fake global config
196-
# run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
197-
# - name: Initialize CodeQL
198-
# uses: github/codeql-action/init@v3
199-
# with:
200-
# languages: swift
201-
# - name: Perform build
202-
# run: swift build
203-
# - name: Run CodeQL analyze
204-
# uses: github/codeql-action/analyze@v3

Tests/ConnectionPoolModuleTests/TinyFastSequenceTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class TinyFastSequenceTests: XCTestCase {
3434
guard case .n(let array) = emptySequence.base else {
3535
return XCTFail("Expected sequence to be backed by an array")
3636
}
37-
XCTAssertEqual(array.capacity, 8)
37+
XCTAssertGreaterThanOrEqual(array.capacity, 8)
3838

3939
var oneElemSequence = TinyFastSequence<Int>(element: 1)
4040
oneElemSequence.reserveCapacity(8)
@@ -43,22 +43,22 @@ final class TinyFastSequenceTests: XCTestCase {
4343
guard case .n(let array) = oneElemSequence.base else {
4444
return XCTFail("Expected sequence to be backed by an array")
4545
}
46-
XCTAssertEqual(array.capacity, 8)
46+
XCTAssertGreaterThanOrEqual(array.capacity, 8)
4747

4848
var twoElemSequence = TinyFastSequence<Int>([1, 2])
4949
twoElemSequence.reserveCapacity(8)
5050
twoElemSequence.append(3)
5151
guard case .n(let array) = twoElemSequence.base else {
5252
return XCTFail("Expected sequence to be backed by an array")
5353
}
54-
XCTAssertEqual(array.capacity, 8)
54+
XCTAssertGreaterThanOrEqual(array.capacity, 8)
5555

5656
var threeElemSequence = TinyFastSequence<Int>([1, 2, 3])
5757
threeElemSequence.reserveCapacity(8)
5858
guard case .n(let array) = threeElemSequence.base else {
5959
return XCTFail("Expected sequence to be backed by an array")
6060
}
61-
XCTAssertEqual(array.capacity, 8)
61+
XCTAssertGreaterThanOrEqual(array.capacity, 8)
6262
}
6363

6464
func testNewSequenceSlowPath() {

0 commit comments

Comments
 (0)