-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into customisable-terminating-byte-sequence
- Loading branch information
Showing
42 changed files
with
410 additions
and
634 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,71 @@ | ||
name: Pull Request | ||
name: PR | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
call-reusable-pull-request-workflow: | ||
name: Checks | ||
uses: apple/swift-nio/.github/workflows/reusable_pull_request.yml@main | ||
with: | ||
benchmarks_linux_enabled: false | ||
soundness: | ||
name: Soundness | ||
uses: apple/swift-nio/.github/workflows/soundness.yml@main | ||
with: | ||
api_breakage_check_enabled: true | ||
broken_symlink_check_enabled: true | ||
docs_check_enabled: true | ||
format_check_enabled: true | ||
license_header_check_enabled: true | ||
license_header_check_project_name: "SwiftOpenAPIGenerator" | ||
shell_check_enabled: true | ||
unacceptable_language_check_enabled: true | ||
|
||
unit-tests: | ||
name: Unit tests | ||
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main | ||
with: | ||
linux_5_8_enabled: false | ||
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error" | ||
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error" | ||
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error" | ||
linux_nightly_main_enabled: false | ||
|
||
integration-test: | ||
name: Integration test | ||
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main | ||
with: | ||
name: "Integration test" | ||
matrix_linux_command: "apt-get update -yq && apt-get install -yq jq && SWIFT_OPENAPI_GENERATOR_REPO_URL=file://${GITHUB_WORKSPACE} ./scripts/run-integration-test.sh" | ||
matrix_linux_5_8_enabled: false | ||
matrix_linux_nightly_main_enabled: false | ||
|
||
compatibility-test: | ||
name: Compatibility test | ||
runs-on: ubuntu-latest | ||
container: | ||
image: swift:latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Run OpenAPI document compatibilty test | ||
env: | ||
SWIFT_OPENAPI_COMPATIBILITY_TEST_ENABLE: "true" | ||
SWIFT_OPENAPI_COMPATIBILITY_TEST_SKIP_BUILD: "true" | ||
SWIFT_OPENAPI_COMPATIBILITY_TEST_FILTER: OpenAPIGeneratorReferenceTests.CompatibilityTest | ||
SWIFT_OPENAPI_COMPATIBILITY_TEST_PARALLEL_CODEGEN: "true" | ||
SWIFT_OPENAPI_COMPATIBILITY_TEST_NUM_BUILD_JOBS: 1 | ||
run: swift test --filter ${SWIFT_OPENAPI_COMPATIBILITY_TEST_FILTER} | ||
|
||
example-packages: | ||
name: Example packages | ||
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main | ||
with: | ||
name: "Example packages" | ||
matrix_linux_command: "./scripts/test-examples.sh" | ||
matrix_linux_5_8_enabled: false | ||
matrix_linux_nightly_main_enabled: false | ||
|
||
swift-6-language-mode: | ||
name: Swift 6 Language Mode | ||
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main | ||
if: false # Disabled for now. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Scheduled | ||
|
||
on: | ||
schedule: | ||
- cron: "0 8,20 * * *" | ||
|
||
jobs: | ||
unit-tests: | ||
name: Unit tests | ||
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main | ||
with: | ||
linux_5_8_enabled: false | ||
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error" | ||
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error" | ||
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error" | ||
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" | ||
|
||
integration-test: | ||
name: Integration test | ||
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main | ||
with: | ||
name: "Integration test" | ||
matrix_linux_command: "apt-get update -yq && apt-get install -yq jq && SWIFT_OPENAPI_GENERATOR_REPO_URL=file://${GITHUB_WORKSPACE} ./scripts/run-integration-test.sh" | ||
matrix_linux_5_8_enabled: false | ||
|
||
example-packages: | ||
name: Example packages | ||
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main | ||
with: | ||
name: "Example packages" | ||
matrix_linux_command: "./scripts/test-examples.sh" | ||
matrix_linux_5_8_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
.gitignore | ||
.licenseignore | ||
.swiftformatignore | ||
.spi.yml | ||
.swift-format | ||
.github/* | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
CONTRIBUTORS.txt | ||
LICENSE.txt | ||
NOTICE.txt | ||
Package.swift | ||
Package.resolved | ||
README.md | ||
SECURITY.md | ||
scripts/unacceptable-language.txt | ||
Tests/PetstoreConsumerTests/Generated | ||
Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/* | ||
docker/* | ||
**/*.docc/* | ||
**/.gitignore | ||
**/Package.swift | ||
**/Package.resolved | ||
**/README.md | ||
**/openapi.yaml | ||
**/malformed-openapi.yaml | ||
**/openapi.yml | ||
**/petstore.yaml | ||
**/openapi-generator-config.yaml | ||
**/openapi-generator-config.yml | ||
**/docker-compose.yaml | ||
**/docker/* | ||
**/.dockerignore | ||
Plugins/OpenAPIGenerator/PluginsShared | ||
Plugins/OpenAPIGeneratorCommand/PluginsShared | ||
Examples/HelloWorldiOSClientAppExample/HelloWorldiOSClientApp.* | ||
Examples/HelloWorldiOSClientAppExample/HelloWorldiOSClientApp/Assets.xcassets/* | ||
Examples/HelloWorldiOSClientAppExample/HelloWorldiOSClientApp/Preview* | ||
Examples/**/Generated* | ||
**/Makefile | ||
**/*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Tests/OpenAPIGeneratorReferenceTests/Resources | ||
Sources/swift-openapi-generator/Documentation.docc | ||
Examples/**/Generated/* | ||
Examples/**/GeneratedSources/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Sources/_OpenAPIGeneratorCore/DiagnosticsCollectorProvider.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the SwiftOpenAPIGenerator open source project | ||
// | ||
// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Foundation | ||
|
||
/// Prepares a diagnostics collector. | ||
/// - Parameter outputPath: A file path where to persist the YAML file. If `nil`, diagnostics will be printed to stderr. | ||
/// - Returns: A tuple containing: | ||
/// - An instance of `DiagnosticCollector` conforming to `Sendable`. | ||
/// - A closure to finalize the diagnostics collection | ||
public func preparedDiagnosticsCollector(outputPath: URL?) -> (any DiagnosticCollector & Sendable, () throws -> Void) { | ||
let innerDiagnostics: any DiagnosticCollector & Sendable | ||
let finalizeDiagnostics: () throws -> Void | ||
|
||
if let outputPath { | ||
let _diagnostics = _YamlFileDiagnosticsCollector(url: outputPath) | ||
finalizeDiagnostics = _diagnostics.finalize | ||
innerDiagnostics = _diagnostics | ||
} else { | ||
innerDiagnostics = StdErrPrintingDiagnosticCollector() | ||
finalizeDiagnostics = {} | ||
} | ||
let diagnostics = ErrorThrowingDiagnosticCollector(upstream: innerDiagnostics) | ||
return (diagnostics, finalizeDiagnostics) | ||
} |
Oops, something went wrong.