-
-
Notifications
You must be signed in to change notification settings - Fork 5
186 lines (175 loc) · 6.95 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
xcodebuild:
name: Build with xcodebuild on Xcode 16
runs-on: macos-15
strategy:
matrix:
platforms: [
'generic/platform=ios',
'platform=macOS',
'generic/platform=tvos',
'generic/platform=watchos',
'generic/platform=visionos'
]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Download visionOS
if: matrix.platforms == 'generic/platform=visionos'
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Build Framework
run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme SafeDI-Package -destination ${{ matrix.platforms }}
spm-package-integration:
name: Build Package Integration on Xcode 16
runs-on: macos-15
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Build Package Integration
run: xcrun swift build --package-path Examples/ExamplePackageIntegration
spm-project-integration:
name: Build Project Integration on Xcode 16
runs-on: macos-15
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Replace 'main' branch with the current branch
if: github.event.pull_request.head.repo.full_name == github.repository # Only do this if the branch is from our repo.
run: sed -i '' "s#branch = main;#branch = ${{ github.head_ref || github.ref_name }};#" "Examples/ExampleProjectIntegration/ExampleProjectIntegration.xcodeproj/project.pbxproj"
- name: Build Project Integration
run: pushd Examples/ExampleProjectIntegration; xcrun xcodebuild build -skipPackagePluginValidation -skipMacroValidation -scheme ExampleProjectIntegration; popd
spm-multi-project-integration:
name: Build Multi Project Integration on Xcode 16
runs-on: macos-15
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Replace 'main' branch with the current branch
if: github.event.pull_request.head.repo.full_name == github.repository # Only do this if the branch is from our repo.
run: sed -i '' "s#branch = main;#branch = ${{ github.head_ref || github.ref_name }};#" "Examples/ExampleMultiProjectIntegration/ExampleMultiProjectIntegration.xcodeproj/project.pbxproj"
- name: Build Project Integration
run: pushd Examples/ExampleMultiProjectIntegration; xcrun xcodebuild build -skipPackagePluginValidation -skipMacroValidation -scheme ExampleMultiProjectIntegration; popd
pod-project-integration:
name: Build CocoaPods Integration on Xcode 16
runs-on: macos-15
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.2.0.app/Contents/Developer
- name: Install Pod
run: bundle exec pod install --project-directory=Examples/ExampleCocoaPodsIntegration
- name: Build CocoaPods Integration
run: xcrun xcodebuild build -scheme ExampleCocoaPodsIntegration -configuration Debug -workspace Examples/ExampleCocoaPodsIntegration/ExampleCocoaPodsIntegration.xcworkspace -destination 'platform=iOS Simulator,OS=18.2,name=iPad (10th generation)' # Explicitly test the Debug build. Our pod lint jobs are already testing the Release build.
spm:
name: Build and Test on Xcode 16
runs-on: macos-15
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Build and Test Framework
run: |
for i in {1..5}; do # Run tests a few times to ensure code-gen is stable.
xcrun swift test -c release --enable-code-coverage -Xswiftc -enable-testing
done
- name: Prepare Coverage Reports
run: ./Scripts/prepare-coverage-reports.sh
- name: Upload Coverage Reports
if: success()
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
os: macos
pod-lint:
name: Pod Lint
runs-on: macos-15
strategy:
matrix:
platforms: [
"ios",
"tvos",
"watchos",
"macos",
"visionos",
]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Download visionOS
if: matrix.platforms == 'visionos'
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Lint Podspec
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=6.0 --platforms=${{ matrix.platforms }}
linux:
name: Build and Test on Linux
runs-on: ubuntu-latest
container: swift:6.0
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Build and Test Framework
run: swift test -c release --enable-code-coverage -Xswiftc -enable-testing
- name: Prepare Coverage Reports
run: |
llvm-cov export -format="lcov" .build/x86_64-unknown-linux-gnu/release/SafeDIPackageTests.xctest -instr-profile .build/x86_64-unknown-linux-gnu/release/codecov/default.profdata > coverage.lcov
- name: Upload Coverage Reports
if: success()
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
os: linux
readme-validation:
name: Check Markdown links
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Link Checker
uses: AlexanderDokuchaev/md-dead-link-check@v1.0.1
lint-swift:
name: Lint Swift
runs-on: ubuntu-latest
container: swift:6.0
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Lint Swift
run: swift run --package-path CLI swiftformat --swiftversion 6.0 . --lint