Skip to content

Commit 9a63585

Browse files
authored
rework CI setup (#23)
# rework CI setup ## ♻️ Current situation & Problem the current `build-and-test` workflow is needlessly repetitive and verbose; we clean it up significantly by using matrix-based jobs instead of defining everything explicitly. NOTE: this PR does *not* include the renaming in the underlying actions; this will happen at a later point in time. ## ⚙️ Release Notes - reworked CI setup ## 📚 Documentation n/a ## ✅ Testing n/a ### Code of Conduct & Contributing Guidelines By creating and submitting this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
1 parent b4d5e5d commit 9a63585

File tree

7 files changed

+123
-146
lines changed

7 files changed

+123
-146
lines changed
Lines changed: 63 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,87 @@
11
#
2-
# This source file is part of the TemplatePackage open source project
2+
# This source file is part of the Stanford Biodesign Digital Health Group Swift Template Package open source project
33
#
4-
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
4+
# SPDX-FileCopyrightText: 2025 Stanford University and the project authors (see CONTRIBUTORS.md)
55
#
66
# SPDX-License-Identifier: MIT
77
#
88

99
name: Build and Test
1010

1111
on:
12-
workflow_call:
12+
push:
13+
branches:
14+
- main
15+
pull_request:
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: Build-and-Test-${{ github.ref }}
20+
cancel-in-progress: true
1321

1422
jobs:
15-
reuse_action:
16-
name: REUSE Compliance Check
17-
uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2
18-
swiftlint:
19-
name: SwiftLint
20-
uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2
21-
breaking_changes:
22-
name: Diagnose Breaking Changes
23-
uses: StanfordBDHG/.github/.github/workflows/breaking-changes.yml@v2
24-
with:
25-
runsonlabels: '["macOS", "self-hosted"]'
26-
packageios:
27-
name: Build and Test Swift Package iOS
28-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
29-
with:
30-
scheme: TemplatePackage
31-
resultBundle: TemplatePackage-iOS.xcresult
32-
artifactname: TemplatePackage-iOS.xcresult
33-
packagewatchos:
34-
name: Build and Test Swift Package watchOS
35-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
36-
with:
37-
scheme: TemplatePackage
38-
destination: 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)'
39-
resultBundle: TemplatePackage-watchOS.xcresult
40-
artifactname: TemplatePackage-watchOS.xcresult
41-
packagevisionos:
42-
name: Build and Test Swift Package visionOS
23+
package_tests:
24+
name: Build and Test Swift Package ${{ matrix.platform.name }} (${{ matrix.config }})
4325
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
26+
strategy:
27+
matrix:
28+
config: [Debug, Release]
29+
platform:
30+
- name: iOS
31+
destination: 'platform=iOS Simulator,name=iPhone 16 Pro'
32+
- name: macOS
33+
destination: 'platform=macOS,arch=arm64'
34+
- name: 'Mac Catalyst'
35+
destination: 'platform=macOS,arch=arm64,variant=Mac Catalyst'
36+
- name: watchOS
37+
destination: 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)'
38+
- name: visionOS
39+
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
40+
- name: tvOS
41+
destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
42+
fail-fast: false
4443
with:
4544
runsonlabels: '["macOS", "self-hosted"]'
4645
scheme: TemplatePackage
47-
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
48-
resultBundle: TemplatePackage-visionOS.xcresult
49-
artifactname: TemplatePackage-visionOS.xcresult
50-
packagetvos:
51-
name: Build and Test Swift Package tvOS
52-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
53-
with:
54-
scheme: TemplatePackage
55-
resultBundle: TemplatePackage-tvOS.xcresult
56-
destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
57-
artifactname: TemplatePackage-tvOS.xcresult
58-
packagemacos:
59-
name: Build and Test Swift Package macOS
60-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
61-
with:
62-
scheme: TemplatePackage
63-
resultBundle: TemplatePackage-macOS.xcresult
64-
destination: 'platform=macOS,arch=arm64'
65-
artifactname: TemplatePackage-macOS.xcresult
66-
ios:
67-
name: Build and Test iOS
68-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
69-
with:
70-
path: 'Tests/UITests'
71-
scheme: TestApp
72-
resultBundle: TestApp-iOS.xcresult
73-
artifactname: TestApp-iOS.xcresult
74-
ipados:
75-
name: Build and Test iPadOS
76-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
77-
with:
78-
path: 'Tests/UITests'
79-
scheme: TestApp
80-
destination: 'platform=iOS Simulator,name=iPad Air 13-inch (M2)'
81-
resultBundle: TestApp-iPadOS.xcresult
82-
artifactname: TestApp-iPadOS.xcresult
83-
watchos:
84-
name: Build and Test watchOS
46+
destination: ${{ matrix.platform.destination }}
47+
buildConfig: ${{ matrix.config }}
48+
resultBundle: ${{ format('TemplatePackage-{0}-{1}.xcresult', matrix.platform.name, matrix.config) }}
49+
artifactname: ${{ format('TemplatePackage-{0}-{1}.xcresult', matrix.platform.name, matrix.config) }}
50+
ui_tests:
51+
name: Build and Test UI Tests ${{ matrix.platform.name }} (${{ matrix.config }})
8552
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
53+
strategy:
54+
matrix:
55+
config: [Debug, Release]
56+
platform:
57+
- name: iOS
58+
scheme: TestApp
59+
destination: 'platform=iOS Simulator,name=iPhone 16 Pro'
60+
- name: iPadOS
61+
scheme: TestApp
62+
destination: 'platform=iOS Simulator,name=iPad Air 13-inch (M3)'
63+
- name: watchOS
64+
scheme: TestAppWatchApp
65+
destination: 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)'
66+
- name: visionOS
67+
scheme: TestApp
68+
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
69+
- name: tvOS
70+
scheme: TestApp
71+
destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
72+
fail-fast: false
8673
with:
8774
runsonlabels: '["macOS", "self-hosted"]'
8875
path: 'Tests/UITests'
89-
scheme: TestAppWatchApp
90-
destination: 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)'
91-
resultBundle: TestApp-watchOS.xcresult
92-
artifactname: TestApp-watchOS.xcresult
93-
visionos:
94-
name: Build and Test visionOS
95-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
96-
with:
97-
runsonlabels: '["macOS", "self-hosted"]'
98-
path: 'Tests/UITests'
99-
scheme: TestApp
100-
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
101-
resultBundle: TestApp-visionOS.xcresult
102-
artifactname: TestApp-visionOS.xcresult
103-
tvos:
104-
name: Build and Test tvOS
105-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
106-
with:
107-
path: 'Tests/UITests'
108-
scheme: TestApp
109-
destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
110-
resultBundle: TestApp-tvOS.xcresult
111-
artifactname: TestApp-tvOS.xcresult
76+
scheme: ${{ matrix.platform.scheme }}
77+
destination: ${{ matrix.platform.destination }}
78+
resultBundle: ${{ format('TestApp-{0}-{1}.xcresult', matrix.platform.name, matrix.config) }}
79+
artifactname: ${{ format('TestApp-{0}-{1}.xcresult', matrix.platform.name, matrix.config) }}
11280
uploadcoveragereport:
11381
name: Upload Coverage Report
114-
needs: [packageios, packagewatchos, packagevisionos, packagetvos, packagemacos, ios, ipados, watchos, visionos, tvos]
82+
needs: [package_tests, ui_tests]
11583
uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
11684
with:
117-
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
85+
coveragereports: TemplatePackage-*.xcresult TestApp-*.xcresult
11886
secrets:
119-
token: ${{ secrets.CODECOV_TOKEN }}
87+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/main.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# This source file is part of the Stanford Biodesign Digital Health Group Swift Template Package open source project
3+
#
4+
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
5+
#
6+
# SPDX-License-Identifier: MIT
7+
#
8+
9+
name: Monthly Markdown Link Check
10+
11+
on:
12+
# Runs at midnight on the first of every month
13+
schedule:
14+
- cron: "0 0 1 * *"
15+
16+
jobs:
17+
markdown_link_check:
18+
name: Markdown Link Check
19+
uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2

.github/workflows/pull_request.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# This source file is part of the Stanford Biodesign Digital Health Group Swift Template Package open-source project
3+
#
4+
# SPDX-FileCopyrightText: 2025 Stanford University and the project authors (see CONTRIBUTORS.md)
5+
#
6+
# SPDX-License-Identifier: MIT
7+
#
8+
9+
name: Static Analysis
10+
11+
on:
12+
push:
13+
branches:
14+
- main
15+
pull_request:
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: Static-Analysis-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
reuse_action:
24+
name: REUSE Compliance Check
25+
uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2
26+
swiftlint:
27+
name: SwiftLint
28+
uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2
29+
markdown_link_check:
30+
name: Markdown Link Check
31+
uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2
32+
breaking_changes:
33+
name: Diagnose Breaking Changes
34+
uses: StanfordBDHG/.github/.github/workflows/breaking-changes.yml@v2
35+
if: ${{ github.ref_name != 'main' }}
36+
with:
37+
runsonlabels: '["macOS", "self-hosted"]'

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ let package = Package(
1919
.watchOS(.v10),
2020
.visionOS(.v1),
2121
.tvOS(.v17),
22-
.macOS(.v14)
22+
.macOS(.v14),
23+
.macCatalyst(.v17)
2324
],
2425
products: [
2526
.library(name: "TemplatePackage", targets: ["TemplatePackage"])

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ The project can be added to your Xcode project or Swift Package using the [Swift
4444

4545

4646
## License
47-
This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordBDHG/TemplatePackage/tree/main/LICENSES) for more information.
47+
This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordBDHG/SwiftPackageTemplate/tree/main/LICENSES) for more information.
4848

4949

5050
## Contributors
5151
This project is developed as part of the Stanford Byers Center for Biodesign at Stanford University.
52-
See [CONTRIBUTORS.md](https://github.com/StanfordBDHG/TemplatePackage/tree/main/CONTRIBUTORS.md) for a full list of all TemplatePackage contributors.
52+
See [CONTRIBUTORS.md](https://github.com/StanfordBDHG/SwiftPackageTemplate/tree/main/CONTRIBUTORS.md) for a full list of all TemplatePackage contributors.
5353

5454
![Stanford Byers Center for Biodesign Logo](https://raw.githubusercontent.com/StanfordBDHG/.github/main/assets/biodesign-footer-light.png#gh-light-mode-only)
5555
![Stanford Byers Center for Biodesign Logo](https://raw.githubusercontent.com/StanfordBDHG/.github/main/assets/biodesign-footer-dark.png#gh-dark-mode-only)

0 commit comments

Comments
 (0)