Skip to content

Commit

Permalink
Add API Docs (#318)
Browse files Browse the repository at this point in the history
* Update SPI Info

* Update API Docs workflow

* Update CI

* Add DocC bundle

* Wrap exports

* Fix the imports
  • Loading branch information
0xTim committed Feb 24, 2023
1 parent 0d11c45 commit 6245a07
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 18 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
name: deploy-api-docs
on:
push:
branches:
- main
push:
branches:
- main

jobs:
deploy:
name: api.vapor.codes
runs-on: ubuntu-latest
steps:
- name: Deploy api-docs
uses: appleboy/ssh-action@master
with:
host: vapor.codes
username: vapor
key: ${{ secrets.VAPOR_CODES_SSH_KEY }}
script: ./github-actions/deploy-api-docs.sh
build-and-deploy:
uses: vapor/api-docs/.github/workflows/build-and-deploy-docs-workflow.yml@main
secrets: inherit
with:
package_name: mysql-kit
modules: MySQLKit
pathsToInvalidate: /mysqlkit
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,14 @@ jobs:
run: swift test --sanitize=thread
env:
MYSQL_HOSTNAME: '127.0.0.1'

test-exports:
name: Test exports
runs-on: ubuntu-latest
steps:
- name: Check out Vapor
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build
run: swift build -Xswiftc -DBUILDING_DOCC
4 changes: 3 additions & 1 deletion .spi.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 1
metadata:
authors: “Maintained by the Vapor Core Team with hundreds of contributions from the Vapor Community.”
authors: "Maintained by the Vapor Core Team with hundreds of contributions from the Vapor Community."
external_links:
documentation: "https://api.vapor.codes/postgreskit/documentation/postgreskit/"
5 changes: 5 additions & 0 deletions Sources/MySQLKit/ConnectionPool+MySQL.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import NIOCore
import AsyncKit
import Logging
import MySQLNIO

extension EventLoopConnectionPool where Source == MySQLConnectionSource {
public func database(logger: Logger) -> MySQLDatabase {
_EventLoopConnectionPoolMySQLDatabase(pool: self, logger: logger)
Expand Down
3 changes: 3 additions & 0 deletions Sources/MySQLKit/Docs.docc/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ``MySQLKit``

MySQLKit is a library to provide a simple Swift interface to MySQLNIO using SQLKit.
7 changes: 7 additions & 0 deletions Sources/MySQLKit/Exports.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#if !BUILDING_DOCC

@_exported import MySQLNIO
@_exported import AsyncKit
@_exported import SQLKit
@_exported import struct Foundation.URL
@_exported import struct Foundation.Data
@_exported import struct NIOSSL.TLSConfiguration

#endif
6 changes: 3 additions & 3 deletions Sources/MySQLKit/MySQLConfiguration.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@_exported import struct Foundation.URL
@_exported import struct Foundation.Data
@_exported import struct NIOSSL.TLSConfiguration
import Foundation
import NIOSSL
import NIOCore

public struct MySQLConfiguration {
public var address: () throws -> SocketAddress
Expand Down
5 changes: 5 additions & 0 deletions Sources/MySQLKit/MySQLConnectionSource.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import NIOCore
import Logging
import MySQLNIO
import AsyncKit

public struct MySQLConnectionSource: ConnectionPoolSource {
public let configuration: MySQLConfiguration

Expand Down
1 change: 1 addition & 0 deletions Sources/MySQLKit/MySQLDataEncoder.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import MySQLNIO

public struct MySQLDataEncoder {
let json: JSONEncoder
Expand Down
3 changes: 3 additions & 0 deletions Sources/MySQLKit/MySQLDatabase+SQL.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import MySQLNIO
import SQLKit

extension MySQLDatabase {
public func sql(
encoder: MySQLDataEncoder = .init(),
Expand Down
2 changes: 2 additions & 0 deletions Sources/MySQLKit/MySQLDialect.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import enum Crypto.Insecure
import SQLKit
import Foundation

public struct MySQLDialect: SQLDialect {
public init() {}
Expand Down
3 changes: 3 additions & 0 deletions Sources/MySQLKit/MySQLRow+SQL.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import MySQLNIO
import SQLKit

extension MySQLRow {
public func sql(decoder: MySQLDataDecoder = .init()) -> SQLRow {
_MySQLSQLRow(row: self, decoder: decoder)
Expand Down
2 changes: 2 additions & 0 deletions Tests/MySQLKitTests/MySQLKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import SQLKitBenchmark
import XCTest
import NIOSSL
import AsyncKit
import SQLKit
import MySQLNIO

class MySQLKitTests: XCTestCase {
func testSQLBenchmark() throws {
Expand Down

0 comments on commit 6245a07

Please sign in to comment.