Skip to content

Commit

Permalink
Merge pull request #3 from MFB-Technologies-Inc/feature/refactor-file…
Browse files Browse the repository at this point in the history
…-structure

Feature/refactor file structure
  • Loading branch information
r-jarvis authored Jul 10, 2024
2 parents 9d17014 + 9a2b029 commit c6e9500
Show file tree
Hide file tree
Showing 28 changed files with 395 additions and 275 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ jobs:
run: swiftformat --version
- name: Format lint
run: swiftformat --lint .
- name: Install swiftlint
run: brew update && brew install swiftlint
- name: SwiftLint version
run: swiftlint --version
- name: Lint
run: swiftlint lint --quiet
macos-test:
runs-on: macos-13
runs-on: macos-14
environment: default
strategy:
matrix:
xcode: ['14.3', '15.0']
# Swift: 5.8, 5.9
xcode: ['15.0.1', '15.3']
# Swift: 5.9 5.10
steps:
- uses: actions/checkout@v3
- name: Select Xcode ${{ matrix.xcode }}
Expand Down
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump.git",
"state" : {
"revision" : "edd66cace818e1b1c6f1b3349bb1d8e00d6f8b01",
"version" : "1.0.0"
"revision" : "f01efb26f3a192a0e88dcdb7c3c391ec2fc25d9c",
"version" : "1.3.0"
}
},
{
"identity" : "swift-http-types",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types.git",
"state" : {
"revision" : "99d066e29effa8845e4761dd3f2f831edfdf8925",
"version" : "1.0.0"
"revision" : "1ddbea1ee34354a6a2532c60f98501c35ae8edfa",
"version" : "1.2.0"
}
},
{
Expand All @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version" : "1.0.2"
"revision" : "6f30bdba373bbd7fbfe241dddd732651f2fbd1e2",
"version" : "1.1.2"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.8
// swift-tools-version: 5.9

import PackageDescription

Expand Down
19 changes: 19 additions & 0 deletions Sources/AZCore/AZDeleteRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// AZDeleteRequest.swift
// azure-devops-swift
//
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

import Foundation
import HTTPTypes

public protocol AZDeleteRequest: AZRequest {}

extension AZDeleteRequest {
public var method: HTTPRequest.Method { .delete }
public func body(encoder _: some JSONEncoder) throws -> Data? {
nil
}
}
19 changes: 19 additions & 0 deletions Sources/AZCore/AZGetRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// AZGetRequest.swift
// azure-devops-swift
//
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

import Foundation
import HTTPTypes

public protocol AZGetRequest: AZRequest {}

extension AZGetRequest {
public var method: HTTPRequest.Method { .get }
public func body(encoder _: some JSONEncoder) throws -> Data? {
nil
}
}
15 changes: 15 additions & 0 deletions Sources/AZCore/AZPostRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// AZPostRequest.swift
// azure-devops-swift
//
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

import HTTPTypes

public protocol AZPostRequest: AZRequest {}

extension AZPostRequest {
public var method: HTTPRequest.Method { .post }
}
15 changes: 15 additions & 0 deletions Sources/AZCore/AZPutRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// AZPutRequest.swift
// azure-devops-swift
//
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

import HTTPTypes

public protocol AZPutRequest: AZRequest {}

extension AZPutRequest {
public var method: HTTPRequest.Method { .put }
}
30 changes: 0 additions & 30 deletions Sources/AZCore/AZRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,3 @@ public protocol AZRequest {
var method: HTTPRequest.Method { get }
func body(encoder: some JSONEncoder) throws -> Data?
}

public protocol AZDeleteRequest: AZRequest {}

extension AZDeleteRequest {
public var method: HTTPRequest.Method { .delete }
public func body(encoder _: some JSONEncoder) throws -> Data? {
nil
}
}

public protocol AZGetRequest: AZRequest {}

extension AZGetRequest {
public var method: HTTPRequest.Method { .get }
public func body(encoder _: some JSONEncoder) throws -> Data? {
nil
}
}

public protocol AZPostRequest: AZRequest {}

extension AZPostRequest {
public var method: HTTPRequest.Method { .post }
}

public protocol AZPutRequest: AZRequest {}

extension AZPutRequest {
public var method: HTTPRequest.Method { .put }
}
55 changes: 55 additions & 0 deletions Sources/AZPipelines/AZPipeline+Configuration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// AZPipeline+Configuration.swift
// azure-devops-swift
//
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

extension AZPipeline {
public struct Configuration: Hashable, Sendable, Codable {
public var type: ConfigurationType
public var repository: ConfigurationRepository?
public var path: String?

public init(type: ConfigurationType, repository: ConfigurationRepository? = nil, path: String? = nil) {
self.type = type
self.repository = repository
self.path = path
}

public static let designerHyphenJson: Self = Configuration(type: .designerHyphenJson)
public static let designerJson: Self = Configuration(type: .designerJson)
public static let justInTime: Self = Configuration(type: .justInTime)
public static let unknown: Self = Configuration(type: .unknown)
public static func yaml(path: String, repository: ConfigurationRepository, type _: ConfigurationType) -> Self {
self.init(
type: .yaml,
repository: repository,
path: path
)
}
}

public enum ConfigurationType: String, Hashable, Sendable, CaseIterable, Codable {
case designerHyphenJson
case designerJson
case justInTime
case unknown
case yaml
}

public struct ConfigurationRepository: Hashable, Sendable, Codable {
public let id: AZRepositoryId
public let type: RepositoryType

public init(id: AZRepositoryId, type: RepositoryType) {
self.id = id
self.type = type
}
}

public enum RepositoryType: String, Hashable, Sendable, Codable {
case azureReposGit
}
}
48 changes: 0 additions & 48 deletions Sources/AZPipelines/AZPipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,51 +40,3 @@ public struct AZPipeline: Identifiable, Hashable, Sendable, Codable {
self._links = _links
}
}

extension AZPipeline {
public struct Configuration: Hashable, Sendable, Codable {
public var type: ConfigurationType
public var repository: ConfigurationRepository?
public var path: String?

public init(type: ConfigurationType, repository: ConfigurationRepository? = nil, path: String? = nil) {
self.type = type
self.repository = repository
self.path = path
}

public static let designerHyphenJson: Self = Configuration(type: .designerHyphenJson)
public static let designerJson: Self = Configuration(type: .designerJson)
public static let justInTime: Self = Configuration(type: .justInTime)
public static let unknown: Self = Configuration(type: .unknown)
public static func yaml(path: String, repository: ConfigurationRepository, type _: ConfigurationType) -> Self {
self.init(
type: .yaml,
repository: repository,
path: path
)
}
}

public enum ConfigurationType: String, Hashable, Sendable, CaseIterable, Codable {
case designerHyphenJson
case designerJson
case justInTime
case unknown
case yaml
}

public struct ConfigurationRepository: Hashable, Sendable, Codable {
public let id: AZRepositoryId
public let type: RepositoryType

public init(id: AZRepositoryId, type: RepositoryType) {
self.id = id
self.type = type
}
}

public enum RepositoryType: String, Hashable, Sendable, Codable {
case azureReposGit
}
}
4 changes: 0 additions & 4 deletions Sources/AZPipelinesFixtures/AZFixtures+Pipelines.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ import AZCoreFixtures
extension AZFixtures {
public enum Pipelines {}
}

extension AZFixtures.Pipelines {
public enum Json {}
}
13 changes: 13 additions & 0 deletions Sources/AZPipelinesFixtures/Pipelines+Json.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Pipelines+Json.swift
// azure-devops-swift
//
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

import AZCoreFixtures

extension AZFixtures.Pipelines {
public enum Json {}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// PipelineListResponse.swift
// Pipelines+ListResponse.swift
// azure-devops-swift
//
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
Expand Down Expand Up @@ -46,44 +46,4 @@ extension AZFixtures.Pipelines {
)
}

extension AZFixtures.Pipelines.Json {
public static let listResponse: StaticString = """
{
"count": 2,
"value": [
{
"_links": {
"self": {
"href": "https://dev.azure.com/azure-devops-swift/00000000-0000-0000-0000-000000000001/_apis/pipelines/67?revision=4"
},
"web": {
"href": "https://dev.azure.com/azure-devops-swift/00000000-0000-0000-0000-000000000001/_build/definition?definitionId=67"
}
},
"url": "https://dev.azure.com/azure-devops-swift/00000000-0000-0000-0000-000000000001/_apis/pipelines/67?revision=4",
"id": 67,
"revision": 4,
"name": "archive-blackberry-dev",
"folder": "\\\\Targets"
},
{
"_links": {
"self": {
"href": "https://dev.azure.com/azure-devops-swift/00000000-0000-0000-0000-000000000001/_apis/pipelines/218?revision=2"
},
"web": {
"href": "https://dev.azure.com/azure-devops-swift/00000000-0000-0000-0000-000000000001/_build/definition?definitionId=218"
}
},
"url": "https://dev.azure.com/azure-devops-swift/00000000-0000-0000-0000-000000000001/_apis/pipelines/218?revision=2",
"id": 218,
"revision": 2,
"name": "veracode-sandbox-scan",
"folder": "\\\\"
}
]
}
"""
}

// swiftlint:enable line_length
Loading

0 comments on commit c6e9500

Please sign in to comment.