From 4ac78dd98e4076b0b3b0a058fdbf76420863182b Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Mon, 5 Aug 2024 11:37:11 +0100 Subject: [PATCH] wip split build tool for example app --- .github/workflows/check.yaml | 25 ++++++++++++++++++++++++- Sources/BuildTool/BuildTool.swift | 9 +++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index d925238c..7b891cf9 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -75,4 +75,27 @@ jobs: xcode-version: ${{ matrix.tooling.xcode-version }} - name: Build and run tests - run: swift run BuildTool --platform ${{ matrix.platform }} --swift-version ${{ matrix.tooling.swift-version }} + run: swift run BuildTool build-and-test-library --platform ${{ matrix.platform }} --swift-version ${{ matrix.tooling.swift-version }} + + check-example-app: + name: Example app, ${{matrix.platform}} (Xcode ${{ matrix.tooling.xcode-version }}, Swift ${{ matrix.tooling.swift-version }}) + runs-on: macos-latest + + strategy: + fail-fast: false + matrix: + tooling: + - xcode-version: 15.3 + swift-version: 5 + - xcode-version: 16-beta + swift-version: 6 + platform: [macOS, iOS, tvOS] + + steps: + - uses: actions/checkout@v4 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ matrix.tooling.xcode-version }} + + - name: Build example app + run: swift run BuildTool build-example-app --platform ${{ matrix.platform }} --swift-version ${{ matrix.tooling.swift-version }} diff --git a/Sources/BuildTool/BuildTool.swift b/Sources/BuildTool/BuildTool.swift index 14658a67..43a6ea23 100644 --- a/Sources/BuildTool/BuildTool.swift +++ b/Sources/BuildTool/BuildTool.swift @@ -64,12 +64,17 @@ enum Error: Swift.Error { case simulatorLookupFailed(message: String) } +@main // TODO: Is there a better way to make sure that this script has access to macOS APIs that are more recent than the package’s deployment target? @available(macOS 14, *) -@main struct BuildTool: ParsableCommand { - @Option var platform: Platform + static let configuration = CommandConfiguration(subcommands: [BuildAndTestLibrary.self]) +} +// TODO: Is there a better way to make sure that this script has access to macOS APIs that are more recent than the package’s deployment target? +@available(macOS 14, *) +struct BuildAndTestLibrary: ParsableCommand { + @Option var platform: Platform @Option var swiftVersion: Int mutating func run() throws {