This repository was archived by the owner on Jun 1, 2023. It is now read-only.
File tree 5 files changed +62
-14
lines changed 5 files changed +62
-14
lines changed Original file line number Diff line number Diff line change
1
+ name : Homebrew CI
2
+
3
+ on :
4
+ push :
5
+ branches : [master]
6
+ schedule :
7
+ - cron : 0 0 * * *
8
+
9
+ jobs :
10
+ homebrew-bottle :
11
+ runs-on : macos-10.15
12
+ name : Test Homebrew installation from bottle
13
+
14
+ steps :
15
+ - name : Checkout
16
+ uses : actions/checkout@v1
17
+ - uses : actions/cache@v2
18
+ with :
19
+ path : .build
20
+ key : ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
21
+ restore-keys : |
22
+ ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-
23
+ - name : Install swift-doc
24
+ run : brew install swiftdocorg/formulae/swift-doc --force-bottle
25
+ - name : Run Tests
26
+ run : |
27
+ swift test --filter EndToEndTests. -Xswiftc -DUSE_HOMEBREW
28
+
29
+ homebrew-sources :
30
+ runs-on : macos-11.0
31
+
32
+ name : Test Homebrew installation from sources
33
+ steps :
34
+ - name : Checkout
35
+ uses : actions/checkout@v1
36
+ - uses : actions/cache@v2
37
+ with :
38
+ path : .build
39
+ key : ${{ runner.os }}-spm-xcode-${{ hashFiles('**/Package.resolved') }}
40
+ restore-keys : |
41
+ ${{ runner.os }}-spm-xcode-
42
+ - name : Install swift-doc
43
+ run : brew install swiftdocorg/formulae/swift-doc --build-from-source
44
+ - name : Run Tests
45
+ run : swift test --filter EndToEndTests. -Xswiftc -DUSE_HOMEBREW
Original file line number Diff line number Diff line change @@ -2,12 +2,10 @@ import XCTest
2
2
3
3
final class CoverageSubcommandTests : XCTestCase {
4
4
func testStandardOutput( ) throws {
5
- let command = Bundle . productsDirectory. appendingPathComponent ( " swift-doc " )
6
-
7
5
let outputDirectory = try temporaryDirectory ( )
8
6
defer { try ? FileManager . default. removeItem ( at: outputDirectory) }
9
7
10
- try Process . run ( command: command ,
8
+ try Process . run ( command: swiftDocCommand ,
11
9
arguments: [
12
10
" coverage " ,
13
11
" Sources "
@@ -20,13 +18,11 @@ final class CoverageSubcommandTests: XCTestCase {
20
18
}
21
19
22
20
func testFileOutput( ) throws {
23
- let command = Bundle . productsDirectory. appendingPathComponent ( " swift-doc " )
24
-
25
21
let outputDirectory = try temporaryDirectory ( )
26
22
let outputFile = outputDirectory. appendingPathComponent ( " report.json " )
27
23
defer { try ? FileManager . default. removeItem ( at: outputDirectory) }
28
24
29
- try Process . run ( command: command ,
25
+ try Process . run ( command: swiftDocCommand ,
30
26
arguments: [
31
27
" coverage " ,
32
28
" --output " , outputFile. path,
Original file line number Diff line number Diff line change @@ -2,12 +2,10 @@ import XCTest
2
2
3
3
final class DiagramSubcommandTests : XCTestCase {
4
4
func testStandardOutput( ) throws {
5
- let command = Bundle . productsDirectory. appendingPathComponent ( " swift-doc " )
6
-
7
5
let outputDirectory = try temporaryDirectory ( )
8
6
defer { try ? FileManager . default. removeItem ( at: outputDirectory) }
9
7
10
- try Process . run ( command: command ,
8
+ try Process . run ( command: swiftDocCommand ,
11
9
arguments: [
12
10
" diagram " ,
13
11
" Sources "
Original file line number Diff line number Diff line change @@ -2,12 +2,10 @@ import XCTest
2
2
3
3
final class GenerateSubcommandTests : XCTestCase {
4
4
func testCommonMark( ) throws {
5
- let command = Bundle . productsDirectory. appendingPathComponent ( " swift-doc " )
6
-
7
5
let outputDirectory = try temporaryDirectory ( )
8
6
defer { try ? FileManager . default. removeItem ( at: outputDirectory) }
9
7
10
- try Process . run ( command: command ,
8
+ try Process . run ( command: swiftDocCommand ,
11
9
arguments: [
12
10
" generate " ,
13
11
" --module-name " , " SwiftDoc " ,
@@ -44,11 +42,10 @@ final class GenerateSubcommandTests: XCTestCase {
44
42
}
45
43
46
44
func testHTML( ) throws {
47
- let command = Bundle . productsDirectory. appendingPathComponent ( " swift-doc " )
48
45
let outputDirectory = try temporaryDirectory ( )
49
46
50
47
defer { try ? FileManager . default. removeItem ( at: outputDirectory) }
51
- try Process . run ( command: command ,
48
+ try Process . run ( command: swiftDocCommand ,
52
49
arguments: [
53
50
" generate " ,
54
51
" --module-name " , " SwiftDoc " ,
Original file line number Diff line number Diff line change
1
+ import XCTest
2
+ import Foundation
3
+
4
+ extension XCTestCase {
5
+ var swiftDocCommand : URL {
6
+ #if USE_HOMEBREW
7
+ return URL ( fileURLWithPath: " /usr/local/bin/swift-doc " )
8
+ #else
9
+ return Bundle . productsDirectory. appendingPathComponent ( " swift-doc " )
10
+ #endif
11
+ }
12
+ }
You can’t perform that action at this time.
0 commit comments