From fca8278807abd5e6f6fd5f32368d4f91aa2375fc Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Sun, 22 Aug 2021 12:34:13 +0200 Subject: [PATCH] Update to Apodini 0.4.0 and make REUSE compliance (#1) * Update to Apodini 0.4.0 and make REUSE compliance * Execute no tests on macOS --- .github/pull_request_template.md | 22 ++++--- .github/release-drafter.yml | 20 +++++-- .github/workflows/build-and-test.yml | 57 ++++++++----------- .github/workflows/docs.yml | 14 ++++- .github/workflows/release-drafter.yml | 10 +++- .github/workflows/release.yml | 10 +++- .github/workflows/reuseaction.yml | 22 +++++++ .github/workflows/spm-update.yml | 17 +++++- .github/workflows/swiftlint.yml | 16 ++++-- .gitignore | 22 +++++-- .jazzy.yml | 8 +++ .swiftlint.yml | 25 +++++--- CONTRIBUTORS.md | 15 +++++ LICENSE => LICENSES/MIT.txt | 2 +- Package.resolved.license | 6 ++ Package.swift | 17 ++++-- README.md | 10 ++++ Sources/ApodiniLeaf/Application+Leaf.swift | 8 +++ Sources/ApodiniLeaf/Exports.swift | 13 ++++- Sources/ApodiniLeaf/LeafEncoder.swift | 13 ++++- Sources/ApodiniLeaf/LeafRenderer+Blob.swift | 8 +++ Tests/ApodiniLeafTests/ApodiniLeafTests.swift | 10 +++- .../Resources/Test.leaf.license | 6 ++ codecov.yml | 46 +++++++++++++++ 24 files changed, 318 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/reuseaction.yml create mode 100644 CONTRIBUTORS.md rename LICENSE => LICENSES/MIT.txt (92%) create mode 100644 Package.resolved.license create mode 100644 Tests/ApodiniLeafTests/Resources/Test.leaf.license create mode 100644 codecov.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7fe840d..e96470c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,16 +1,24 @@ + + # *Name of the PR* -## :recycle: Current situation +## :recycle: Current situation & Problem *Describe the current situation (if possible with and exemplary (or real) code snippet and/or where this is used)* ## :bulb: Proposed solution -*Describe the solution (if possible with and exemplary (or real) code snippet)* - -### Problem that is solved -*Provide a description and link issues that are solved* +*Describe the solution and how this affects the project and internal structure* -### Implications -*Describe the implications, e.g. refactoring* +## :gear: Release Notes +*Add a short summary of the feature as well as possible migration guides if this is a breaking change so this section can be added to the release notes.* +*Include code snippets that provide examples of the feature implemented if it appends or changes the public interface.* ## :heavy_plus_sign: Additional Information *Provide some additional information if possible* diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index b20e968..a0a3266 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,20 +1,30 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + branches: [release] name-template: '$NEXT_PATCH_VERSION' tag-template: '$NEXT_PATCH_VERSION' categories: - - title: 'πŸš€ Features' + - title: 'Semantic Version Major' + labels: + - 'needs version bump' + - title: 'Semantic Version Minor' labels: - 'feature' - 'enhancement' - - title: 'πŸ› Bug Fixes' + - title: 'Other Changes' labels: - 'fix' - 'bugfix' - 'bug' - - title: '🧰 Maintenance' - label: 'chore' + - 'documentation' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' template: | ## Changes - $CHANGES + $CHANGES \ No newline at end of file diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4311845..6180ea9 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,47 +1,35 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Build and Test on: push: branches: - develop - - release pull_request: branches: - develop - - release workflow_dispatch: jobs: - latest-beta-swift-version: - name: Latest (Beta) Swift Version - runs-on: macos-11 - steps: - - uses: actions/checkout@v2 - - uses: maxim-lobanov/setup-xcode@v1.2.3 - with: - xcode-version: latest - - uses: actions/cache@v2 - with: - path: .build - key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} - - name: Check Xcode version - run: xcodebuild -version - - name: Check Swift version - run: swift --version - - name: Debug Build & Test - run: swift test macos: name: macOS ${{ matrix.configuration }} runs-on: macos-11 strategy: fail-fast: false matrix: - configuration: [debug, release, release_testing] + configuration: [debug, release] steps: - uses: actions/checkout@v2 - uses: maxim-lobanov/setup-xcode@v1.2.3 with: - xcode-version: latest-stable + xcode-version: latest - uses: actions/cache@v2 with: path: .build @@ -53,27 +41,25 @@ jobs: - name: Release Build if: matrix.configuration == 'release' run: swift build -c release - - name: Release Build & Test - if: matrix.configuration == 'release_testing' - run: swift test -c release -Xswiftc -enable-testing -Xswiftc -DRELEASE_TESTING - - name: Debug Build & Test + - name: Debug Build if: matrix.configuration == 'debug' - run: swift test -c debug --enable-code-coverage -Xswiftc -DCOVERAGE - - name: Convert coverage report + run: swift build -c debug + - name: Test Generating Docs if: matrix.configuration == 'debug' - run: xcrun llvm-cov export -format="lcov" .build/debug/ApodiniLeafPackageTests.xctest/Contents/MacOS/ApodiniLeafPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + run: | + xcodebuild docbuild -scheme ApodiniLeaf -destination platform=macOS,arch=x86_64 -derivedDataPath ./.xcodebuild + cp -r $(find ./.xcodebuild -type d -name 'ApodiniLeaf.doccarchive') ./ApodiniLeaf.doccarchive + echo "The DocC archive can be found at ./ApodiniLeaf.doccarchive" linux: name: Linux ${{ matrix.linux }} ${{ matrix.configuration }} container: - image: swift:${{ matrix.linux }} + image: swiftlang/swift:nightly-5.5-${{ matrix.linux }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - linux: [bionic, xenial, focal, amazonlinux2, centos8] - configuration: [debug, release] + linux: [bionic, focal, amazonlinux2, centos8] + configuration: [debug, release, release_testing] steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -85,6 +71,9 @@ jobs: - name: Release Build if: matrix.configuration == 'release' run: swift build -c release + - name: Release Build & Test + if: matrix.configuration == 'release_testing' + run: swift test -c release -Xswiftc -enable-testing - name: Debug Build & Test if: matrix.configuration == 'debug' run: swift test -c debug diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a241ab6..f997982 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,11 +1,21 @@ -name: Publish Documentation +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +name: Generate Docs on: release: types: [published] + workflow_dispatch: jobs: - deploy_docs: + generatedocs: + name: Generate Docs runs-on: macos-11 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index bc6ee09..08fe52f 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,9 +1,17 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Release Drafter on: push: branches: - - release + - develop jobs: update_release_draft: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0f9849..84651ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Create Release on: @@ -9,7 +17,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: GH Release + - name: Create GitHub Release uses: softprops/action-gh-release@v0.1.5 env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} diff --git a/.github/workflows/reuseaction.yml b/.github/workflows/reuseaction.yml new file mode 100644 index 0000000..e4fc9c7 --- /dev/null +++ b/.github/workflows/reuseaction.yml @@ -0,0 +1,22 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +name: REUSE Compliance Check + +on: + pull_request: + workflow_dispatch: + +jobs: + reuse: + name: REUSE Compliance Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: REUSE Compliance Check + uses: fsfe/reuse-action@v1 diff --git a/.github/workflows/spm-update.yml b/.github/workflows/spm-update.yml index a3b2fd5..5ddc0a1 100644 --- a/.github/workflows/spm-update.yml +++ b/.github/workflows/spm-update.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Swift Package Update on: @@ -8,6 +16,8 @@ on: jobs: createPR: name: Create Pull Request + container: + image: swiftlang/swift:nightly-5.5-focal runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -24,6 +34,7 @@ jobs: delete-branch: true base: develop branch: bots/update-dependencies - assignees: PSchmiedmayer - committer: PSchmiedmayer - author: PSchmiedmayer + assignees: ApodiniBot + committer: ApodiniBot + author: ApodiniBot + reviewers: PSchmiedmayer \ No newline at end of file diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml index 717a773..a050be6 100644 --- a/.github/workflows/swiftlint.yml +++ b/.github/workflows/swiftlint.yml @@ -1,19 +1,25 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: SwiftLint on: pull_request: - paths: - - '.github/workflows/swiftlint.yml' - - '.swiftlint.yml' - - '**/*.swift' + workflow_dispatch: jobs: swiftlint: + name: SwiftLint runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: GitHub Action for SwiftLint - uses: norio-nomura/action-swiftlint@3.1.0 + uses: norio-nomura/action-swiftlint@3.2.1 with: args: --strict env: diff --git a/.gitignore b/.gitignore index b8a6400..6840120 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + # Apodini .gitignore File # Swift Package Manager @@ -6,14 +14,18 @@ Package.resolved .swiftpm .build/ +# IDE related folders +.idea + # Xcode User settings xcuserdata/ # Other files .DS_Store +.env -# Fastlane -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots/**/*.png -fastlane/test_output \ No newline at end of file +# Documentation generation +.xcodebuild/ +docs/ +docc2html/ +*.doccarchive diff --git a/.jazzy.yml b/.jazzy.yml index 536c831..c6de499 100644 --- a/.jazzy.yml +++ b/.jazzy.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2019-2021 Paul Schmiedmayer and the Apodini project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + module: ApodiniLeaf author: Paul Schmiedmayer & Jan Krusnik theme: fullwidth diff --git a/.swiftlint.yml b/.swiftlint.yml index d35f42c..3a29413 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + # Apodini SwiftLint file Apodini # The whitelist_rules configuration also includes rules that are enabled by default to provide a good overview of all rules. @@ -165,7 +173,7 @@ only_rules: - multiline_parameters # Functions and methods parameters should be either on the same line, or one per line. - nesting - # Types and statements should only be nested to a certain level deep. + # Types and functions should only be nested to a certain level deep. # See nesting below for the exact configuration. - nimble_operator # Prefer Nimble operator overloads over free matcher functions. @@ -309,19 +317,14 @@ only_rules: # Don’t include vertical whitespace (empty line) after opening braces. - void_return # Prefer -> Void over -> (). - - weak_delegate - # Delegates should be weak to avoid reference cycles. - xctfail_message # An XCTFail call should include a description of the assertion. - yoda_condition # The variable should be placed on the left, the constant on the right of a comparison operator. excluded: # paths to ignore during linting. Takes precedence over `included`. - - Carthage - - Pods - .build - .swiftpm - - R.generated.swift closure_body_length: # Closure bodies should not span too many lines. - 35 # warning - default: 20 @@ -348,6 +351,12 @@ identifier_name: - id - ok - or + - p8 + - of + - s3 + - at + - to + - in large_tuple: # Tuples shouldn't have too many members. Create a custom type instead. - 2 # warning - default: 2 @@ -361,10 +370,10 @@ line_length: # Lines should not span too many characters. ignores_function_declarations: false # default: false ignores_interpolated_strings: true # default: false -nesting: # Types should be nested at most 2 level deep, and statements should be nested at most 5 levels deep. +nesting: # Types should be nested at most 2 level deep, and functions should be nested at most 5 levels deep. type_level: warning: 2 # warning - default: 1 - statement_level: + function_level: warning: 5 # warning - default: 5 trailing_closure: diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..3db5501 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,15 @@ + + +Apodini contributors +==================== + +* [Paul Schmiedmayer](https://github.com/PSchmiedmayer) +* [Jan Krusnik](https://github.com/jkrusnik) diff --git a/LICENSE b/LICENSES/MIT.txt similarity index 92% rename from LICENSE rename to LICENSES/MIT.txt index 4161559..4b2cb50 100644 --- a/LICENSE +++ b/LICENSES/MIT.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Paul Schmiedmayer & Jan Krusnik +Copyright (c) 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Package.resolved.license b/Package.resolved.license new file mode 100644 index 0000000..dc1907e --- /dev/null +++ b/Package.resolved.license @@ -0,0 +1,6 @@ + +This source file is part of the Apodini Leaf open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Package.swift b/Package.swift index a86335f..193103d 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,13 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.5 + +// +// This source file is part of the Apodini Leaf open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import PackageDescription @@ -6,14 +15,14 @@ import PackageDescription let package = Package( name: "ApodiniLeaf", platforms: [ - .macOS(.v10_15) + .macOS(.v12) ], products: [ .library(name: "ApodiniLeaf", targets: ["ApodiniLeaf"]) ], dependencies: [ - .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.3.0")), - .package(url: "https://github.com/vapor/leaf-kit.git", from: "1.2.0") + .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.4.0")), + .package(url: "https://github.com/vapor/leaf-kit.git", from: "1.3.1") ], targets: [ .target( diff --git a/README.md b/README.md index f0576d5..ad3dcfa 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ + + # Apodini Leaf [![DOI](https://zenodo.org/badge/371102138.svg)](https://zenodo.org/badge/latestdoi/371102138) diff --git a/Sources/ApodiniLeaf/Application+Leaf.swift b/Sources/ApodiniLeaf/Application+Leaf.swift index 06c0377..8f281ae 100644 --- a/Sources/ApodiniLeaf/Application+Leaf.swift +++ b/Sources/ApodiniLeaf/Application+Leaf.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Apodini Leaf open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import Foundation import LeafKit diff --git a/Sources/ApodiniLeaf/Exports.swift b/Sources/ApodiniLeaf/Exports.swift index 416f334..f498004 100644 --- a/Sources/ApodiniLeaf/Exports.swift +++ b/Sources/ApodiniLeaf/Exports.swift @@ -1,4 +1,15 @@ -// This code is based on the Vapor project: https://github.com/vapor/leaf +// +// This source file is part of the Apodini Leaf open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// +// This code is based on the Vapor project: https://github.com/vapor/leaf: +// +// SPDX-FileCopyrightText: 2018 Qutheory, LLC +// +// SPDX-License-Identifier: MIT // // The MIT License (MIT) // diff --git a/Sources/ApodiniLeaf/LeafEncoder.swift b/Sources/ApodiniLeaf/LeafEncoder.swift index 6c94b7b..05de157 100644 --- a/Sources/ApodiniLeaf/LeafEncoder.swift +++ b/Sources/ApodiniLeaf/LeafEncoder.swift @@ -1,4 +1,15 @@ -// This code is based on the Vapor project: https://github.com/vapor/leaf +// +// This source file is part of the Apodini Leaf open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// +// This code is based on the Vapor project: https://github.com/vapor/leaf: +// +// SPDX-FileCopyrightText: 2018 Qutheory, LLC +// +// SPDX-License-Identifier: MIT // // The MIT License (MIT) // diff --git a/Sources/ApodiniLeaf/LeafRenderer+Blob.swift b/Sources/ApodiniLeaf/LeafRenderer+Blob.swift index bfc725b..f12878e 100644 --- a/Sources/ApodiniLeaf/LeafRenderer+Blob.swift +++ b/Sources/ApodiniLeaf/LeafRenderer+Blob.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Apodini Leaf open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import LeafKit import Apodini diff --git a/Tests/ApodiniLeafTests/ApodiniLeafTests.swift b/Tests/ApodiniLeafTests/ApodiniLeafTests.swift index 66cbcde..231e2d8 100644 --- a/Tests/ApodiniLeafTests/ApodiniLeafTests.swift +++ b/Tests/ApodiniLeafTests/ApodiniLeafTests.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Apodini Leaf open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + @testable import Apodini @testable import ApodiniLeaf import XCTest @@ -15,7 +23,7 @@ final class ApodiniLeafTests: XCTestCase { } } - let app = try TestWebService.start(waitForCompletion: false) + let app = try TestWebService.start(mode: .boot) let leafRenderer = app.leafRenderer diff --git a/Tests/ApodiniLeafTests/Resources/Test.leaf.license b/Tests/ApodiniLeafTests/Resources/Test.leaf.license new file mode 100644 index 0000000..dc1907e --- /dev/null +++ b/Tests/ApodiniLeafTests/Resources/Test.leaf.license @@ -0,0 +1,6 @@ + +This source file is part of the Apodini Leaf open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..1fb28e4 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,46 @@ +# +# This source file is part of the Apodini Leaf open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +ignore: +- "Tests" + +codecov: + require_ci_to_pass: yes + +coverage: + range: "80...98" + precision: 2 + round: up + status: + # The project status measures overall project coverage and compares it against the base of the pull request + project: + default: + # Choose a minimum coverage ratio that the commit must meet to be considered a success + target: auto + # Allow the coverage to drop by X%, and posting a success status. + threshold: 0.1% + # The patch status only measures lines adjusted in the pull request + patch: + default: + # Choose a minimum coverage ratio that the commit must meet to be considered a success + target: auto + # Allow the coverage to drop by X%, and posting a success status. + threshold: 0% + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "reach,diff,flags,files,footer" + behavior: default + require_changes: no