Skip to content

Commit

Permalink
Minor package cleanup (#464)
Browse files Browse the repository at this point in the history
* Disable CodeQL CI, since GitHub seems disinclined to fix their mistakes.
* Fix a few very minor issues in the API docs and README.
* Make LOG_LEVEL env actually work in tests
* Update CI for Swift 5.10 release
* We only need two macOS tests, not four
  • Loading branch information
gwynne committed Mar 8, 2024
1 parent b6496eb commit 43929b0
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 132 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- swift:5.7-jammy
- swift:5.8-jammy
- swift:5.9-jammy
- swiftlang/swift:nightly-5.10-jammy
- swift:5.10-jammy
- swiftlang/swift:nightly-main-jammy
include:
- swift-image: swift:5.9-jammy
- swift-image: swift:5.10-jammy
code-coverage: true
container: ${{ matrix.swift-image }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- postgres-image: postgres:12
postgres-auth: trust
container:
image: swift:5.9-jammy
image: swift:5.10-jammy
volumes: [ 'pgrunshare:/var/run/postgresql' ]
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -140,7 +140,12 @@ jobs:
xcode-version:
- '~14.3'
- '~15.0'
runs-on: macos-13
include:
- xcode-version: '~14.3'
macos-version: 'macos-13'
- xcode-version: '~15.0'
macos-version: 'macos-14'
runs-on: ${{ matrix.macos-version }}
env:
POSTGRES_HOSTNAME: 127.0.0.1
POSTGRES_USER: 'test_username'
Expand Down Expand Up @@ -188,19 +193,20 @@ jobs:
swift package diagnose-api-breaking-changes origin/main
gh-codeql:
if: ${{ false }}
runs-on: ubuntu-latest
container: swift:5.9-jammy
container: swift:jammy
permissions: { actions: write, contents: read, security-events: write }
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Mark repo safe in non-fake global config
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: swift
- name: Perform build
run: swift build
- name: Run CodeQL analyze
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<img src="https://img.shields.io/github/actions/workflow/status/vapor/postgres-nio/test.yml?event=push&style=plastic&logo=github&label=tests&logoColor=%23ccc" alt="Continuous Integration">
</a>
<a href="https://swift.org">
<img src="https://design.vapor.codes/images/swift57up.svg" alt="Swift 5.7 +">
<img src="https://design.vapor.codes/images/swift57up.svg" alt="Swift 5.7+">
</a>
<a name="https://www.swift.org/sswg/incubation-process.html">
<img src="https://img.shields.io/badge/sswg-graduated-white.svg?style=plastic&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImIiPjxzdG9wIHN0b3AtY29sb3I9IiNmZDIwMjAiIHN0eWxlPSJzdG9wLWNvbG9yOiNlMDE1OTUiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiNmODhhMzYiIHN0eWxlPSJzdG9wLWNvbG9yOiNhNTNmOGEiIG9mZnNldD0iLjY5OSIvPjwvbGluZWFyR3JhZGllbnQ%2BPGxpbmVhckdyYWRpZW50IGlkPSJjIiB4MT0iNDIzIiB4Mj0iNzMiIHkxPSI3MyIgeTI9IjQyMyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4LDgpIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgaHJlZj0iI2IiLz48L2RlZnM%2BPGZpbHRlciBpZD0iYSIgeD0iLS4wNDQ0NyIgeT0iLS4wNDQ0NyIgd2lkdGg9IjEuMDg5IiBoZWlnaHQ9IjEuMDk1Ij48ZmVPZmZzZXQgZHg9IjAi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i44IDM0LjcgNjIuOCA3Ny4yIDEwNSAxMDkuN2wwLjEgMC4xYy0yOS43IDE4LjQtNzIgMTkuOC0xMTQuMi0wLjEtMTAuNi00LjktMjAuNC0xMC42LTI4LjktMTcuNyAxNy42IDI4LjMgNDUuMSA1My4xIDc4LjIgNjcuMyA0MC45IDE3LjYgODEuNiAxNS44IDExMS4xLTEuMyAxNC40LTYuMSA0Mi43LTE1LjMgNTggMTQuNyAzLjUgNy4xIDExLjMtMzAuNC0xNi45LTY1LjgtMC4yLTAuMi0wLjMtMC40LTAuNS0wLjYgMC40LTEuNCAwLjgtMi45IDEuMi00LjQgMTQuMS01NC41LTE5LjctMTE5LjYtNzYuOC0xNTQuM3oiIHN0eWxlPSJmaWxsOnVybCgjZCkiLz48L3N2Zz4K&labelColor=gray&color=%23e01595" alt="SSWG Incubation Level: Graduated">
<a href="https://www.swift.org/sswg/incubation-process.html">
<img src="https://design.vapor.codes/images/sswg-graduated.svg" alt="SSWG Incubation Level: Graduated">
</a>
</p>

Expand Down
1 change: 0 additions & 1 deletion Sources/PostgresNIO/Docs.docc/images/article.svg

This file was deleted.

60 changes: 0 additions & 60 deletions Sources/PostgresNIO/Docs.docc/images/vapor-postgres-logo.svg

This file was deleted.

21 changes: 21 additions & 0 deletions Sources/PostgresNIO/Docs.docc/images/vapor-postgresnio-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 18 additions & 43 deletions Sources/PostgresNIO/Docs.docc/theme-settings.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
{
"theme": {
"aside": {
"border-radius": "6px",
"border-style": "double",
"border-width": "3px"
},
"border-radius": "0",
"button": {
"border-radius": "16px",
"border-width": "1px",
"border-style": "solid"
},
"code": {
"border-radius": "16px",
"border-width": "1px",
"border-style": "solid"
},
"color": {
"fill": {
"dark": "rgb(0, 0, 0)",
"light": "rgb(255, 255, 255)"
},
"psql-blue": "#336791",
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-documentation-intro-accent) 30%, #000 100%)",
"documentation-intro-accent": "var(--color-psql-blue)",
"documentation-intro-accent-outer": {
"dark": "rgb(255, 255, 255)",
"light": "rgb(0, 0, 0)"
},
"documentation-intro-accent-inner": {
"dark": "rgb(0, 0, 0)",
"light": "rgb(255, 255, 255)"
}
},
"icons": {
"technology": "/postgresnio/images/vapor-postgres-logo.svg",
"article": "/postgresnio/images/article.svg"
}
"theme": {
"aside": { "border-radius": "6px", "border-style": "double", "border-width": "3px" },
"border-radius": "0",
"button": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
"code": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
"color": {
"psqlnio": "#336791",
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-psqlnio) 30%, #000 100%)",
"documentation-intro-accent": "var(--color-psqlnio)",
"logo-base": { "dark": "#fff", "light": "#000" },
"logo-shape": { "dark": "#000", "light": "#fff" },
"fill": { "dark": "#000", "light": "#fff" }
},
"features": {
"quickNavigation": {
"enable": true
}
}
"icons": { "technology": "/postgresnio/images/vapor-postgresnio-logo.svg" }
},
"features": {
"quickNavigation": { "enable": true },
"i18n": { "enable": true }
}
}
8 changes: 5 additions & 3 deletions Tests/IntegrationTests/PostgresNIOTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import NIOSSL
final class PostgresNIOTests: XCTestCase {

private var group: EventLoopGroup!

private var eventLoop: EventLoop { self.group.next() }

override class func setUp() {
XCTAssertTrue(isLoggingConfigured)
}

override func setUpWithError() throws {
try super.setUpWithError()
XCTAssertTrue(isLoggingConfigured)
self.group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
}

Expand Down Expand Up @@ -1475,7 +1477,7 @@ final class PostgresNIOTests: XCTestCase {
let isLoggingConfigured: Bool = {
LoggingSystem.bootstrap { label in
var handler = StreamLogHandler.standardOutput(label: label)
handler.logLevel = env("LOG_LEVEL").flatMap { Logger.Level(rawValue: $0) } ?? .debug
handler.logLevel = env("LOG_LEVEL").flatMap { .init(rawValue: $0) } ?? .info
return handler
}
return true
Expand Down
22 changes: 7 additions & 15 deletions Tests/IntegrationTests/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ extension PostgresConnection {
}
}

static func test(on eventLoop: EventLoop, logLevel: Logger.Level = .info) -> EventLoopFuture<PostgresConnection> {
var logger = Logger(label: "postgres.connection.test")
logger.logLevel = logLevel

static func test(on eventLoop: EventLoop) -> EventLoopFuture<PostgresConnection> {
let logger = Logger(label: "postgres.connection.test")
let config = PostgresConnection.Configuration(
host: env("POSTGRES_HOSTNAME") ?? "localhost",
port: env("POSTGRES_PORT").flatMap(Int.init(_:)) ?? 5432,
Expand All @@ -40,10 +38,8 @@ extension PostgresConnection {
return PostgresConnection.connect(on: eventLoop, configuration: config, id: 0, logger: logger)
}

static func testUDS(on eventLoop: EventLoop, logLevel: Logger.Level = .info) -> EventLoopFuture<PostgresConnection> {
var logger = Logger(label: "postgres.connection.test")
logger.logLevel = logLevel

static func testUDS(on eventLoop: EventLoop) -> EventLoopFuture<PostgresConnection> {
let logger = Logger(label: "postgres.connection.test")
let config = PostgresConnection.Configuration(
unixSocketPath: env("POSTGRES_SOCKET") ?? "/tmp/.s.PGSQL.\(env("POSTGRES_PORT").flatMap(Int.init(_:)) ?? 5432)",
username: env("POSTGRES_USER") ?? "test_username",
Expand All @@ -54,10 +50,8 @@ extension PostgresConnection {
return PostgresConnection.connect(on: eventLoop, configuration: config, id: 0, logger: logger)
}

static func testChannel(_ channel: Channel, on eventLoop: EventLoop, logLevel: Logger.Level = .info) -> EventLoopFuture<PostgresConnection> {
var logger = Logger(label: "postgres.connection.test")
logger.logLevel = logLevel

static func testChannel(_ channel: Channel, on eventLoop: EventLoop) -> EventLoopFuture<PostgresConnection> {
let logger = Logger(label: "postgres.connection.test")
let config = PostgresConnection.Configuration(
establishedChannel: channel,
username: env("POSTGRES_USER") ?? "test_username",
Expand All @@ -71,9 +65,7 @@ extension PostgresConnection {

extension Logger {
static var psqlTest: Logger {
var logger = Logger(label: "psql.test")
logger.logLevel = .info
return logger
.init(label: "psql.test")
}
}

Expand Down

0 comments on commit 43929b0

Please sign in to comment.