From ad415194b28569756a039f61c375075ef7961988 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 10:48:17 -0700 Subject: [PATCH 01/14] Test GitHub Action Runners with Xcode 15.4 --- .github/workflows/build-and-test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a62aa6d..a4e883a 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -59,7 +59,6 @@ jobs: name: Build and Test iOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: - runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestApp resultBundle: TestApp-iOS.xcresult @@ -68,7 +67,6 @@ jobs: name: Build and Test iPadOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: - runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestApp destination: 'platform=iOS Simulator,name=iPad Air (5th generation)' @@ -78,7 +76,6 @@ jobs: name: Build and Test watchOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: - runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestAppWatchApp destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' @@ -88,7 +85,6 @@ jobs: name: Build and Test visionOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: - runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestApp destination: 'platform=visionOS Simulator,name=Apple Vision Pro' @@ -98,7 +94,6 @@ jobs: name: Build and Test tvOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: - runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestApp destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' From c14bab565e03b40a7e82211464f8ca944a6e46e3 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 10:52:24 -0700 Subject: [PATCH 02/14] Update build-and-test.yml --- .github/workflows/build-and-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a4e883a..f0913a4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -15,6 +15,10 @@ on: pull_request: workflow_dispatch: +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + jobs: packageios: name: Build and Test Swift Package iOS From a7e51da500fa310312bcf1bc58764d5e668b2344 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 11:18:49 -0700 Subject: [PATCH 03/14] Update GitHub Actions --- .github/workflows/build-and-test.yml | 16 +++++++--------- .github/workflows/main.yml | 24 ++++++++++++++++++++++++ .github/workflows/pull_request.yml | 13 +++++++------ 3 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index f0913a4..ab5860e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -9,17 +9,15 @@ name: Build and Test on: - push: - branches: - - main - pull_request: - workflow_dispatch: - -concurrency: - group: build-${{ github.ref }} - cancel-in-progress: true + workflow_call: jobs: + reuse_action: + name: REUSE Compliance Check + uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2 + swiftlint: + name: SwiftLint + uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2 packageios: name: Build and Test Swift Package iOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..7c70c3a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,24 @@ +# +# This source file is part of the TemplatePackage open source project +# +# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +name: Main + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: main + cancel-in-progress: false + +jobs: + buildandtest: + uses: ./.github/workflows/build-and-test.yml + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 45ed630..afc1b91 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -12,10 +12,11 @@ on: pull_request: workflow_dispatch: +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + jobs: - reuse_action: - name: REUSE Compliance Check - uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2 - swiftlint: - name: SwiftLint - uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2 + buildandtest: + uses: ./.github/workflows/build-and-test.yml + secrets: inherit From 8d2b4ec925a64a1746c66754293f69e6ce2f2c40 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 11:19:17 -0700 Subject: [PATCH 04/14] Update GitHub Actions --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c70c3a..091f168 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,4 +21,4 @@ concurrency: jobs: buildandtest: uses: ./.github/workflows/build-and-test.yml - secrets: inherit \ No newline at end of file + secrets: inherit From b1c407cf87a6cda299bb95da24add58bcfc31d96 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 13:46:04 -0700 Subject: [PATCH 05/14] Update GitHub Action ... --- .github/workflows/build-and-test.yml | 180 +++++++++++++-------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ab5860e..3e49f9d 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -12,75 +12,75 @@ on: workflow_call: jobs: - reuse_action: - name: REUSE Compliance Check - uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2 - swiftlint: - name: SwiftLint - uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2 - packageios: - name: Build and Test Swift Package iOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - scheme: TemplatePackage - resultBundle: TemplatePackage-iOS.xcresult - artifactname: TemplatePackage-iOS.xcresult - packagewatchos: - name: Build and Test Swift Package watchOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - scheme: TemplatePackage - destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' - resultBundle: TemplatePackage-watchOS.xcresult - artifactname: TemplatePackage-watchOS.xcresult - packagevisionos: - name: Build and Test Swift Package visionOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - scheme: TemplatePackage - destination: 'platform=visionOS Simulator,name=Apple Vision Pro' - resultBundle: TemplatePackage-visionOS.xcresult - artifactname: TemplatePackage-visionOS.xcresult - packagetvos: - name: Build and Test Swift Package tvOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - scheme: TemplatePackage - resultBundle: TemplatePackage-tvOS.xcresult - destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' - artifactname: TemplatePackage-tvOS.xcresult - packagemacos: - name: Build and Test Swift Package macOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - scheme: TemplatePackage - resultBundle: TemplatePackage-macOS.xcresult - destination: 'platform=macOS,arch=arm64' - artifactname: TemplatePackage-macOS.xcresult - ios: - name: Build and Test iOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - path: 'Tests/UITests' - scheme: TestApp - resultBundle: TestApp-iOS.xcresult - artifactname: TestApp-iOS.xcresult - ipados: - name: Build and Test iPadOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - path: 'Tests/UITests' - scheme: TestApp - destination: 'platform=iOS Simulator,name=iPad Air (5th generation)' - resultBundle: TestApp-iPadOS.xcresult - artifactname: TestApp-iPadOS.xcresult + # reuse_action: + # name: REUSE Compliance Check + # uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2 + # swiftlint: + # name: SwiftLint + # uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2 + # packageios: + # name: Build and Test Swift Package iOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # scheme: TemplatePackage + # resultBundle: TemplatePackage-iOS.xcresult + # artifactname: TemplatePackage-iOS.xcresult + # packagewatchos: + # name: Build and Test Swift Package watchOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # scheme: TemplatePackage + # destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' + # resultBundle: TemplatePackage-watchOS.xcresult + # artifactname: TemplatePackage-watchOS.xcresult + # packagevisionos: + # name: Build and Test Swift Package visionOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # scheme: TemplatePackage + # destination: 'platform=visionOS Simulator,name=Apple Vision Pro' + # resultBundle: TemplatePackage-visionOS.xcresult + # artifactname: TemplatePackage-visionOS.xcresult + # packagetvos: + # name: Build and Test Swift Package tvOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # scheme: TemplatePackage + # resultBundle: TemplatePackage-tvOS.xcresult + # destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' + # artifactname: TemplatePackage-tvOS.xcresult + # packagemacos: + # name: Build and Test Swift Package macOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # scheme: TemplatePackage + # resultBundle: TemplatePackage-macOS.xcresult + # destination: 'platform=macOS,arch=arm64' + # artifactname: TemplatePackage-macOS.xcresult + # ios: + # name: Build and Test iOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # path: 'Tests/UITests' + # scheme: TestApp + # resultBundle: TestApp-iOS.xcresult + # artifactname: TestApp-iOS.xcresult + # ipados: + # name: Build and Test iPadOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # path: 'Tests/UITests' + # scheme: TestApp + # destination: 'platform=iOS Simulator,name=iPad Air (5th generation)' + # resultBundle: TestApp-iPadOS.xcresult + # artifactname: TestApp-iPadOS.xcresult watchos: name: Build and Test watchOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: path: 'Tests/UITests' scheme: TestAppWatchApp - destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' + destination: 'platform=watchOS Simulator,OS=10.5,name=Apple Watch Series 9 (45mm)' resultBundle: TestApp-watchOS.xcresult artifactname: TestApp-watchOS.xcresult visionos: @@ -92,30 +92,30 @@ jobs: destination: 'platform=visionOS Simulator,name=Apple Vision Pro' resultBundle: TestApp-visionOS.xcresult artifactname: TestApp-visionOS.xcresult - tvos: - name: Build and Test tvOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - path: 'Tests/UITests' - scheme: TestApp - destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' - resultBundle: TestApp-tvOS.xcresult - artifactname: TestApp-tvOS.xcresult - codeql: - name: CodeQL - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - codeql: true - test: false - scheme: TemplatePackage - permissions: - security-events: write - actions: read - uploadcoveragereport: - name: Upload Coverage Report - needs: [packageios, packagewatchos, packagevisionos, packagetvos, packagemacos, ios, ipados, watchos, visionos, tvos] - uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 - with: - coveragereports: TemplatePackage-iOS.xcresult TemplatePackage-watchOS.xcresult TemplatePackage-visionOS.xcresult TemplatePackage-tvOS.xcresult TemplatePackage-macOS.xcresult TestApp-iOS.xcresult TestApp-iPadOS.xcresult TestApp-watchOS.xcresult TestApp-visionOS.xcresult TestApp-tvOS.xcresult - secrets: - token: ${{ secrets.CODECOV_TOKEN }} + # tvos: + # name: Build and Test tvOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # path: 'Tests/UITests' + # scheme: TestApp + # destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' + # resultBundle: TestApp-tvOS.xcresult + # artifactname: TestApp-tvOS.xcresult + # codeql: + # name: CodeQL + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # codeql: true + # test: false + # scheme: TemplatePackage + # permissions: + # security-events: write + # actions: read + # uploadcoveragereport: + # name: Upload Coverage Report + # needs: [packageios, packagewatchos, packagevisionos, packagetvos, packagemacos, ios, ipados, watchos, visionos, tvos] + # uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 + # with: + # coveragereports: TemplatePackage-iOS.xcresult TemplatePackage-watchOS.xcresult TemplatePackage-visionOS.xcresult TemplatePackage-tvOS.xcresult TemplatePackage-macOS.xcresult TestApp-iOS.xcresult TestApp-iPadOS.xcresult TestApp-watchOS.xcresult TestApp-visionOS.xcresult TestApp-tvOS.xcresult + # secrets: + # token: ${{ secrets.CODECOV_TOKEN }} From 146dd8ff729cc5711fd0de5cf84a6093d99c7db4 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 13:48:35 -0700 Subject: [PATCH 06/14] Update Destination --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 3e49f9d..3a93a3e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -80,7 +80,7 @@ jobs: with: path: 'Tests/UITests' scheme: TestAppWatchApp - destination: 'platform=watchOS Simulator,OS=10.5,name=Apple Watch Series 9 (45mm)' + destination: 'platform=watchOS Simulator,id=953DCCC7-16C9-44E6-B1BC-0D333FDD9205,OS=10.0,name=Apple Watch Series 9 (45mm)' resultBundle: TestApp-watchOS.xcresult artifactname: TestApp-watchOS.xcresult visionos: From 1a9af47331356a9a14faf867f49b43d8ba5f6db6 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 13:52:17 -0700 Subject: [PATCH 07/14] Update Destination --- .github/workflows/build-and-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 3a93a3e..7254b1e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -78,15 +78,17 @@ jobs: name: Build and Test watchOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestAppWatchApp - destination: 'platform=watchOS Simulator,id=953DCCC7-16C9-44E6-B1BC-0D333FDD9205,OS=10.0,name=Apple Watch Series 9 (45mm)' + destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' resultBundle: TestApp-watchOS.xcresult artifactname: TestApp-watchOS.xcresult visionos: name: Build and Test visionOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestApp destination: 'platform=visionOS Simulator,name=Apple Vision Pro' From d90150bb9539754217f265ef44a5f9b5bba126f2 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 15:02:12 -0700 Subject: [PATCH 08/14] Update Action --- .github/workflows/build-and-test.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7254b1e..650e890 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -78,22 +78,20 @@ jobs: name: Build and Test watchOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: - runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestAppWatchApp - destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' + destination: 'id=3C5F6AF7-5AB7-4FA4-9684-305E2533D6EA' resultBundle: TestApp-watchOS.xcresult artifactname: TestApp-watchOS.xcresult - visionos: - name: Build and Test visionOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - runsonlabels: '["macOS", "self-hosted"]' - path: 'Tests/UITests' - scheme: TestApp - destination: 'platform=visionOS Simulator,name=Apple Vision Pro' - resultBundle: TestApp-visionOS.xcresult - artifactname: TestApp-visionOS.xcresult + # visionos: + # name: Build and Test visionOS + # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + # with: + # path: 'Tests/UITests' + # scheme: TestApp + # destination: 'platform=visionOS Simulator,name=Apple Vision Pro' + # resultBundle: TestApp-visionOS.xcresult + # artifactname: TestApp-visionOS.xcresult # tvos: # name: Build and Test tvOS # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 From 1e60a78cc443936513f2793b8de5ed3580a48a32 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 15:20:45 -0700 Subject: [PATCH 09/14] Update Setup --- .github/workflows/build-and-test.yml | 74 ++++++++++--------- Tests/UITests/TestApp/OperatingSystem.swift | 20 +++++ Tests/UITests/TestApp/TestApp.swift | 1 + .../TestAppUITests/TestAppUITests.swift | 14 ++++ .../UITests/UITests.xcodeproj/project.pbxproj | 6 ++ 5 files changed, 79 insertions(+), 36 deletions(-) create mode 100644 Tests/UITests/TestApp/OperatingSystem.swift diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 650e890..3cb773c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -57,50 +57,52 @@ jobs: # resultBundle: TemplatePackage-macOS.xcresult # destination: 'platform=macOS,arch=arm64' # artifactname: TemplatePackage-macOS.xcresult - # ios: - # name: Build and Test iOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # path: 'Tests/UITests' - # scheme: TestApp - # resultBundle: TestApp-iOS.xcresult - # artifactname: TestApp-iOS.xcresult - # ipados: - # name: Build and Test iPadOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # path: 'Tests/UITests' - # scheme: TestApp - # destination: 'platform=iOS Simulator,name=iPad Air (5th generation)' - # resultBundle: TestApp-iPadOS.xcresult - # artifactname: TestApp-iPadOS.xcresult + ios: + name: Build and Test iOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + path: 'Tests/UITests' + scheme: TestApp + resultBundle: TestApp-iOS.xcresult + artifactname: TestApp-iOS.xcresult + ipados: + name: Build and Test iPadOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + path: 'Tests/UITests' + scheme: TestApp + destination: 'platform=iOS Simulator,name=iPad Air (5th generation)' + resultBundle: TestApp-iPadOS.xcresult + artifactname: TestApp-iPadOS.xcresult watchos: name: Build and Test watchOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestAppWatchApp - destination: 'id=3C5F6AF7-5AB7-4FA4-9684-305E2533D6EA' + destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' resultBundle: TestApp-watchOS.xcresult artifactname: TestApp-watchOS.xcresult - # visionos: - # name: Build and Test visionOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # path: 'Tests/UITests' - # scheme: TestApp - # destination: 'platform=visionOS Simulator,name=Apple Vision Pro' - # resultBundle: TestApp-visionOS.xcresult - # artifactname: TestApp-visionOS.xcresult - # tvos: - # name: Build and Test tvOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # path: 'Tests/UITests' - # scheme: TestApp - # destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' - # resultBundle: TestApp-tvOS.xcresult - # artifactname: TestApp-tvOS.xcresult + visionos: + name: Build and Test visionOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + runsonlabels: '["macOS", "self-hosted"]' + path: 'Tests/UITests' + scheme: TestApp + destination: 'platform=visionOS Simulator,name=Apple Vision Pro' + resultBundle: TestApp-visionOS.xcresult + artifactname: TestApp-visionOS.xcresult + tvos: + name: Build and Test tvOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + path: 'Tests/UITests' + scheme: TestApp + destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' + resultBundle: TestApp-tvOS.xcresult + artifactname: TestApp-tvOS.xcresult # codeql: # name: CodeQL # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 diff --git a/Tests/UITests/TestApp/OperatingSystem.swift b/Tests/UITests/TestApp/OperatingSystem.swift new file mode 100644 index 0000000..201ed6e --- /dev/null +++ b/Tests/UITests/TestApp/OperatingSystem.swift @@ -0,0 +1,20 @@ +// +// This source file is part of the TemplatePackage open-source project +// +// SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + + +#if os(macOS) +let operatingSystem = "macOS" +#elseif os(iOS) +let operatingSystem = "iOS" +#elseif os(watchOS) +let operatingSystem = "watchOS" +#elseif os(visionOS) +let operatingSystem = "visionOS" +#elseif os(tvOS) +let operatingSystem = "tvOS" +#endif diff --git a/Tests/UITests/TestApp/TestApp.swift b/Tests/UITests/TestApp/TestApp.swift index 90fdb20..4ddb27e 100644 --- a/Tests/UITests/TestApp/TestApp.swift +++ b/Tests/UITests/TestApp/TestApp.swift @@ -15,6 +15,7 @@ struct UITestsApp: App { var body: some Scene { WindowGroup { Text(TemplatePackage().stanford) + Text(operatingSystem) } } } diff --git a/Tests/UITests/TestAppUITests/TestAppUITests.swift b/Tests/UITests/TestAppUITests/TestAppUITests.swift index d422843..39d2a15 100644 --- a/Tests/UITests/TestAppUITests/TestAppUITests.swift +++ b/Tests/UITests/TestAppUITests/TestAppUITests.swift @@ -21,5 +21,19 @@ class TestAppUITests: XCTestCase { let app = XCUIApplication() app.launch() XCTAssert(app.staticTexts["Stanford University"].waitForExistence(timeout: 0.1)) + + if app.staticTexts["macOS"].exists { + print("Template Package is running on macOS.") + } else if app.staticTexts["iOS"].exists { + print("Template Package is running on iOS.") + } else if app.staticTexts["watchOS"].exists { + print("Template Package is running on watchOS.") + } else if app.staticTexts["visionOS"].exists { + print("Template Package is running on visionOS.") + } else if app.staticTexts["tvOS"].exists { + print("Template Package is running on tvOS.") + } else { + XCTFail("Running on an unexpected operating system.") + } } } diff --git a/Tests/UITests/UITests.xcodeproj/project.pbxproj b/Tests/UITests/UITests.xcodeproj/project.pbxproj index 25c3d4a..5f691f9 100644 --- a/Tests/UITests/UITests.xcodeproj/project.pbxproj +++ b/Tests/UITests/UITests.xcodeproj/project.pbxproj @@ -16,6 +16,8 @@ 2F9CBEDA2A76C795009818FF /* TemplatePackage in Frameworks */ = {isa = PBXBuildFile; productRef = 2F9CBED92A76C795009818FF /* TemplatePackage */; }; 2F9CBEDB2A76C7EC009818FF /* TestAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F8A431229130A8C005D2B8F /* TestAppUITests.swift */; }; 2FA7382C290ADFAA007ACEB9 /* TestApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FA7382B290ADFAA007ACEB9 /* TestApp.swift */; }; + 2FB5B6E02C2F6C50009162E6 /* OperatingSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */; }; + 2FB5B6E12C2F6DBC009162E6 /* OperatingSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -73,6 +75,7 @@ 2F9CBEBF2A76C412009818FF /* TestAppWatchAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestAppWatchAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 2FA7382B290ADFAA007ACEB9 /* TestApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestApp.swift; sourceTree = ""; }; 2FB0758A299DDB9000C0B37F /* TestApp.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestApp.xctestplan; sourceTree = ""; }; + 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperatingSystem.swift; sourceTree = ""; }; 2FF8922E2A770D4200903A5A /* TestAppWatchApp.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestAppWatchApp.xctestplan; sourceTree = ""; }; /* End PBXFileReference section */ @@ -138,6 +141,7 @@ isa = PBXGroup; children = ( 2FA7382B290ADFAA007ACEB9 /* TestApp.swift */, + 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */, 2F6D139928F5F386007C25D6 /* Assets.xcassets */, ); path = TestApp; @@ -326,6 +330,7 @@ buildActionMask = 2147483647; files = ( 2FA7382C290ADFAA007ACEB9 /* TestApp.swift in Sources */, + 2FB5B6E02C2F6C50009162E6 /* OperatingSystem.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -341,6 +346,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 2FB5B6E12C2F6DBC009162E6 /* OperatingSystem.swift in Sources */, 2F9CBED72A76C752009818FF /* TestApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; From bc9ebaafd5d7740281b426ad030c77af5a35db7a Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 15:31:53 -0700 Subject: [PATCH 10/14] Update Setup --- .../UITests/TestAppUITests/TestAppUITests.swift | 17 ++++------------- Tests/UITests/UITests.xcodeproj/project.pbxproj | 4 ++++ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Tests/UITests/TestAppUITests/TestAppUITests.swift b/Tests/UITests/TestAppUITests/TestAppUITests.swift index 39d2a15..351ad30 100644 --- a/Tests/UITests/TestAppUITests/TestAppUITests.swift +++ b/Tests/UITests/TestAppUITests/TestAppUITests.swift @@ -7,6 +7,7 @@ // import XCTest +import OSLog class TestAppUITests: XCTestCase { @@ -20,20 +21,10 @@ class TestAppUITests: XCTestCase { func testTemplatePackage() throws { let app = XCUIApplication() app.launch() + XCTAssert(app.staticTexts["Stanford University"].waitForExistence(timeout: 0.1)) + XCTAssert(app.staticTexts[operatingSystem].exists) - if app.staticTexts["macOS"].exists { - print("Template Package is running on macOS.") - } else if app.staticTexts["iOS"].exists { - print("Template Package is running on iOS.") - } else if app.staticTexts["watchOS"].exists { - print("Template Package is running on watchOS.") - } else if app.staticTexts["visionOS"].exists { - print("Template Package is running on visionOS.") - } else if app.staticTexts["tvOS"].exists { - print("Template Package is running on tvOS.") - } else { - XCTFail("Running on an unexpected operating system.") - } + Logger().warning("Running test on \(operatingSystem)") } } diff --git a/Tests/UITests/UITests.xcodeproj/project.pbxproj b/Tests/UITests/UITests.xcodeproj/project.pbxproj index 5f691f9..e880b01 100644 --- a/Tests/UITests/UITests.xcodeproj/project.pbxproj +++ b/Tests/UITests/UITests.xcodeproj/project.pbxproj @@ -18,6 +18,8 @@ 2FA7382C290ADFAA007ACEB9 /* TestApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FA7382B290ADFAA007ACEB9 /* TestApp.swift */; }; 2FB5B6E02C2F6C50009162E6 /* OperatingSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */; }; 2FB5B6E12C2F6DBC009162E6 /* OperatingSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */; }; + 2FB5B6E22C2F707A009162E6 /* OperatingSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */; }; + 2FB5B6E32C2F707B009162E6 /* OperatingSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -338,6 +340,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 2FB5B6E22C2F707A009162E6 /* OperatingSystem.swift in Sources */, 2F8A431329130A8C005D2B8F /* TestAppUITests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -355,6 +358,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 2FB5B6E32C2F707B009162E6 /* OperatingSystem.swift in Sources */, 2F9CBEDB2A76C7EC009818FF /* TestAppUITests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; From ddabdd52e7ae20dbb307645ff9057e7188be909c Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 15:34:06 -0700 Subject: [PATCH 11/14] Fail all tests --- Tests/UITests/TestAppUITests/TestAppUITests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/UITests/TestAppUITests/TestAppUITests.swift b/Tests/UITests/TestAppUITests/TestAppUITests.swift index 351ad30..22f5549 100644 --- a/Tests/UITests/TestAppUITests/TestAppUITests.swift +++ b/Tests/UITests/TestAppUITests/TestAppUITests.swift @@ -25,6 +25,6 @@ class TestAppUITests: XCTestCase { XCTAssert(app.staticTexts["Stanford University"].waitForExistence(timeout: 0.1)) XCTAssert(app.staticTexts[operatingSystem].exists) - Logger().warning("Running test on \(operatingSystem)") + XCTFail("Running test on \(operatingSystem)") } } From 0f85b76b3b67d95a38c09b6bff1f2d82789de8cf Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 15:42:12 -0700 Subject: [PATCH 12/14] Update Setup --- .github/workflows/build-and-test.yml | 126 +++++++++--------- .../TestAppUITests/TestAppUITests.swift | 2 - 2 files changed, 63 insertions(+), 65 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 3cb773c..09c9019 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -12,51 +12,51 @@ on: workflow_call: jobs: - # reuse_action: - # name: REUSE Compliance Check - # uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2 - # swiftlint: - # name: SwiftLint - # uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2 - # packageios: - # name: Build and Test Swift Package iOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # scheme: TemplatePackage - # resultBundle: TemplatePackage-iOS.xcresult - # artifactname: TemplatePackage-iOS.xcresult - # packagewatchos: - # name: Build and Test Swift Package watchOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # scheme: TemplatePackage - # destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' - # resultBundle: TemplatePackage-watchOS.xcresult - # artifactname: TemplatePackage-watchOS.xcresult - # packagevisionos: - # name: Build and Test Swift Package visionOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # scheme: TemplatePackage - # destination: 'platform=visionOS Simulator,name=Apple Vision Pro' - # resultBundle: TemplatePackage-visionOS.xcresult - # artifactname: TemplatePackage-visionOS.xcresult - # packagetvos: - # name: Build and Test Swift Package tvOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # scheme: TemplatePackage - # resultBundle: TemplatePackage-tvOS.xcresult - # destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' - # artifactname: TemplatePackage-tvOS.xcresult - # packagemacos: - # name: Build and Test Swift Package macOS - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # scheme: TemplatePackage - # resultBundle: TemplatePackage-macOS.xcresult - # destination: 'platform=macOS,arch=arm64' - # artifactname: TemplatePackage-macOS.xcresult + reuse_action: + name: REUSE Compliance Check + uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2 + swiftlint: + name: SwiftLint + uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2 + packageios: + name: Build and Test Swift Package iOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + scheme: TemplatePackage + resultBundle: TemplatePackage-iOS.xcresult + artifactname: TemplatePackage-iOS.xcresult + packagewatchos: + name: Build and Test Swift Package watchOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + scheme: TemplatePackage + destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' + resultBundle: TemplatePackage-watchOS.xcresult + artifactname: TemplatePackage-watchOS.xcresult + packagevisionos: + name: Build and Test Swift Package visionOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + scheme: TemplatePackage + destination: 'platform=visionOS Simulator,name=Apple Vision Pro' + resultBundle: TemplatePackage-visionOS.xcresult + artifactname: TemplatePackage-visionOS.xcresult + packagetvos: + name: Build and Test Swift Package tvOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + scheme: TemplatePackage + resultBundle: TemplatePackage-tvOS.xcresult + destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' + artifactname: TemplatePackage-tvOS.xcresult + packagemacos: + name: Build and Test Swift Package macOS + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + scheme: TemplatePackage + resultBundle: TemplatePackage-macOS.xcresult + destination: 'platform=macOS,arch=arm64' + artifactname: TemplatePackage-macOS.xcresult ios: name: Build and Test iOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 @@ -103,21 +103,21 @@ jobs: destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' resultBundle: TestApp-tvOS.xcresult artifactname: TestApp-tvOS.xcresult - # codeql: - # name: CodeQL - # uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - # with: - # codeql: true - # test: false - # scheme: TemplatePackage - # permissions: - # security-events: write - # actions: read - # uploadcoveragereport: - # name: Upload Coverage Report - # needs: [packageios, packagewatchos, packagevisionos, packagetvos, packagemacos, ios, ipados, watchos, visionos, tvos] - # uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 - # with: - # coveragereports: TemplatePackage-iOS.xcresult TemplatePackage-watchOS.xcresult TemplatePackage-visionOS.xcresult TemplatePackage-tvOS.xcresult TemplatePackage-macOS.xcresult TestApp-iOS.xcresult TestApp-iPadOS.xcresult TestApp-watchOS.xcresult TestApp-visionOS.xcresult TestApp-tvOS.xcresult - # secrets: - # token: ${{ secrets.CODECOV_TOKEN }} + codeql: + name: CodeQL + uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + with: + codeql: true + test: false + scheme: TemplatePackage + permissions: + security-events: write + actions: read + uploadcoveragereport: + name: Upload Coverage Report + needs: [packageios, packagewatchos, packagevisionos, packagetvos, packagemacos, ios, ipados, watchos, visionos, tvos] + uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 + with: + coveragereports: TemplatePackage-iOS.xcresult TemplatePackage-watchOS.xcresult TemplatePackage-visionOS.xcresult TemplatePackage-tvOS.xcresult TemplatePackage-macOS.xcresult TestApp-iOS.xcresult TestApp-iPadOS.xcresult TestApp-watchOS.xcresult TestApp-visionOS.xcresult TestApp-tvOS.xcresult + secrets: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Tests/UITests/TestAppUITests/TestAppUITests.swift b/Tests/UITests/TestAppUITests/TestAppUITests.swift index 22f5549..30f835f 100644 --- a/Tests/UITests/TestAppUITests/TestAppUITests.swift +++ b/Tests/UITests/TestAppUITests/TestAppUITests.swift @@ -24,7 +24,5 @@ class TestAppUITests: XCTestCase { XCTAssert(app.staticTexts["Stanford University"].waitForExistence(timeout: 0.1)) XCTAssert(app.staticTexts[operatingSystem].exists) - - XCTFail("Running test on \(operatingSystem)") } } From 2fd06395fea7c2bcceb1a9dcfd6c287d6e1a8cb9 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 15:44:01 -0700 Subject: [PATCH 13/14] Update Setup --- Tests/UITests/TestAppUITests/TestAppUITests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/UITests/TestAppUITests/TestAppUITests.swift b/Tests/UITests/TestAppUITests/TestAppUITests.swift index 30f835f..82a97bb 100644 --- a/Tests/UITests/TestAppUITests/TestAppUITests.swift +++ b/Tests/UITests/TestAppUITests/TestAppUITests.swift @@ -6,8 +6,8 @@ // SPDX-License-Identifier: MIT // -import XCTest import OSLog +import XCTest class TestAppUITests: XCTestCase { From 1244307117c92350f3ab363b6071e751ebe7233a Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 28 Jun 2024 15:46:42 -0700 Subject: [PATCH 14/14] Update Actions --- .github/workflows/main.yml | 1 + .github/workflows/pull_request.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 091f168..c64e9ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,5 +20,6 @@ concurrency: jobs: buildandtest: + name: Build and Test uses: ./.github/workflows/build-and-test.yml secrets: inherit diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index afc1b91..272edeb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,5 +18,6 @@ concurrency: jobs: buildandtest: + name: Build and Test uses: ./.github/workflows/build-and-test.yml secrets: inherit