Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Add end-to-end continuous integration tests for Homebrew distribution #243

Merged
merged 4 commits into from
Apr 24, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/homebrew_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: homebrew CI

on:
push:
branches: [master]
schedule:
- cron: 0 0 * * *

jobs:
homebrew-bottle:
runs-on: macos-10.15
name: homebrew from bottle

steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: .build
key: ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-
- name: Install swift-doc
run: brew install swiftdocorg/formulae/swift-doc --force-bottle
- name: Run Tests
run: |
swift test --filter EndToEndTests. -Xswiftc -DUSE_HOMEBREW

homebrew-sources:
runs-on: macos-11.0

name: homebrew from source
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: .build
key: ${{ runner.os }}-spm-xcode-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-xcode-
- name: Install swift-doc
run: brew install swiftdocorg/formulae/swift-doc --build-from-source
- name: Run Tests
run: swift test --filter EndToEndTests. -Xswiftc -DUSE_HOMEBREW
4 changes: 2 additions & 2 deletions Tests/EndToEndTests/CoverageSubcommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import XCTest

final class CoverageSubcommandTests: XCTestCase {
func testStandardOutput() throws {
let command = Bundle.productsDirectory.appendingPathComponent("swift-doc")
let command = getSwiftDocCommand()

let outputDirectory = try temporaryDirectory()
defer { try? FileManager.default.removeItem(at: outputDirectory) }
Expand All @@ -20,7 +20,7 @@ final class CoverageSubcommandTests: XCTestCase {
}

func testFileOutput() throws {
let command = Bundle.productsDirectory.appendingPathComponent("swift-doc")
let command = getSwiftDocCommand()

let outputDirectory = try temporaryDirectory()
let outputFile = outputDirectory.appendingPathComponent("report.json")
Expand Down
2 changes: 1 addition & 1 deletion Tests/EndToEndTests/DiagramSubcommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import XCTest

final class DiagramSubcommandTests: XCTestCase {
func testStandardOutput() throws {
let command = Bundle.productsDirectory.appendingPathComponent("swift-doc")
let command = getSwiftDocCommand()

let outputDirectory = try temporaryDirectory()
defer { try? FileManager.default.removeItem(at: outputDirectory) }
Expand Down
2 changes: 1 addition & 1 deletion Tests/EndToEndTests/GenerateSubcommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import XCTest

final class GenerateSubcommandTests: XCTestCase {
func testCommonMark() throws {
let command = Bundle.productsDirectory.appendingPathComponent("swift-doc")
let command = getSwiftDocCommand()

let outputDirectory = try temporaryDirectory()
defer { try? FileManager.default.removeItem(at: outputDirectory) }
Expand Down
11 changes: 11 additions & 0 deletions Tests/EndToEndTests/Helpers/XCTestCase+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import XCTest

extension XCTestCase {
func getSwiftDocCommand() -> URL {
#if USE_HOMEBREW
return URL(fileURLWithPath: "/usr/local/bin/swift-doc")
#else
return Bundle.productsDirectory.appendingPathComponent("swift-doc")
#endif
}
}