Compare commits
30 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
df94499fa0 | |
![]() |
32af356776 | |
![]() |
ee88e58e21 | |
![]() |
0ce283b606 | |
![]() |
529b93e426 | |
![]() |
a05a0aeaf4 | |
![]() |
45fd75dc11 | |
![]() |
623707cd8a | |
![]() |
2d95635267 | |
![]() |
bad0716ee7 | |
![]() |
a856efc48b | |
![]() |
b459bade44 | |
![]() |
2e0d20cd9f | |
![]() |
cf3ac99206 | |
![]() |
de67d2bf2b | |
![]() |
a101e9db31 | |
![]() |
51a78e73b4 | |
![]() |
81a3b70dd7 | |
![]() |
5ca32d1a8a | |
![]() |
9880a5beb7 | |
![]() |
eaaff29222 | |
![]() |
53bf406c49 | |
![]() |
51a77ce5fa | |
![]() |
9bd3512018 | |
![]() |
90880c1488 | |
![]() |
73b647a000 | |
![]() |
880976adba | |
![]() |
8d64d3b68c | |
![]() |
25613f7ffd | |
![]() |
211c5f4deb |
|
@ -0,0 +1,47 @@
|
||||||
|
name: Swift
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: macos-12
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
xcode: ["13.1", "13.3.1", "14.2"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Select Xcode
|
||||||
|
run: |
|
||||||
|
xcodebuild -version
|
||||||
|
ls -nt /Applications/ | grep "Xcode*"
|
||||||
|
sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app
|
||||||
|
xcodebuild -version
|
||||||
|
- name: Run tests
|
||||||
|
run: swift test
|
||||||
|
- name: Build
|
||||||
|
run: swift build --disable-sandbox -c release
|
||||||
|
- name: Create test release
|
||||||
|
run: ./.build/release/rocket 1.0.0 --rocket-file .test.yml
|
||||||
|
build-macos11:
|
||||||
|
runs-on: macos-11
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
xcode: ["12.5.1", "13.0"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Select Xcode
|
||||||
|
run: |
|
||||||
|
xcodebuild -version
|
||||||
|
ls -nt /Applications/ | grep "Xcode*"
|
||||||
|
sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app
|
||||||
|
xcodebuild -version
|
||||||
|
- name: Run tests
|
||||||
|
run: swift test
|
||||||
|
- name: Build
|
||||||
|
run: swift build --disable-sandbox -c release
|
||||||
|
- name: Create test release
|
||||||
|
run: ./.build/release/rocket 1.0.0 --rocket-file .test.yml
|
|
@ -2,3 +2,4 @@
|
||||||
/.build
|
/.build
|
||||||
/Packages
|
/Packages
|
||||||
/*.xcodeproj
|
/*.xcodeproj
|
||||||
|
/.swiftpm/xcode
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Shiba Package Manager
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -1,31 +1,13 @@
|
||||||
{
|
{
|
||||||
"object": {
|
"object": {
|
||||||
"pins": [
|
"pins": [
|
||||||
{
|
|
||||||
"package": "CwlCatchException",
|
|
||||||
"repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "7cd2f8cacc4d22f21bc0b2309c3b18acf7957b66",
|
|
||||||
"version": "1.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"package": "CwlPreconditionTesting",
|
|
||||||
"repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "c228db5d2ad1b01ebc84435e823e6cca4e3db98b",
|
|
||||||
"version": "1.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"package": "Komondor",
|
"package": "Komondor",
|
||||||
"repositoryURL": "https://github.com/shibapm/Komondor.git",
|
"repositoryURL": "https://github.com/shibapm/Komondor.git",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "3cd6d76887816ead5931ddbfb249c2935f518e17",
|
"revision": "90b087b1e39069684b1ff4bf915c2aae594f2d60",
|
||||||
"version": "1.0.4"
|
"version": "1.1.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -42,8 +24,8 @@
|
||||||
"repositoryURL": "https://github.com/Quick/Nimble",
|
"repositoryURL": "https://github.com/Quick/Nimble",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "6abeb3f5c03beba2b9e4dbe20886e773b5b629b6",
|
"revision": "7a46a5fc86cb917f69e3daf79fcb045283d8f008",
|
||||||
"version": "8.0.4"
|
"version": "8.1.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -51,8 +33,8 @@
|
||||||
"repositoryURL": "https://github.com/shibapm/PackageConfig.git",
|
"repositoryURL": "https://github.com/shibapm/PackageConfig.git",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "fd0829aac9851434b3d2db0890e27bc489fc973a",
|
"revision": "7081db0a7ad0ce6002115944c26c915167dc0617",
|
||||||
"version": "0.12.2"
|
"version": "1.1.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -60,8 +42,8 @@
|
||||||
"repositoryURL": "https://github.com/Quick/Quick",
|
"repositoryURL": "https://github.com/Quick/Quick",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "33682c2f6230c60614861dfc61df267e11a1602f",
|
"revision": "8cce6acd38f965f5baa3167b939f86500314022b",
|
||||||
"version": "2.2.0"
|
"version": "3.1.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -69,8 +51,8 @@
|
||||||
"repositoryURL": "https://github.com/JohnSundell/ShellOut.git",
|
"repositoryURL": "https://github.com/JohnSundell/ShellOut.git",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "4ebf25863deb9c3c02696704fc3d39736183f258",
|
"revision": "e1577acf2b6e90086d01a6d5e2b8efdaae033568",
|
||||||
"version": "2.2.1"
|
"version": "2.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -78,8 +60,8 @@
|
||||||
"repositoryURL": "https://github.com/nicklockwood/SwiftFormat.git",
|
"repositoryURL": "https://github.com/nicklockwood/SwiftFormat.git",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "b564570c139d1c36292e8a5bb08d4ba6818b0a91",
|
"revision": "fab94f3ca17f0f75e87787ed83b3a9423348b14c",
|
||||||
"version": "0.43.0"
|
"version": "0.49.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -87,8 +69,8 @@
|
||||||
"repositoryURL": "https://github.com/kareman/SwiftShell",
|
"repositoryURL": "https://github.com/kareman/SwiftShell",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "a6014fe94c3dbff0ad500e8da4f251a5d336530b",
|
"revision": "99680b2efc7c7dbcace1da0b3979d266f02e213c",
|
||||||
"version": "5.1.0-beta.1"
|
"version": "5.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -96,8 +78,8 @@
|
||||||
"repositoryURL": "https://github.com/f-meloni/TestSpy",
|
"repositoryURL": "https://github.com/f-meloni/TestSpy",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "e2970747d5d2d280367b446cbd8d1f8c154333b4",
|
"revision": "63398d17c70ba7419cec78834f22be86b850643b",
|
||||||
"version": "0.4.1"
|
"version": "0.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -105,8 +87,8 @@
|
||||||
"repositoryURL": "https://github.com/jpsim/Yams",
|
"repositoryURL": "https://github.com/jpsim/Yams",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "c947a306d2e80ecb2c0859047b35c73b8e1ca27f",
|
"revision": "f47ba4838c30dbd59998a4e4c87ab620ff959e8a",
|
||||||
"version": "2.0.0"
|
"version": "5.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// swift-tools-version:5.1
|
// swift-tools-version:5.4
|
||||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
@ -14,10 +14,10 @@ let package = Package(
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// Dependencies declare other packages that this package depends on.
|
// Dependencies declare other packages that this package depends on.
|
||||||
.package(url: "https://github.com/jpsim/Yams", from: "2.0.0"),
|
.package(url: "https://github.com/jpsim/Yams", from: "5.0.0"),
|
||||||
.package(url: "https://github.com/shibapm/Logger", from: "0.2.2"),
|
.package(url: "https://github.com/shibapm/Logger", from: "0.2.2"),
|
||||||
.package(url: "https://github.com/kareman/SwiftShell", .exact("5.1.0-beta.1")),
|
.package(url: "https://github.com/kareman/SwiftShell", from: "5.1.0"),
|
||||||
.package(url: "https://github.com/shibapm/PackageConfig.git", from: "0.10.0"),
|
.package(url: "https://github.com/shibapm/PackageConfig.git", from: "1.0.0"),
|
||||||
// Dev Dependencies for testing.setup
|
// Dev Dependencies for testing.setup
|
||||||
.package(url: "https://github.com/Quick/Nimble", from: "8.0.0"), // dev
|
.package(url: "https://github.com/Quick/Nimble", from: "8.0.0"), // dev
|
||||||
.package(url: "https://github.com/f-meloni/TestSpy", from: "0.3.1"), // dev
|
.package(url: "https://github.com/f-meloni/TestSpy", from: "0.3.1"), // dev
|
||||||
|
@ -31,7 +31,7 @@ let package = Package(
|
||||||
name: "RocketLib",
|
name: "RocketLib",
|
||||||
dependencies: ["Logger", "SwiftShell"]
|
dependencies: ["Logger", "SwiftShell"]
|
||||||
),
|
),
|
||||||
.target(
|
.executableTarget(
|
||||||
name: "Rocket",
|
name: "Rocket",
|
||||||
dependencies: ["Yams", "Logger", "PackageConfig", "RocketLib"]
|
dependencies: ["Yams", "Logger", "PackageConfig", "RocketLib"]
|
||||||
),
|
),
|
||||||
|
|
|
@ -29,7 +29,7 @@ steps:
|
||||||
```
|
```
|
||||||
|
|
||||||
#### With PackageConfig
|
#### With PackageConfig
|
||||||
With PackageConfig (https://github.com/orta/PackageConfig) you can put the configuration at the end of your `Package.swift`
|
With [PackageConfig](https://github.com/shibapm/PackageConfig) you can put the configuration at the end of your `Package.swift`
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
#if canImport(PackageConfig)
|
#if canImport(PackageConfig)
|
||||||
|
|
|
@ -32,7 +32,8 @@ if let rocketYamlPath = RocketFileFinder.rocketFilePath() {
|
||||||
|
|
||||||
dictionary = loadedDictionary
|
dictionary = loadedDictionary
|
||||||
} else if let packageConfig = try? PackageConfiguration.load().configuration,
|
} else if let packageConfig = try? PackageConfiguration.load().configuration,
|
||||||
let rocketConfig = packageConfig["rocket"] as? [String: Any] {
|
let rocketConfig = packageConfig["rocket"] as? [String: Any]
|
||||||
|
{
|
||||||
dictionary = rocketConfig
|
dictionary = rocketConfig
|
||||||
} else {
|
} else {
|
||||||
dictionary = [:]
|
dictionary = [:]
|
||||||
|
|
|
@ -12,7 +12,8 @@ public enum ChecksParser {
|
||||||
|
|
||||||
private static func parseElement(_ element: Any) -> Check? {
|
private static func parseElement(_ element: Any) -> Check? {
|
||||||
if let string = element as? String,
|
if let string = element as? String,
|
||||||
let check = PreReleseCheck(rawValue: string) {
|
let check = PreReleseCheck(rawValue: string)
|
||||||
|
{
|
||||||
return check.check(dictionary: nil)
|
return check.check(dictionary: nil)
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -4,7 +4,8 @@ import Logger
|
||||||
final class BranchExecutor: ScriptLauncherExecutor<BranchParameters> {
|
final class BranchExecutor: ScriptLauncherExecutor<BranchParameters> {
|
||||||
override func executeStep(version: String, logger: Logger) {
|
override func executeStep(version: String, logger: Logger) {
|
||||||
guard let branchName = parameters.name,
|
guard let branchName = parameters.name,
|
||||||
!branchName.isEmpty else {
|
!branchName.isEmpty
|
||||||
|
else {
|
||||||
logger.logError("Invalid branch name")
|
logger.logError("Invalid branch name")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@ import Logger
|
||||||
final class ScriptExecutor: ScriptLauncherExecutor<ScriptParameters> {
|
final class ScriptExecutor: ScriptLauncherExecutor<ScriptParameters> {
|
||||||
override func executeStep(version: String, logger: Logger) {
|
override func executeStep(version: String, logger: Logger) {
|
||||||
guard let content = parameters.content,
|
guard let content = parameters.content,
|
||||||
!content.isEmpty else {
|
!content.isEmpty
|
||||||
|
else {
|
||||||
logger.logError("Invalid script content")
|
logger.logError("Invalid script content")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,20 +11,19 @@ final class SwiftScriptExecutor: DefaultExecutor<SwiftScriptParameters> {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let supportedSwiftCPaths = ["/usr/bin/swiftc", "/home/travis/.swiftenv/shims/swiftc"]
|
let supportedSwiftPaths = ["/usr/bin/swift", "/home/travis/.swiftenv/shims/swift"]
|
||||||
|
|
||||||
let swiftCPath = supportedSwiftCPaths.first { fileManager.fileExists(atPath: $0) }
|
let swiftPath = supportedSwiftPaths.first { fileManager.fileExists(atPath: $0) }
|
||||||
let swiftC = swiftCPath ?? "swiftc"
|
let swift = swiftPath ?? "swift"
|
||||||
let args = [
|
let args = [
|
||||||
"--driver-mode=swift",
|
|
||||||
scriptPath,
|
scriptPath,
|
||||||
version,
|
version,
|
||||||
] + parameters.arguments
|
] + parameters.arguments
|
||||||
|
|
||||||
logger.logInfo("Running: \(swiftC) \(args.joined(separator: " "))")
|
logger.logInfo("Running: \(swift) \(args.joined(separator: " "))")
|
||||||
|
|
||||||
let process = Process()
|
let process = Process()
|
||||||
process.launchPath = swiftC
|
process.launchPath = swift
|
||||||
process.arguments = args
|
process.arguments = args
|
||||||
|
|
||||||
let standardOutput = FileHandle.standardOutput
|
let standardOutput = FileHandle.standardOutput
|
||||||
|
|
|
@ -2,6 +2,6 @@ import Foundation
|
||||||
|
|
||||||
extension Dictionary {
|
extension Dictionary {
|
||||||
subscript<T: RawRepresentable, R>(rawRappresentable: T) -> R? where T.RawValue == Key {
|
subscript<T: RawRepresentable, R>(rawRappresentable: T) -> R? where T.RawValue == Key {
|
||||||
return self[rawRappresentable.rawValue] as? R
|
self[rawRappresentable.rawValue] as? R
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public final class RocketFileFinder {
|
public enum RocketFileFinder {
|
||||||
static let rocketFileParameter = "--rocket-file"
|
static let rocketFileParameter = "--rocket-file"
|
||||||
static let defaultRocketFilePath = ".rocket.yml"
|
static let defaultRocketFilePath = ".rocket.yml"
|
||||||
|
|
||||||
public static func rocketFilePath(args: [String] = CommandLine.arguments, fileManager: FileManager = .default) -> String? {
|
public static func rocketFilePath(args: [String] = CommandLine.arguments, fileManager: FileManager = .default) -> String? {
|
||||||
if let index = args.firstIndex(of: rocketFileParameter),
|
if let index = args.firstIndex(of: rocketFileParameter),
|
||||||
index < args.count - 1 {
|
index < args.count - 1
|
||||||
|
{
|
||||||
return args[index + 1]
|
return args[index + 1]
|
||||||
} else if fileManager.fileExists(atPath: defaultRocketFilePath) {
|
} else if fileManager.fileExists(atPath: defaultRocketFilePath) {
|
||||||
return defaultRocketFilePath
|
return defaultRocketFilePath
|
||||||
|
|
|
@ -38,7 +38,8 @@ public enum StepsParser {
|
||||||
return Step.script.executor(dictionary: [ScriptParameters.CodingKeys.content.rawValue: string])
|
return Step.script.executor(dictionary: [ScriptParameters.CodingKeys.content.rawValue: string])
|
||||||
}
|
}
|
||||||
} else if let stepDict = element as? [String: Any],
|
} else if let stepDict = element as? [String: Any],
|
||||||
let step = step(fromDictionary: stepDict) {
|
let step = step(fromDictionary: stepDict)
|
||||||
|
{
|
||||||
return step.executor(dictionary: stepDict[step.rawValue] as? [String: Any])
|
return step.executor(dictionary: stepDict[step.rawValue] as? [String: Any])
|
||||||
} else {
|
} else {
|
||||||
logger.logWarning("Invalid step found")
|
logger.logWarning("Invalid step found")
|
||||||
|
@ -61,7 +62,8 @@ public enum StepsParser {
|
||||||
|
|
||||||
private static func step(fromDictionary dictionary: [String: Any]) -> Step? {
|
private static func step(fromDictionary dictionary: [String: Any]) -> Step? {
|
||||||
guard let stepString = dictionary.keys.first,
|
guard let stepString = dictionary.keys.first,
|
||||||
dictionary.keys.count == 1 else {
|
dictionary.keys.count == 1
|
||||||
|
else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ public enum VersionBumpOption: String {
|
||||||
func newVersion(currentVersion: String) -> String {
|
func newVersion(currentVersion: String) -> String {
|
||||||
var versionComponent = currentVersion.split(separator: ".").map { String($0) }
|
var versionComponent = currentVersion.split(separator: ".").map { String($0) }
|
||||||
|
|
||||||
let componentIndex = self.index
|
let componentIndex = index
|
||||||
let newComponent = Int(versionComponent[componentIndex])?.advanced(by: 1) ?? 0
|
let newComponent = Int(versionComponent[componentIndex])?.advanced(by: 1) ?? 0
|
||||||
versionComponent[componentIndex] = newComponent.description
|
versionComponent[componentIndex] = newComponent.description
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,8 @@ final class SwiftScriptExecutorTests: XCTestCase {
|
||||||
|
|
||||||
executor.executeStep(version: "1.0.0", logger: Logger.testLogger)
|
executor.executeStep(version: "1.0.0", logger: Logger.testLogger)
|
||||||
|
|
||||||
expect(processLauncher.receivedProcess?.launchPath) == "/usr/bin/swiftc"
|
expect(processLauncher.receivedProcess?.launchPath) == "/usr/bin/swift"
|
||||||
expect(processLauncher.receivedProcess?.arguments) == [
|
expect(processLauncher.receivedProcess?.arguments) == [
|
||||||
"--driver-mode=swift",
|
|
||||||
testPath,
|
testPath,
|
||||||
"1.0.0",
|
"1.0.0",
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue