Skip to content

Commit

Permalink
Avoid double-logging queries (#110)
Browse files Browse the repository at this point in the history
* This logging is handled in MySQLKit and should not be present at the MySQLNIO layer.

* Fix CI
  • Loading branch information
gwynne authored May 29, 2024
1 parent 605fe1d commit d60444d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 66 deletions.
11 changes: 0 additions & 11 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version: 2
enable-beta-ecosystems: true
updates:
- package-ecosystem: "github-actions"
directory: "/"
Expand All @@ -9,13 +8,3 @@ updates:
dependencies:
patterns:
- "*"
- package-ecosystem: "swift"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-type: all
groups:
all-dependencies:
patterns:
- "*"
85 changes: 32 additions & 53 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ env:
MYSQL_HOSTNAME_B: 'mysql-b'

jobs:
dependency-graph:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
container: swift:jammy
permissions:
contents: write
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Fix Git configuration
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
apt-get update && apt-get install -y curl
- name: Submit dependency graph
uses: vapor-community/[email protected]
with:
path: ${{ github.workspace }}

api-breakage:
if: ${{ !(github.event.pull_request.draft || false) }}
runs-on: ubuntu-latest
Expand All @@ -53,33 +35,26 @@ jobs:
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
swift package diagnose-api-breaking-changes origin/main
gh-codeql:
if: ${{ !(github.event.pull_request.draft || false) }}
runs-on: ubuntu-latest
container:
image: swift:5.9-jammy
permissions: { actions: write, contents: read, security-events: write }
timeout-minutes: 60
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: Check Swift compatibility
id: swift-check
uses: vapor/ci/.github/actions/check-compatible-swift@main
- name: Initialize CodeQL
if: ${{ steps.swift-check.outputs.swift-compatible == 'true' }}
uses: github/codeql-action/init@v3
with: { languages: swift }
- name: Perform build
if: ${{ steps.swift-check.outputs.swift-compatible == 'true' }}
run: |
swift build
- name: Run CodeQL analyze
if: ${{ steps.swift-check.outputs.swift-compatible == 'true' }}
uses: github/codeql-action/analyze@v3
# gh-codeql:
# if: ${{ !(github.event.pull_request.draft || false) }}
# runs-on: ubuntu-latest
# permissions: { actions: write, contents: read, security-events: write }
# timeout-minutes: 30
# steps:
# - name: Install latest Swift toolchain
# uses: vapor/[email protected]
# with: { toolchain: latest }
# - name: Check out code
# uses: actions/checkout@v4
# - name: Fix Git configuration
# run: 'git config --global --add safe.directory "${GITHUB_WORKSPACE}"'
# - name: Initialize CodeQL
# uses: github/codeql-action/init@v3
# with: { languages: swift }
# - name: Perform build
# run: 'swift build ${PACKAGE_ROOT} ${EXTRA_FLAGS}'
# - name: Run CodeQL analyze
# uses: github/codeql-action/analyze@v3

linux-all:
if: ${{ !(github.event.pull_request.draft || false) }}
Expand All @@ -94,10 +69,10 @@ jobs:
- percona:5.7
- percona:8
swiftver:
- 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-6.0-jammy
- swiftlang/swift:nightly-main-jammy
runs-on: ubuntu-latest
container: ${{ matrix.swiftver }}
Expand All @@ -115,8 +90,9 @@ jobs:
- name: Run unit tests
run: swift test --package-path mysql-nio --enable-code-coverage --sanitize=thread
- name: Upload code coverage
uses: vapor/swift-codecov-action@v0.2
uses: vapor/swift-codecov-action@v0.3
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
package_path: 'mysql-nio'
- name: Check out mysql-kit dependent
uses: actions/checkout@v4
Expand All @@ -139,18 +115,19 @@ jobs:
fail-fast: false
matrix:
dbimage: [mysql, mariadb, percona-server]
xcode: ['~14.3', 'latest']
macos: ['macos-13']
macos-version: ['macos-13', 'macos-14']
include:
- { username: root }
- { dbimage: mariadb, username: runner }
runs-on: ${{ matrix.macos }}
- { macos-version: 'macos-13', xcode-version: '~15.2' }
- { macos-version: 'macos-14', xcode-version: 'latest' }
runs-on: ${{ matrix.macos-version }}
env: { MYSQL_HOSTNAME: '127.0.0.1' }
steps:
- name: Select latest available Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
xcode-version: ${{ matrix.xcode-version }}
- name: Install MySQL, setup DB and auth, and wait for server start
env:
FORMULA: ${{ matrix.dbimage }}
Expand All @@ -171,4 +148,6 @@ jobs:
- name: Run all tests
run: swift test --sanitize=thread --enable-code-coverage
- name: Upload code coverage
uses: vapor/[email protected]
uses: vapor/[email protected]
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
1 change: 0 additions & 1 deletion Sources/MySQLNIO/MySQLQueryCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ extension MySQLDatabase {
onRow: @escaping (MySQLRow) throws -> (),
onMetadata: @escaping (MySQLQueryMetadata) throws -> () = { _ in }
) -> EventLoopFuture<Void> {
self.logger.debug("\(sql) \(binds)")
let query = MySQLQueryCommand(
sql: sql,
binds: binds,
Expand Down
1 change: 0 additions & 1 deletion Sources/MySQLNIO/MySQLSimpleQueryCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ extension MySQLDatabase {
}

public func simpleQuery(_ sql: String, onRow: @escaping (MySQLRow) -> ()) -> EventLoopFuture<Void> {
self.logger.debug("\(sql)")
let query = MySQLSimpleQueryCommand(sql: sql, onRow: onRow)
return self.send(query, logger: self.logger)
}
Expand Down

0 comments on commit d60444d

Please sign in to comment.