diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..59aabc4 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,9 @@ +kind: pipeline +name: default + +steps: +- name: test + image: swift:4.2 + commands: + - swift build + - swift test diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..758bd05 --- /dev/null +++ b/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version:4.2 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "drone-tutorial-swift", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "drone-tutorial-swift", + targets: ["drone-tutorial-swift"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "drone-tutorial-swift", + dependencies: []), + .testTarget( + name: "drone-tutorial-swiftTests", + dependencies: ["drone-tutorial-swift"]), + ] +) diff --git a/README.md b/README.md index b94084e..97c5853 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ -# drone-tutorial-swift +# Drone Tutorial: Swift -This is a swimple Swift project to observe the Drone Continuous Delivery platform in action. \ No newline at end of file +This is a swimple Swift project to observe the Drone Continuous Delivery platform in action. + +## Usage + +* Clone this project +* Set up a corresponding project on the Drone-equipped Git platform you want to try. +* Push the `master` branch to your own project. +* Log into drone. You should see a build getting created and succeeding. +* Push the `bad_test` branch to your own project. +* You should see a drone build getting created, and failing in the `test` stage. + +## License + +This is `CC0` licensed. Adapt it to whatever purpose you want. Have fun. + +`microtherion@gmail.com` 2019-02-02 diff --git a/Sources/drone-tutorial-swift/drone_tutorial_swift.swift b/Sources/drone-tutorial-swift/drone_tutorial_swift.swift new file mode 100644 index 0000000..e8aeab8 --- /dev/null +++ b/Sources/drone-tutorial-swift/drone_tutorial_swift.swift @@ -0,0 +1,3 @@ +struct drone_tutorial_swift { + var text = "Hello, World!" +} diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..27f84a5 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import drone_tutorial_swiftTests + +var tests = [XCTestCaseEntry]() +tests += drone_tutorial_swiftTests.allTests() +XCTMain(tests) diff --git a/Tests/drone-tutorial-swiftTests/XCTestManifests.swift b/Tests/drone-tutorial-swiftTests/XCTestManifests.swift new file mode 100644 index 0000000..b5b58ea --- /dev/null +++ b/Tests/drone-tutorial-swiftTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !os(macOS) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(drone_tutorial_swiftTests.allTests), + ] +} +#endif diff --git a/Tests/drone-tutorial-swiftTests/drone_tutorial_swiftTests.swift b/Tests/drone-tutorial-swiftTests/drone_tutorial_swiftTests.swift new file mode 100644 index 0000000..495e180 --- /dev/null +++ b/Tests/drone-tutorial-swiftTests/drone_tutorial_swiftTests.swift @@ -0,0 +1,15 @@ +import XCTest +@testable import drone_tutorial_swift + +final class drone_tutorial_swiftTests: XCTestCase { + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(drone_tutorial_swift().text, "Hello, World!") + } + + static var allTests = [ + ("testExample", testExample), + ] +}