Browse Source

Add initial source code, with passing test

master
Matthias Neeracher 1 year ago
parent
commit
7a9535bdfe
7 changed files with 88 additions and 2 deletions
  1. +9
    -0
      .drone.yml
  2. +28
    -0
      Package.swift
  3. +17
    -2
      README.md
  4. +3
    -0
      Sources/drone-tutorial-swift/drone_tutorial_swift.swift
  5. +7
    -0
      Tests/LinuxMain.swift
  6. +9
    -0
      Tests/drone-tutorial-swiftTests/XCTestManifests.swift
  7. +15
    -0
      Tests/drone-tutorial-swiftTests/drone_tutorial_swiftTests.swift

+ 9
- 0
.drone.yml View File

@@ -0,0 +1,9 @@
kind: pipeline
name: default

steps:
- name: test
image: swift:4.2
commands:
- swift build
- swift test

+ 28
- 0
Package.swift View File

@@ -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"]),
]
)

+ 17
- 2
README.md View File

@@ -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.
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

+ 3
- 0
Sources/drone-tutorial-swift/drone_tutorial_swift.swift View File

@@ -0,0 +1,3 @@
struct drone_tutorial_swift {
var text = "Hello, World!"
}

+ 7
- 0
Tests/LinuxMain.swift View File

@@ -0,0 +1,7 @@
import XCTest

import drone_tutorial_swiftTests

var tests = [XCTestCaseEntry]()
tests += drone_tutorial_swiftTests.allTests()
XCTMain(tests)

+ 9
- 0
Tests/drone-tutorial-swiftTests/XCTestManifests.swift View File

@@ -0,0 +1,9 @@
import XCTest

#if !os(macOS)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(drone_tutorial_swiftTests.allTests),
]
}
#endif

+ 15
- 0
Tests/drone-tutorial-swiftTests/drone_tutorial_swiftTests.swift View File

@@ -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),
]
}

Loading…
Cancel
Save