Skip to content

Commit

Permalink
Add GH action files from swift-server/swift-openapi-async-http-client
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Nov 13, 2024
1 parent 47ebf5b commit 33e82da
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 94 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Main

on:
push:
branches: [main]
schedule:
- cron: "0 8,20 * * *"

jobs:
unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

Check failure on line 18 in .github/workflows/main.yml

View workflow job for this annotation

GitHub Actions / Soundness / YAML lint check

18:131 [new-line-at-end-of-file] no new line character at the end of file
27 changes: 27 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: PR

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_project_name: "Hummingbird server framework"

unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
# TODO: `enable -Xswiftc -strict-concurrency=complete`
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable -Xswiftc -strict-concurrency=complete"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main

Check failure on line 27 in .github/workflows/pull_request.yml

View workflow job for this annotation

GitHub Actions / Soundness / YAML lint check

27:65 [new-line-at-end-of-file] no new line character at the end of file
18 changes: 18 additions & 0 deletions .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR label

on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

jobs:
semver-label-check:
name: Semantic version label check
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Check for Semantic Version label
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main

Check failure on line 18 in .github/workflows/pull_request_label.yml

View workflow job for this annotation

GitHub Actions / Soundness / YAML lint check

18:85 [new-line-at-end-of-file] no new line character at the end of file
36 changes: 36 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.gitignore
**/.gitignore
.licenseignore
.gitattributes
.git-blame-ignore-revs
.mailfilter
.mailmap
.spi.yml
.swift-format
.swiftformatignore
.editorconfig
.github/*
*.md
*.txt
*.yml
*.yaml
*.json
Package.swift
**/Package.swift
Package@-*.swift
**/Package@-*.swift
Package.resolved
**/Package.resolved
Makefile
*.modulemap
**/*.modulemap
**/*.docc/*
*.xcprivacy
**/*.xcprivacy
*.symlink
**/*.symlink
Dockerfile
**/Dockerfile
Snippets/*
dev/git.commit.template
.unacceptablelanguageignore
5 changes: 5 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: 1
builder:
configs:
- documentation_targets:
- OpenAPIHummingbird

Check failure on line 5 in .spi.yml

View workflow job for this annotation

GitHub Actions / Soundness / YAML lint check

5:29 [new-line-at-end-of-file] no new line character at the end of file
8 changes: 4 additions & 4 deletions .swift-format
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"lineLength" : 120,
"maximumBlankLines" : 1,
"prioritizeKeepingFunctionOutputTogether" : false,
"respectsExistingLineBreaks" : true,
"respectsExistingLineBreaks" : false,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : false,
"AllPublicDeclarationsHaveDocumentation" : true,
"AlwaysUseLowerCamelCase" : false,
"AmbiguousTrailingClosureOverload" : true,
"BeginDocumentationCommentWithOneLineSummary" : false,
Expand Down Expand Up @@ -50,9 +50,9 @@
"UseSynthesizedInitializer" : true,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
"ValidateDocumentationComments" : true
},
"spacesAroundRangeFormationOperators" : false,
"tabWidth" : 8,
"version" : 1
}
}
9 changes: 8 additions & 1 deletion Sources/OpenAPIHummingbird/OpenAPITransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import Hummingbird
import NIOHTTP1
import OpenAPIRuntime

struct TaskLocalRequestContext<Context: RequestContext> {
@TaskLocal static var instance: Context?
}

extension RouterMethods {
/// Registers an HTTP operation handler at the provided path and method.
/// - Parameters:
Expand All @@ -39,7 +43,10 @@ extension RouterMethods {
) { request, context in
let (openAPIRequest, openAPIRequestBody) = try request.makeOpenAPIRequest(context: context)
let openAPIRequestMetadata = context.makeOpenAPIRequestMetadata()
let (openAPIResponse, openAPIResponseBody) = try await handler(openAPIRequest, openAPIRequestBody, openAPIRequestMetadata)
let (openAPIResponse, openAPIResponseBody) = try await TaskLocalRequestContext<Context>.$instance.withValue(context) {
TaskLocalRequestContext<Context>.instance?.logger.info("Yeah")
try await handler(openAPIRequest, openAPIRequestBody, openAPIRequestMetadata)
}
return Response(openAPIResponse, body: openAPIResponseBody)
}
}
Expand Down
23 changes: 0 additions & 23 deletions docker/Dockerfile

This file was deleted.

16 changes: 0 additions & 16 deletions docker/docker-compose.2204.59.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions docker/docker-compose.2204.main.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions docker/docker-compose.yaml

This file was deleted.

0 comments on commit 33e82da

Please sign in to comment.