Skip to content

Commit ff2611e

Browse files
test: Adds self-tests & example package
1 parent 25e32ec commit ff2611e

5 files changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/self-test.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Self-test the CI workflows
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
uses: ./.github/workflows/lint.yaml
14+
with:
15+
package_path: WorkflowTestPackage
16+
test:
17+
uses: ./.github/workflows/test.yaml
18+
with:
19+
package_path: WorkflowTestPackage

WorkflowTestPackage/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc

WorkflowTestPackage/Package.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// swift-tools-version:5.8
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "WorkflowTestPackage",
7+
products: [
8+
.library(
9+
name: "WorkflowTestPackage",
10+
targets: ["WorkflowTestPackage"]
11+
),
12+
],
13+
targets: [
14+
// Targets are the basic building blocks of a package, defining a module or a test suite.
15+
// Targets can depend on other targets in this package and products from dependencies.
16+
.target(
17+
name: "WorkflowTestPackage"
18+
),
19+
.testTarget(
20+
name: "WorkflowTestPackageTests",
21+
dependencies: ["WorkflowTestPackage"]
22+
),
23+
]
24+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public struct WorkflowTest {
2+
public let foo = "bar"
3+
4+
public init() {}
5+
6+
public func hello() -> String {
7+
return "world"
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@testable import WorkflowTestPackage
2+
3+
import XCTest
4+
5+
class WorkflowTestPackageTests: XCTestCase {
6+
func testHello() async throws {
7+
XCTAssertEqual(WorkflowTest().hello(), "world")
8+
}
9+
}

0 commit comments

Comments
 (0)