From d60444dc7b1525000eb443baa08bf79f059202ad Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Wed, 29 May 2024 12:07:57 -0500 Subject: [PATCH] Avoid double-logging queries (#110) * This logging is handled in MySQLKit and should not be present at the MySQLNIO layer. * Fix CI --- .github/dependabot.yml | 11 --- .github/workflows/test.yml | 85 +++++++------------ Sources/MySQLNIO/MySQLQueryCommand.swift | 1 - .../MySQLNIO/MySQLSimpleQueryCommand.swift | 1 - 4 files changed, 32 insertions(+), 66 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8e352f4..998a0eb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,4 @@ version: 2 -enable-beta-ecosystems: true updates: - package-ecosystem: "github-actions" directory: "/" @@ -9,13 +8,3 @@ updates: dependencies: patterns: - "*" - - package-ecosystem: "swift" - directory: "/" - schedule: - interval: "daily" - allow: - - dependency-type: all - groups: - all-dependencies: - patterns: - - "*" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4579e0c..4d46844 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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/swift-dependency-submission@v0.1 - with: - path: ${{ github.workspace }} - api-breakage: if: ${{ !(github.event.pull_request.draft || false) }} runs-on: ubuntu-latest @@ -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/swiftly-action@v0.1 +# 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) }} @@ -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 }} @@ -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 @@ -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 }} @@ -171,4 +148,6 @@ jobs: - name: Run all tests run: swift test --sanitize=thread --enable-code-coverage - name: Upload code coverage - uses: vapor/swift-codecov-action@v0.2 + uses: vapor/swift-codecov-action@v0.3 + with: + codecov_token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Sources/MySQLNIO/MySQLQueryCommand.swift b/Sources/MySQLNIO/MySQLQueryCommand.swift index b52daa8..d4a6485 100644 --- a/Sources/MySQLNIO/MySQLQueryCommand.swift +++ b/Sources/MySQLNIO/MySQLQueryCommand.swift @@ -27,7 +27,6 @@ extension MySQLDatabase { onRow: @escaping (MySQLRow) throws -> (), onMetadata: @escaping (MySQLQueryMetadata) throws -> () = { _ in } ) -> EventLoopFuture { - self.logger.debug("\(sql) \(binds)") let query = MySQLQueryCommand( sql: sql, binds: binds, diff --git a/Sources/MySQLNIO/MySQLSimpleQueryCommand.swift b/Sources/MySQLNIO/MySQLSimpleQueryCommand.swift index 1e39f94..4627397 100644 --- a/Sources/MySQLNIO/MySQLSimpleQueryCommand.swift +++ b/Sources/MySQLNIO/MySQLSimpleQueryCommand.swift @@ -9,7 +9,6 @@ extension MySQLDatabase { } public func simpleQuery(_ sql: String, onRow: @escaping (MySQLRow) -> ()) -> EventLoopFuture { - self.logger.debug("\(sql)") let query = MySQLSimpleQueryCommand(sql: sql, onRow: onRow) return self.send(query, logger: self.logger) }