From 32057662ee3d325b9fed9087a15095506bd40c49 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 15 Sep 2023 18:18:37 +0400 Subject: [PATCH 1/6] Integrate `TestCov` (#1) --- .github/workflows/ci.yml | 30 +++++- .swiftlint => .swiftlint.yml | 0 .../xcshareddata/xcschemes/CQRS.xcscheme | 102 ++++++++++++++++++ README.md | 20 ++-- .../Classes/Command/Interfaces/ICommand.swift | 2 +- .../Interfaces/ICommandDispatcher.swift | 16 +-- .../Command/Interfaces/ICommandHandler.swift | 8 +- .../Container/IDependencyContainer.swift | 20 ++-- Sources/CQRS/Classes/Models/CQRSError.swift | 2 + .../Classes/Query/Interfaces/IQuery.swift | 2 +- .../Query/Interfaces/IQueryDispatcher.swift | 16 +-- .../Query/Interfaces/IQueryHandler.swift | 8 +- .../Command/CommandDispatcherTests.swift | 9 +- .../Classes/Query/QueryDispatcherTests.swift | 22 ++-- .../Mocks/Handlers/QueryHandlerMock.swift | 9 +- .../Helpers/Mocks/Queries/QueryMock.swift | 5 + hooks/pre-commit | 29 ++++- 17 files changed, 240 insertions(+), 60 deletions(-) rename .swiftlint => .swiftlint.yml (100%) create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/CQRS.xcscheme mode change 100644 => 100755 hooks/pre-commit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e85b1e..a586511 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,14 +5,34 @@ on: branches: - main - dev + paths: + - ".github/workflows/**" + - "Package.swift" + - "Source/**" + - "Tests/**" pull_request: - branches: [ main ] + paths: + - '.swiftlint.yml' + - ".github/workflows/**" + - "Package.swift" + - "Source/**" + - "Tests/**" concurrency: group: ci cancel-in-progress: true jobs: + SwiftLint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: GitHub Action for SwiftLint + uses: norio-nomura/action-swiftlint@3.2.1 + with: + args: --strict + env: + DIFF_BASE: ${{ github.base_ref }} Latest: name: Test Latest (iOS, macOS, tvOS, watchOS) runs-on: macOS-12 @@ -35,4 +55,10 @@ jobs: steps: - uses: actions/checkout@v3 - name: ${{ matrix.name }} - run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean \ No newline at end of file + run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.sdk }}.xcresult" | xcpretty -r junit + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3.1.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} + xcode: true + xcode_archive_path: "./${{ matrix.sdk }}.xcresult" \ No newline at end of file diff --git a/.swiftlint b/.swiftlint.yml similarity index 100% rename from .swiftlint rename to .swiftlint.yml diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/CQRS.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/CQRS.xcscheme new file mode 100644 index 0000000..29b0712 --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/CQRS.xcscheme @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index fea9742..5da2be8 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ Platform Swift5.7 CI - +

## Description -`cqrs` is an implementation of the command and query responsibility segregation in Swift +`cqrs` is an implementation of the command and query responsibility segregation in Swift. - [Usage](#usage) - [Requirements](#requirements) @@ -23,7 +23,9 @@ ## Usage -1. Create an instance of a command or a query conforms to `ICommand` or `IQuery` respectively: +1. `ICommand` and `IQuery` contain data for use by an appropriate handler. + +Create an instance of a command that conforms to `ICommand` or a query that conforms to `IQuery`, respectively: ```swift import CQRS @@ -58,7 +60,9 @@ final class ExampleQuery: IQueue { } ``` -2. Create an instance of a command handler or a query handler conforms to `ICommandHandler` or `IQueryHandler` respectively: +2. A command handler or a query handler contains the execution logic for a command or a query. + +Create an instance of a command handler that conforms to `ICommandHandler` or a query handler that conforms to `IQueryHandler`, respectively: ```swift import CQRS @@ -68,7 +72,7 @@ final class ExampleCommandHandler: ICommandHandler { // MARK: ICommandHandler func execute(command: Command) throws { - // write execution logic + // write the execution logic here } } ``` @@ -82,12 +86,12 @@ final class ExampleQueryHandler: IQueryHandler { // MARK: IQueryHandler func execute(query: Query) throws -> Query.Result { - // write execution logic + // write the execution logic here } } ``` -3. Register your handler implementation in container: +3. Register your handler implementation in the container: ```swift import CQRS @@ -102,7 +106,7 @@ let container = DependencyContainer() container.register { ExampleQueryHandler() } ``` -4. Create an instance of a `CommandDispatcher` or a `QueryDispatcher` with created container, like this: +4. Create an instance of a `CommandDispatcher` or a `QueryDispatcher` with the created container, like this: ```swift import CQRS diff --git a/Sources/CQRS/Classes/Command/Interfaces/ICommand.swift b/Sources/CQRS/Classes/Command/Interfaces/ICommand.swift index b4bddc2..6a89994 100644 --- a/Sources/CQRS/Classes/Command/Interfaces/ICommand.swift +++ b/Sources/CQRS/Classes/Command/Interfaces/ICommand.swift @@ -3,7 +3,7 @@ // Copyright © 2023 Space Code. All rights reserved. // -/// Protocol that describes a command object. +/// The type to which all commands must conform. /// /// In `CQRS` the command object is only responsible for /// executing tasks that modify the state of the application. diff --git a/Sources/CQRS/Classes/Command/Interfaces/ICommandDispatcher.swift b/Sources/CQRS/Classes/Command/Interfaces/ICommandDispatcher.swift index 13c697c..bf71b9a 100644 --- a/Sources/CQRS/Classes/Command/Interfaces/ICommandDispatcher.swift +++ b/Sources/CQRS/Classes/Command/Interfaces/ICommandDispatcher.swift @@ -3,18 +3,18 @@ // Copyright © 2023 Space Code. All rights reserved. // -/// Protocol that describes a command dispatcher. +/// A type that is used for executing commands. /// -/// `ICommandDispatcher` is a centralization way to execute a command. -/// It resolves the right command handler for given command. +/// `ICommandDispatcher` is a centralized way to execute a command. +/// It resolves the appropriate command handler for a given command. public protocol ICommandDispatcher { - /// Execute a command which conforms to `ICommand` protocol. + /// Executes a command that conforms to the `ICommand` protocol. /// - /// A command dispatch object resolves a command handler for given type of the command. - /// If command handler exists in the container, the command will be executed. + /// A command dispatch object resolves a command handler for the given type of command. + /// If the command handler exists in the container, the command will be executed. /// - /// - Parameter command: A command object. + /// - Parameter command: The command object. /// - /// - Throws: `CQRSError.failedResolve`failed to resolve command handler. + /// - Throws: `CQRSError.failedResolve`if the command handler failed to resolve. func execute(command: T) throws } diff --git a/Sources/CQRS/Classes/Command/Interfaces/ICommandHandler.swift b/Sources/CQRS/Classes/Command/Interfaces/ICommandHandler.swift index 14f554d..18c2c1f 100644 --- a/Sources/CQRS/Classes/Command/Interfaces/ICommandHandler.swift +++ b/Sources/CQRS/Classes/Command/Interfaces/ICommandHandler.swift @@ -3,14 +3,14 @@ // Copyright © 2023 Space Code. All rights reserved. // -/// Protocol that describes a command handler. +/// A type that encapsulates the logic for executing a command. public protocol ICommandHandler { associatedtype Command: ICommand - /// Execute a command. + /// Executes a command. /// - /// - Throws: `CQRSError.failedResolve` failed to resolve command handler. + /// - Throws: `CQRSError.failedResolve` if the command handler failed to resolve. /// - /// - Parameter command: A command object. + /// - Parameter command: The command object. func execute(command: Command) throws } diff --git a/Sources/CQRS/Classes/Helpers/Container/IDependencyContainer.swift b/Sources/CQRS/Classes/Helpers/Container/IDependencyContainer.swift index 9294321..3ca430d 100644 --- a/Sources/CQRS/Classes/Helpers/Container/IDependencyContainer.swift +++ b/Sources/CQRS/Classes/Helpers/Container/IDependencyContainer.swift @@ -3,29 +3,29 @@ // Copyright © 2023 Space Code. All rights reserved. // -// Dependency injection container. +/// Dependency injection container. public protocol IDependencyContainer { - /// Register a command handler in the container. + /// Registers a command handler in the container. /// - /// - Parameter object: A command handler which will be register in the container. + /// - Parameter object: The command handler that will be registered in the container. func register(_ object: T) - /// Register a query handler in the container. + /// Registers a query handler in the container. /// - /// - Parameter object: A query handler which will be register in thr container. + /// - Parameter object: The query handler that will be registered in the container. func register(_ object: Q) - /// Resolve a command handler that command type is equal to `T`. + /// Resolves a command handler for which the command type is equal to 'T'. /// /// - Throws: `CQRSError.failedResolve` if command handler could be resolved for the command. /// - /// - Returns: Resolver command handler with `T` command type. + /// - Returns: A resolved command handle with a command of type `T`. func resolve() throws -> any ICommandHandler - /// Resolve a query handler that command type is equal to `Q`. + /// Resolves a query handler for which the command type is equal to 'Q'. /// - /// - Throws: `CQRSError.failedResolve` if query handler could be resolved for the query. + /// - Throws: `CQRSError.failedResolve` if the query handler couldn't be resolved for the query. /// - /// - Returns: Resolver query handler with `Q` command type. + /// - Returns: A resolved query handle with a query of type `Q`. func resolve() throws -> any IQueryHandler } diff --git a/Sources/CQRS/Classes/Models/CQRSError.swift b/Sources/CQRS/Classes/Models/CQRSError.swift index 226eea4..dae9047 100644 --- a/Sources/CQRS/Classes/Models/CQRSError.swift +++ b/Sources/CQRS/Classes/Models/CQRSError.swift @@ -3,6 +3,8 @@ // Copyright © 2023 Space Code. All rights reserved. // +/// `CQRSError` is the error type returned by CQRS. +/// It encompasses a few different types of errors, each with their own associated reasons. public enum CQRSError: Swift.Error { /// Failed to resolve object from dependency container. case failedResolve diff --git a/Sources/CQRS/Classes/Query/Interfaces/IQuery.swift b/Sources/CQRS/Classes/Query/Interfaces/IQuery.swift index 1a5f478..ecc3b09 100644 --- a/Sources/CQRS/Classes/Query/Interfaces/IQuery.swift +++ b/Sources/CQRS/Classes/Query/Interfaces/IQuery.swift @@ -3,7 +3,7 @@ // Copyright © 2023 Space Code. All rights reserved. // -/// Protocol that describes a query object. +/// The type to which all queries must conform. /// /// In `CQRS` the query object is only responsible for /// executing tasks that modify the state of the application. diff --git a/Sources/CQRS/Classes/Query/Interfaces/IQueryDispatcher.swift b/Sources/CQRS/Classes/Query/Interfaces/IQueryDispatcher.swift index 5e282ad..717abe0 100644 --- a/Sources/CQRS/Classes/Query/Interfaces/IQueryDispatcher.swift +++ b/Sources/CQRS/Classes/Query/Interfaces/IQueryDispatcher.swift @@ -3,19 +3,19 @@ // Copyright © 2023 Space Code. All rights reserved. // -/// Protocol that describes a query dispatcher. +/// A type that is used for executing queries. /// -/// `IQueryDispatcher` is a centralization way to execute a query. -/// It resolves the correct query handler for the given query. +/// `IQueryDispatcher` is a centralized way to execute a query. +/// It resolves the appropriate query handler for a given query. public protocol IQueryDispatcher { - /// Execute a query which conforms to `IQuery` protocol. + /// Executes a query that conforms to the `IQuery` protocol. /// - /// A query dispatch object resolves a query handler for given type of the query. - /// If query handler exists in the container, the query will be executed. + /// A query dispatch object resolves a query handler for the given type of query. + /// If the query handler exists in the container, the query will be executed. /// - /// - Parameter query: A query object. + /// - Parameter command: The query object. /// - /// - Throws: `CQRSError.failedResolve`failed to resolve command handler. + /// - Throws: `CQRSError.failedResolve`if the query handler failed to resolve. /// /// - Returns: A query result. func execute(query: Q) throws -> Q.Result diff --git a/Sources/CQRS/Classes/Query/Interfaces/IQueryHandler.swift b/Sources/CQRS/Classes/Query/Interfaces/IQueryHandler.swift index 8b60aab..2a72c6c 100644 --- a/Sources/CQRS/Classes/Query/Interfaces/IQueryHandler.swift +++ b/Sources/CQRS/Classes/Query/Interfaces/IQueryHandler.swift @@ -3,14 +3,14 @@ // Copyright © 2023 Space Code. All rights reserved. // -/// Protocol that describes a query handler. +/// A type that encapsulates the logic for executing a query. public protocol IQueryHandler { associatedtype Query: IQuery - /// Execute a query. + /// Executes a query. /// - /// - Throws: `CQRSError.failedResolve` failed to resolve query handler. + /// - Throws: `CQRSError.failedResolve`if the command handler failed to resolve. /// - /// - Parameter query: A query object. + /// - Parameter query: The query object. func execute(query: Query) -> Query.Result } diff --git a/Tests/CQRSTests/Classes/Command/CommandDispatcherTests.swift b/Tests/CQRSTests/Classes/Command/CommandDispatcherTests.swift index c63df20..b7dcf14 100644 --- a/Tests/CQRSTests/Classes/Command/CommandDispatcherTests.swift +++ b/Tests/CQRSTests/Classes/Command/CommandDispatcherTests.swift @@ -24,6 +24,7 @@ final class CommandDispatcherTests: XCTestCase { } override func tearDown() { + commandHandler = nil commandDispatcher = nil container = nil super.tearDown() @@ -31,7 +32,7 @@ final class CommandDispatcherTests: XCTestCase { // MARK: Tests - func test_thatCommandDispatcherExecuteCommand_whenCommandHandlerExistsInContainer() throws { + func test_thatCommandDispatcherExecutesCommand_whenCommandHandlerExistsInContainer() throws { // given let command = CommandMock() prepareContainer(with: [commandHandler]) @@ -45,20 +46,20 @@ final class CommandDispatcherTests: XCTestCase { XCTAssertTrue(commandHandler.invokedExecuteParameters?.command === command) } - func test_thatCommandDispatcherThrowAnError_whenCommandHandlerDoesNotExistInContainer() throws { + func test_thatCommandDispatcherThrowsAnError_whenCommandHandlerDoesNotExistInContainer() throws { // given let command = CommandMock() // then do { try commandDispatcher.execute(command: command) - XCTFail("CommandDispatcher must throw an error because of a command handler does not exists in the container.") + XCTFail("The CommandDispatcher must throw an error because a command handler does not exist in the container") } catch { XCTAssertEqual(error as? CQRSError, .failedResolve) } } - func test_thatCommandDispatcherExecuteCommandOnRightHandler_whenCoupleOfHandlersExist() throws { + func test_thatCommandDispatcherExecutesCommandOnRightHandler_whenCoupleOfHandlersExist() throws { // given let command = CommandMock() let secondCommandHandlerMock = SecondCommandHandlerMock() diff --git a/Tests/CQRSTests/Classes/Query/QueryDispatcherTests.swift b/Tests/CQRSTests/Classes/Query/QueryDispatcherTests.swift index 5b9ff0c..887fd2d 100644 --- a/Tests/CQRSTests/Classes/Query/QueryDispatcherTests.swift +++ b/Tests/CQRSTests/Classes/Query/QueryDispatcherTests.swift @@ -1,12 +1,14 @@ +// +// CQRS +// Copyright © 2023 Space Code. All rights reserved. +// + @testable import CQRS import XCTest -private extension Int { - static let queryValue = 12031 -} +// MARK: - QueryDispatcherTests final class QueryDispatcherTests: XCTestCase { - // MARK: Properties private var queryDispatcher: IQueryDispatcher! @@ -28,7 +30,7 @@ final class QueryDispatcherTests: XCTestCase { // MARK: Tests - func test_thatQueryDispatcherExecuteCommand_whenQueryHandlerExistsInContainer() throws { + func test_thatQueryDispatcherExecutesCommand_whenQueryHandlerExistsInContainer() throws { // given let queryHandler = QueryHandlerMock() queryHandler.stubbedExecute = .queryValue @@ -45,14 +47,14 @@ final class QueryDispatcherTests: XCTestCase { XCTAssertEqual(result, .queryValue) } - func test_thatQueryDispatcherThrowAnError_whenQueryHandlerDoesNotExistInContainer() throws { + func test_thatQueryDispatcherThrowsAnError_whenQueryHandlerDoesNotExistInContainer() throws { // given let query = QueryMock(value: .queryValue) // then do { _ = try queryDispatcher.execute(query: query) - XCTFail("QueryDispatcher must throw an error because of a query handler does not exists in the container.") + XCTFail("The QueryDispatcher must throw an error because a query handler does not exist in the container") } catch { XCTAssertEqual(error as? CQRSError, .failedResolve) } @@ -64,3 +66,9 @@ final class QueryDispatcherTests: XCTestCase { queryHandlers.forEach { container.register($0) } } } + +// MARK: - Constants + +private extension Int { + static let queryValue = 12031 +} diff --git a/Tests/CQRSTests/Helpers/Mocks/Handlers/QueryHandlerMock.swift b/Tests/CQRSTests/Helpers/Mocks/Handlers/QueryHandlerMock.swift index b09572c..f48339f 100644 --- a/Tests/CQRSTests/Helpers/Mocks/Handlers/QueryHandlerMock.swift +++ b/Tests/CQRSTests/Helpers/Mocks/Handlers/QueryHandlerMock.swift @@ -1,6 +1,13 @@ +// +// CQRS +// Copyright © 2023 Space Code. All rights reserved. +// + import CQRS final class QueryHandlerMock: IQueryHandler { + typealias Query = QueryMock + var invokedExecute = false var invokedExecuteCount = 0 var invokedExecuteParameters: (query: QueryMock?, Void)? @@ -14,6 +21,4 @@ final class QueryHandlerMock: IQueryHandler { invokedExecuteParametersList.append((query, ())) return stubbedExecute! } - - typealias Query = QueryMock } diff --git a/Tests/CQRSTests/Helpers/Mocks/Queries/QueryMock.swift b/Tests/CQRSTests/Helpers/Mocks/Queries/QueryMock.swift index f480661..140ac51 100644 --- a/Tests/CQRSTests/Helpers/Mocks/Queries/QueryMock.swift +++ b/Tests/CQRSTests/Helpers/Mocks/Queries/QueryMock.swift @@ -1,3 +1,8 @@ +// +// CQRS +// Copyright © 2023 Space Code. All rights reserved. +// + import CQRS final class QueryMock: IQuery { diff --git a/hooks/pre-commit b/hooks/pre-commit old mode 100644 new mode 100755 index 89b3319..956fdcb --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -8,4 +8,31 @@ git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read fi done -swiftlint \ No newline at end of file +LINT=$(which mint) +if [[ -e "${LINT}" ]]; then + # Export files in SCRIPT_INPUT_FILE_$count to lint against later + count=0 + while IFS= read -r file_path; do + export SCRIPT_INPUT_FILE_$count="$file_path" + count=$((count + 1)) + done < <(git diff --name-only --cached --diff-filter=d | grep ".swift$") + export SCRIPT_INPUT_FILE_COUNT=$count + + if [ "$count" -eq 0 ]; then + echo "No files to lint!" + exit 0 + fi + + echo "Found $count lintable files! Linting now.." + mint run swiftlint --use-script-input-files --strict --config .swiftlint.yml + RESULT=$? # swiftline exit value is number of errors + + if [ $RESULT -eq 0 ]; then + echo "🎉 Well done. No violation." + fi + exit $RESULT +else + echo "⚠️ WARNING: SwiftLint not found" + echo "⚠️ You might want to edit .git/hooks/pre-commit to locate your swiftlint" + exit 0 +fi \ No newline at end of file From 8508de585c87f3e0eeec4a9836a0acebb7ac4bd2 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 15 Sep 2023 18:46:33 +0400 Subject: [PATCH 2/6] Update `README.md` (#2) * Update `README.md` * Update `ci.yml` --- .github/workflows/ci.yml | 3 +++ CHANGELOG.md | 11 ++++++++++- README.md | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a586511..762f927 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,12 +46,15 @@ jobs: - destination: "OS=16.1,name=iPhone 14 Pro" name: "iOS" scheme: "CQRS" + sdk: iphonesimulator - destination: "OS=16.1,name=Apple TV" name: "tvOS" scheme: "CQRS" + sdk: appletvsimulator - destination: "OS=9.1,name=Apple Watch Series 8 (45mm)" name: "watchOS" scheme: "CQRS" + sdk: watchsimulator steps: - uses: actions/checkout@v3 - name: ${{ matrix.name }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d3e2d1..5df6995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,16 @@ All notable changes to this project will be documented in this file. #### 1.x Releases -- `1.0.x` Releases - [1.0.0](#100) +- `1.0.x` Releases - [1.0.0](#100) | [1.0.1](#101) + +## [1.0.1](https://github.com/space-code/cqrs/releases/tag/1.0.1) +Released on 2023-09-15 + +### Added +- Integrate CodeCov. + +### Updated +- Documentation typos. ## [1.0.0](https://github.com/space-code/cqrs/releases/tag/1.0.0) Released on 2023-01-20. diff --git a/README.md b/README.md index 5da2be8..f6201f7 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Swift5.7 CI +CodeCov

## Description @@ -155,7 +156,7 @@ Once you have your Swift package set up, adding `cqrs` as a dependency is as eas ```swift dependencies: [ - .package(url: "https://github.com/space-code/cqrs.git", .upToNextMajor(from: "1.0.0")) + .package(url: "https://github.com/space-code/cqrs.git", .upToNextMajor(from: "1.0.1")) ] ``` From 7f123b276dc4e70cf7e34bcd11cf4ebc8a49cda8 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 12 Jan 2024 14:16:31 +0100 Subject: [PATCH 3/6] Update `README.md` (#4) * Update `README.md` * Update `CHANGELOG.md` --- CHANGELOG.md | 5 +++++ README.md | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5df6995..6f1f56c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to this project will be documented in this file. +## [Unreleased] +#### Added +- Add badges for Swift Version Compatibility and Platform Compatibility + - Added in Pull Request [#4](https://github.com/space-code/cqrs/pull/4) + #### 1.x Releases - `1.0.x` Releases - [1.0.0](#100) | [1.0.1](#101) diff --git a/README.md b/README.md index f6201f7..655f480 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@

License -Platform -Swift5.7 +Swift Compatibility +Platform Compatibility CI CodeCov From 395c87db9a2f80e291ae163ad1f926b463a990ba Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 12 Jan 2024 14:50:45 +0100 Subject: [PATCH 4/6] Update Workflow (#5) * Update `ci.yml` * Integrate `danger` * Add templates * Update `CHANGELOG.md` --- .github/ISSUE_TEMPLATE/bug_report.md | 41 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 11 + .../PULL_REQUEST_TEMPLATE/bug_template.yml | 9 + .../feature_template.yml | 12 ++ .github/workflows/ci.yml | 188 +++++++++++++++--- .github/workflows/danger.yml | 29 +++ CHANGELOG.md | 2 + Dangerfile | 1 + Gemfile | 3 + Gemfile.lock | 66 ++++++ 10 files changed, 334 insertions(+), 28 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/bug_template.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE/feature_template.yml create mode 100644 .github/workflows/danger.yml create mode 100644 Dangerfile create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..8dc7e75 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,41 @@ +--- +name: "🐛 Bug Report" +about: Report a reproducible bug or regression. +title: 'Bug: ' +labels: 'bug' + +--- + + + +Application version: + +## Steps To Reproduce + +1. +2. + + + +Link to code example: + + + +## The current behavior + + +## The expected behavior \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..cb34a78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,11 @@ +--- +name: 🛠 Feature request +about: If you have a feature request for the cqrs, file it here. +labels: 'type: enhancement' +--- + +**Feature description** +Clearly and concisely describe the feature. + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/bug_template.yml b/.github/PULL_REQUEST_TEMPLATE/bug_template.yml new file mode 100644 index 0000000..7d6a149 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/bug_template.yml @@ -0,0 +1,9 @@ +## Bug description +Clearly and concisely describe the problem. + +## Solution description +Describe your code changes in detail for reviewers. Explain the technical solution you have provided and how it fixes the issue case. + +## Covered unit test cases +- [x] yes +- [x] no \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/feature_template.yml b/.github/PULL_REQUEST_TEMPLATE/feature_template.yml new file mode 100644 index 0000000..ab3978b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/feature_template.yml @@ -0,0 +1,12 @@ +## Feature description +Clearly and concisely describe the feature. + +## Solution description +Describe your code changes in detail for reviewers. + +## Areas affected and ensured +List out the areas affected by your code changes. + +## Covered unit test cases +- [x] yes +- [x] no \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 762f927..89f3490 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,11 +5,6 @@ on: branches: - main - dev - paths: - - ".github/workflows/**" - - "Package.swift" - - "Source/**" - - "Tests/**" pull_request: paths: - '.swiftlint.yml' @@ -18,10 +13,6 @@ on: - "Source/**" - "Tests/**" -concurrency: - group: ci - cancel-in-progress: true - jobs: SwiftLint: runs-on: ubuntu-latest @@ -33,35 +24,176 @@ jobs: args: --strict env: DIFF_BASE: ${{ github.base_ref }} - Latest: - name: Test Latest (iOS, macOS, tvOS, watchOS) - runs-on: macOS-12 + macOS: + name: ${{ matrix.name }} + runs-on: ${{ matrix.runsOn }} env: - DEVELOPER_DIR: "/Applications/Xcode_14.1.app/Contents/Developer" - timeout-minutes: 10 + DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer" + timeout-minutes: 20 strategy: fail-fast: false matrix: include: - - destination: "OS=16.1,name=iPhone 14 Pro" - name: "iOS" - scheme: "CQRS" - sdk: iphonesimulator - - destination: "OS=16.1,name=Apple TV" - name: "tvOS" - scheme: "CQRS" - sdk: appletvsimulator - - destination: "OS=9.1,name=Apple Watch Series 8 (45mm)" - name: "watchOS" - scheme: "CQRS" - sdk: watchsimulator + - xcode: "Xcode_15.0" + runsOn: macos-13 + name: "macOS 13, Xcode 15.0, Swift 5.9.0" + - xcode: "Xcode_14.3.1" + runsOn: macos-13 + name: "macOS 13, Xcode 14.3.1, Swift 5.8.0" steps: - uses: actions/checkout@v3 - name: ${{ matrix.name }} - run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.sdk }}.xcresult" | xcpretty -r junit + run: xcodebuild test -scheme "CQRS" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1 - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} xcode: true - xcode_archive_path: "./${{ matrix.sdk }}.xcresult" \ No newline at end of file + xcode_archive_path: test_output/${{ matrix.name }}.xcresult + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.name }} + path: test_output + + iOS: + name: ${{ matrix.name }} + runs-on: ${{ matrix.runsOn }} + env: + DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer" + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + include: + - destination: "OS=17.0.1,name=iPhone 14 Pro" + name: "iOS 17.0.1" + xcode: "Xcode_15.0" + runsOn: macos-13 + - destination: "OS=16.4,name=iPhone 14 Pro" + name: "iOS 16.4" + xcode: "Xcode_14.3.1" + runsOn: macos-13 + steps: + - uses: actions/checkout@v3 + - name: ${{ matrix.name }} + run: xcodebuild test -scheme "CQRS" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1 + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.name }} + path: test_output + + tvOS: + name: ${{ matrix.name }} + runs-on: ${{ matrix.runsOn }} + env: + DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer" + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + include: + - destination: "OS=17.0,name=Apple TV" + name: "tvOS 17.0" + xcode: "Xcode_15.0" + runsOn: macos-13 + - destination: "OS=16.4,name=Apple TV" + name: "tvOS 16.4" + xcode: "Xcode_14.3.1" + runsOn: macos-13 + steps: + - uses: actions/checkout@v3 + - name: ${{ matrix.name }} + run: xcodebuild test -scheme "CQRS" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1 + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3.1.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} + xcode: true + xcode_archive_path: test_output/${{ matrix.name }}.xcresult + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.name }} + path: test_output + + watchOS: + name: ${{ matrix.name }} + runs-on: ${{ matrix.runsOn }} + env: + DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer" + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + include: + - destination: "OS=10.0,name=Apple Watch Series 9 (45mm)" + name: "watchOS 10.0" + xcode: "Xcode_15.0" + runsOn: macos-13 + - destination: "OS=9.4,name=Apple Watch Series 8 (45mm)" + name: "watchOS 9.4" + xcode: "Xcode_14.3.1" + runsOn: macos-13 + steps: + - uses: actions/checkout@v3 + - name: ${{ matrix.name }} + run: xcodebuild test -scheme "CQRS" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1 + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3.1.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} + xcode: true + xcode_archive_path: test_output/${{ matrix.name }}.xcresult + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.name }} + path: test_output + + spm: + name: ${{ matrix.name }} + runs-on: ${{ matrix.runsOn }} + env: + DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer" + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + include: + - name: "Xcode 15" + xcode: "Xcode_15.0" + runsOn: macos-13 + - name: "Xcode 14" + xcode: "Xcode_14.3.1" + runsOn: macos-13 + steps: + - uses: actions/checkout@v3 + - name: ${{ matrix.name }} + run: swift build -c release + + merge-test-reports: + needs: [iOS, macOS, watchOS, tvOS] + runs-on: macos-13 + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: test_output + - run: xcrun xcresulttool merge test_output/**/*.xcresult --output-path test_output/final/final.xcresult + - name: Upload Merged Artifact + uses: actions/upload-artifact@v4 + with: + name: MergedResult + path: test_output/final + + discover-typos: + name: Discover Typos + runs-on: macOS-12 + env: + DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer + steps: + - uses: actions/checkout@v2 + - name: Discover typos + run: | + export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.11/bin" + python3 -m pip install --upgrade pip + python3 -m pip install codespell + codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*" \ No newline at end of file diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 0000000..158ca87 --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,29 @@ +name: Danger + +on: + pull_request: + types: [synchronize, opened, reopened, labeled, unlabeled, edited] + +env: + LC_CTYPE: en_US.UTF-8 + LANG: en_US.UTF-8 + +jobs: + run-danger: + runs-on: ubuntu-latest + steps: + - name: ruby setup + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1.4 + bundler-cache: true + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup gems + run: | + gem install bundler + bundle install --clean --path vendor/bundle + - name: danger + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} + run: bundle exec danger --verbose \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f1f56c..cdaca14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] #### Added +- Update GitHub Actions, integrate `danger`, and update templates + - Added in Pull Request [#5](https://github.com/space-code/cqrs/pull/5) - Add badges for Swift Version Compatibility and Platform Compatibility - Added in Pull Request [#4](https://github.com/space-code/cqrs/pull/4) diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 0000000..b266982 --- /dev/null +++ b/Dangerfile @@ -0,0 +1 @@ +danger.import_dangerfile(github: 'space-code/dangerfile') \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..20dff64 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem 'danger' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..dc185c0 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,66 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + claide (1.1.0) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) + colored2 (3.1.2) + cork (0.3.0) + colored2 (~> 3.1) + danger (9.4.2) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (>= 0.9.0, < 3.0) + faraday-http-cache (~> 2.0) + git (~> 1.13) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.0) + no_proxy_fix + octokit (>= 4.0) + terminal-table (>= 1, < 4) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-http-cache (2.5.0) + faraday (>= 0.8) + faraday-net_http (3.1.0) + net-http + git (1.19.0) + addressable (~> 2.8) + rchardet (~> 1.8) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + nap (1.1.0) + net-http (0.4.1) + uri + no_proxy_fix (0.1.2) + octokit (8.0.0) + faraday (>= 1, < 3) + sawyer (~> 0.9) + open4 (1.3.4) + public_suffix (5.0.4) + rchardet (1.8.0) + rexml (3.2.6) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + unicode-display_width (2.5.0) + uri (0.13.0) + +PLATFORMS + x86_64-darwin-22 + +DEPENDENCIES + danger + +BUNDLED WITH + 2.4.21 From d1b921fa1e4d20a192f628121acda0ef8892da10 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 12 Jan 2024 15:09:54 +0100 Subject: [PATCH 5/6] Integrate `visionOS` support (#6) * Integrate `visionOS` support * Update `CHANGELOG.md` --- .swiftlint.yml | 2 ++ CHANGELOG.md | 2 ++ Package.swift | 3 ++- Package@swift-5.7.swift | 33 +++++++++++++++++++++++++++++++++ Package@swift-5.8.swift | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 Package@swift-5.7.swift create mode 100644 Package@swift-5.8.swift diff --git a/.swiftlint.yml b/.swiftlint.yml index 89efd09..4f1be08 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,6 +1,8 @@ excluded: - Tests - Package.swift + - Package@swift-5.7.swift + - Package@swift-5.8.swift - .build # Rules diff --git a/CHANGELOG.md b/CHANGELOG.md index cdaca14..5facb39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] #### Added +- Integrate `visionOS` support + - Added in Pull Request [#6](https://github.com/space-code/cqrs/pull/6) - Update GitHub Actions, integrate `danger`, and update templates - Added in Pull Request [#5](https://github.com/space-code/cqrs/pull/5) - Add badges for Swift Version Compatibility and Platform Compatibility diff --git a/Package.swift b/Package.swift index d61e5bf..f8a6074 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -10,6 +10,7 @@ let package = Package( .iOS(.v16), .watchOS(.v9), .tvOS(.v16), + .visionOS(.v1), ], products: [ .library( diff --git a/Package@swift-5.7.swift b/Package@swift-5.7.swift new file mode 100644 index 0000000..d61e5bf --- /dev/null +++ b/Package@swift-5.7.swift @@ -0,0 +1,33 @@ +// swift-tools-version: 5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "CQRS", + platforms: [ + .macOS(.v13), + .iOS(.v16), + .watchOS(.v9), + .tvOS(.v16), + ], + products: [ + .library( + name: "CQRS", + targets: ["CQRS"] + ), + ], + dependencies: [ + .package(url: "https://github.com/AliSoftware/Dip", .upToNextMajor(from: "7.1.1")), + ], + targets: [ + .target( + name: "CQRS", + dependencies: ["Dip"] + ), + .testTarget( + name: "CQRSTests", + dependencies: ["CQRS"] + ), + ] +) diff --git a/Package@swift-5.8.swift b/Package@swift-5.8.swift new file mode 100644 index 0000000..06a2bd6 --- /dev/null +++ b/Package@swift-5.8.swift @@ -0,0 +1,33 @@ +// swift-tools-version: 5.8 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "CQRS", + platforms: [ + .macOS(.v13), + .iOS(.v16), + .watchOS(.v9), + .tvOS(.v16), + ], + products: [ + .library( + name: "CQRS", + targets: ["CQRS"] + ), + ], + dependencies: [ + .package(url: "https://github.com/AliSoftware/Dip", .upToNextMajor(from: "7.1.1")), + ], + targets: [ + .target( + name: "CQRS", + dependencies: ["Dip"] + ), + .testTarget( + name: "CQRSTests", + dependencies: ["CQRS"] + ), + ] +) From b4962ba9c5f1b5c4c3c631a3f977032411774e84 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Wed, 25 Dec 2024 17:08:55 +0100 Subject: [PATCH 6/6] Bump the Swift version to 6.0 (#7) * Update `Mintfile` * Bump the Swift version to 6.0 * Update `ci.yml` * Update `CHANGELOG.md` --- .github/workflows/ci.yml | 102 +++++++++++++++++++++++++++------------ .swiftlint.yml | 4 +- CHANGELOG.md | 23 +++++---- Mintfile | 4 +- Package.swift | 2 +- Package@swift-5.10.swift | 34 +++++++++++++ Package@swift-5.9.swift | 34 +++++++++++++ 7 files changed, 158 insertions(+), 45 deletions(-) create mode 100644 Package@swift-5.10.swift create mode 100644 Package@swift-5.9.swift diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89f3490..e128a17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,12 @@ jobs: fail-fast: false matrix: include: + - xcode: "Xcode_16.0" + runsOn: macOS-14 + name: "macOS 14, Xcode 16.0, Swift 6.0" + - xcode: "Xcode_15.4" + runsOn: macOS-14 + name: "macOS 14, Xcode 15.4, Swift 5.10" - xcode: "Xcode_15.0" runsOn: macos-13 name: "macOS 13, Xcode 15.0, Swift 5.9.0" @@ -44,16 +50,12 @@ jobs: - uses: actions/checkout@v3 - name: ${{ matrix.name }} run: xcodebuild test -scheme "CQRS" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1 - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3.1.0 + - name: Upload test coverage reports to Codecov + uses: space-code/oss-common-actions/.github/actions/upload_test_coverage_report@main with: + scheme_name: CQRS + filename: ${{ matrix.name }} token: ${{ secrets.CODECOV_TOKEN }} - xcode: true - xcode_archive_path: test_output/${{ matrix.name }}.xcresult - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.name }} - path: test_output iOS: name: ${{ matrix.name }} @@ -65,6 +67,18 @@ jobs: fail-fast: false matrix: include: + - destination: "OS=18.1,name=iPhone 16 Pro" + name: "iOS 18.1" + xcode: "Xcode_16.1" + runsOn: macOS-14 + - destination: "OS=18.0,name=iPhone 16 Pro" + name: "iOS 18.0" + xcode: "Xcode_16.0" + runsOn: macOS-14 + - destination: "OS=17.5,name=iPhone 15 Pro" + name: "iOS 17.5" + xcode: "Xcode_15.4" + runsOn: macOS-14 - destination: "OS=17.0.1,name=iPhone 14 Pro" name: "iOS 17.0.1" xcode: "Xcode_15.0" @@ -77,10 +91,12 @@ jobs: - uses: actions/checkout@v3 - name: ${{ matrix.name }} run: xcodebuild test -scheme "CQRS" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1 - - uses: actions/upload-artifact@v4 + - name: Upload test coverage reports to Codecov + uses: space-code/oss-common-actions/.github/actions/upload_test_coverage_report@main with: - name: ${{ matrix.name }} - path: test_output + scheme_name: CQRS + filename: ${{ matrix.name }} + token: ${{ secrets.CODECOV_TOKEN }} tvOS: name: ${{ matrix.name }} @@ -92,6 +108,18 @@ jobs: fail-fast: false matrix: include: + - destination: "OS=18.1,name=Apple TV" + name: "tvOS 18.1" + xcode: "Xcode_16.1" + runsOn: macOS-14 + - destination: "OS=18.0,name=Apple TV" + name: "tvOS 18.0" + xcode: "Xcode_16.0" + runsOn: macOS-14 + - destination: "OS=17.5,name=Apple TV" + name: "tvOS 17.5" + xcode: "Xcode_15.4" + runsOn: macOS-14 - destination: "OS=17.0,name=Apple TV" name: "tvOS 17.0" xcode: "Xcode_15.0" @@ -104,16 +132,12 @@ jobs: - uses: actions/checkout@v3 - name: ${{ matrix.name }} run: xcodebuild test -scheme "CQRS" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1 - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3.1.0 + - name: Upload test coverage reports to Codecov + uses: space-code/oss-common-actions/.github/actions/upload_test_coverage_report@main with: + scheme_name: CQRS + filename: ${{ matrix.name }} token: ${{ secrets.CODECOV_TOKEN }} - xcode: true - xcode_archive_path: test_output/${{ matrix.name }}.xcresult - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.name }} - path: test_output watchOS: name: ${{ matrix.name }} @@ -125,6 +149,18 @@ jobs: fail-fast: false matrix: include: + - destination: "OS=11.1,name=Apple Watch Series 10 (46mm)" + name: "watchOS 11.1" + xcode: "Xcode_16.1" + runsOn: macOS-14 + - destination: "OS=11.0,name=Apple Watch Series 10 (46mm)" + name: "watchOS 11.0" + xcode: "Xcode_16.0" + runsOn: macOS-14 + - destination: "OS=10.5,name=Apple Watch Series 9 (45mm)" + name: "watchOS 10.5" + xcode: "Xcode_15.4" + runsOn: macOS-14 - destination: "OS=10.0,name=Apple Watch Series 9 (45mm)" name: "watchOS 10.0" xcode: "Xcode_15.0" @@ -137,16 +173,12 @@ jobs: - uses: actions/checkout@v3 - name: ${{ matrix.name }} run: xcodebuild test -scheme "CQRS" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1 - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3.1.0 + - name: Upload test coverage reports to Codecov + uses: space-code/oss-common-actions/.github/actions/upload_test_coverage_report@main with: + scheme_name: CQRS + filename: ${{ matrix.name }} token: ${{ secrets.CODECOV_TOKEN }} - xcode: true - xcode_archive_path: test_output/${{ matrix.name }}.xcresult - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.name }} - path: test_output spm: name: ${{ matrix.name }} @@ -158,10 +190,16 @@ jobs: fail-fast: false matrix: include: - - name: "Xcode 15" + - name: "macOS 14, SPM 6.0.2 Test" + xcode: "Xcode_16.1" + runsOn: macOS-14 + - name: "macOS 14, SPM 6.0.0 Test" + xcode: "Xcode_16.0" + runsOn: macOS-14 + - name: "macOS 14, SPM 5.9.0 Test" xcode: "Xcode_15.0" - runsOn: macos-13 - - name: "Xcode 14" + runsOn: macos-14 + - name: "macOS 13, SPM 5.8.1 Test" xcode: "Xcode_14.3.1" runsOn: macos-13 steps: @@ -186,11 +224,11 @@ jobs: discover-typos: name: Discover Typos - runs-on: macOS-12 + runs-on: macOS-13 env: DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Discover typos run: | export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.11/bin" diff --git a/.swiftlint.yml b/.swiftlint.yml index 4f1be08..72cdfb1 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -3,6 +3,8 @@ excluded: - Package.swift - Package@swift-5.7.swift - Package@swift-5.8.swift + - Package@swift-5.9.swift + - Package@swift-5.10.swift - .build # Rules @@ -134,4 +136,4 @@ nesting: type_name: max_length: warning: 40 - error: 50 \ No newline at end of file + error: 50 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5facb39..69691c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,30 @@ # Change Log All notable changes to this project will be documented in this file. -## [Unreleased] +#### 1.x Releases +- `1.1.x` Releases - [1.1.0](#110) +- `1.0.x` Releases - [1.0.0](#100) | [1.0.1](#101) + +## [1.1.0](https://github.com/space-code/cqrs/releases/tag/1.1.0) +Released on 2024-12-25. + #### Added -- Integrate `visionOS` support +- Bump the Swift version to 6.0. + - Added in Pull Request [#7](https://github.com/space-code/cqrs/pull/6) +- Integrate `visionOS` support. - Added in Pull Request [#6](https://github.com/space-code/cqrs/pull/6) -- Update GitHub Actions, integrate `danger`, and update templates +- Update GitHub Actions, integrate `danger`, and update templates. - Added in Pull Request [#5](https://github.com/space-code/cqrs/pull/5) -- Add badges for Swift Version Compatibility and Platform Compatibility +- Add badges for Swift Version Compatibility and Platform Compatibility. - Added in Pull Request [#4](https://github.com/space-code/cqrs/pull/4) -#### 1.x Releases -- `1.0.x` Releases - [1.0.0](#100) | [1.0.1](#101) - ## [1.0.1](https://github.com/space-code/cqrs/releases/tag/1.0.1) Released on 2023-09-15 -### Added +#### Added - Integrate CodeCov. -### Updated +#### Updated - Documentation typos. ## [1.0.0](https://github.com/space-code/cqrs/releases/tag/1.0.0) diff --git a/Mintfile b/Mintfile index 1f32d33..4953f18 100644 --- a/Mintfile +++ b/Mintfile @@ -1,2 +1,2 @@ -nicklockwood/SwiftFormat@0.47.12 -realm/SwiftLint@0.47.1 \ No newline at end of file +nicklockwood/SwiftFormat@0.52.7 +realm/SwiftLint@0.53.0 diff --git a/Package.swift b/Package.swift index f8a6074..8d67294 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.9 +// swift-tools-version: 6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/Package@swift-5.10.swift b/Package@swift-5.10.swift new file mode 100644 index 0000000..5e00463 --- /dev/null +++ b/Package@swift-5.10.swift @@ -0,0 +1,34 @@ +// swift-tools-version: 5.10 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "CQRS", + platforms: [ + .macOS(.v13), + .iOS(.v16), + .watchOS(.v9), + .tvOS(.v16), + .visionOS(.v1), + ], + products: [ + .library( + name: "CQRS", + targets: ["CQRS"] + ), + ], + dependencies: [ + .package(url: "https://github.com/AliSoftware/Dip", .upToNextMajor(from: "7.1.1")), + ], + targets: [ + .target( + name: "CQRS", + dependencies: ["Dip"] + ), + .testTarget( + name: "CQRSTests", + dependencies: ["CQRS"] + ), + ] +) diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift new file mode 100644 index 0000000..f8a6074 --- /dev/null +++ b/Package@swift-5.9.swift @@ -0,0 +1,34 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "CQRS", + platforms: [ + .macOS(.v13), + .iOS(.v16), + .watchOS(.v9), + .tvOS(.v16), + .visionOS(.v1), + ], + products: [ + .library( + name: "CQRS", + targets: ["CQRS"] + ), + ], + dependencies: [ + .package(url: "https://github.com/AliSoftware/Dip", .upToNextMajor(from: "7.1.1")), + ], + targets: [ + .target( + name: "CQRS", + dependencies: ["Dip"] + ), + .testTarget( + name: "CQRSTests", + dependencies: ["CQRS"] + ), + ] +)