-
Notifications
You must be signed in to change notification settings - Fork 53
225 lines (202 loc) · 6.69 KB
/
checks.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Checks
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
paths-ignore: ['Docs/**', 'README.md']
jobs:
swiftformat:
name: SwiftFormat
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- run: swiftformat . --lint --quiet --reporter github-actions-log
swiftlint:
name: SwiftLint
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- run: swiftlint --strict --quiet --reporter github-actions-logging
install:
name: Install Script
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Install Rugby
run: |
curl -Ls https://swiftyfinch.github.io/rugby/install.sh | bash
chmod +x ~/.rugby/clt/rugby && echo ~/.rugby/clt >> $GITHUB_PATH
- run: rugby -h
release:
name: Build Binary
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: ${{ runner.os }}-spm-
- name: Build
run: swift build -c release
unit-tests:
name: Unit Tests
runs-on: macos-13
env:
LCOV_PATH: .build/artifacts/info.lcov
BUILD_FOLDER: .build/debug/RugbyPackageTests.xctest/Contents/MacOS/RugbyPackageTests
PROFDATA_FOLDER: .build/debug/codecov/default.profdata
IGNORE_FILENAME_REGEX: .build|Tests
steps:
- uses: actions/checkout@v4
- run: brew install xcbeautify
- uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: ${{ runner.os }}-spm-
- name: Test
run: set -o pipefail && swift test --enable-code-coverage 2>&1 | xcbeautify
- name: Prepare coverage to upload
run: |
xcrun llvm-cov export $BUILD_FOLDER \
-instr-profile $PROFDATA_FOLDER > $LCOV_PATH \
--ignore-filename-regex=$IGNORE_FILENAME_REGEX \
-format="lcov" \
--use-color
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Prepare binary artifact
run: |
RUGBY_PATH=`swift build --show-bin-path`/rugby
strip -rSTx $RUGBY_PATH
echo "RUGBY_PATH=$RUGBY_PATH" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: rugby
path: ${{ env.RUGBY_PATH }}
smoke-build-frameworks:
name: Smoke Build (Frameworks)
needs: unit-tests
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: { name: rugby }
- run: chmod +x rugby && echo `pwd` >> $GITHUB_PATH
- run: rugby --version
- uses: actions/cache@v4
with:
path: Example/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('Example/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: CocoaPods
working-directory: ./Example
run: pod install --repo-update
- name: Rugby
working-directory: ./Example
run: rugby --prebuild --targets Pods-ExampleFrameworks --output multiline
- run: brew install xcbeautify
if: always()
- name: Beautify logs
if: always()
run: cat ~/.rugby/logs/+latest/rawBuild.log 2>&1 | xcbeautify --renderer github-actions
- name: XcodeBuild Test
working-directory: ./Example
run: |
set -o pipefail && env NSUnbufferedIO=YES xcodebuild test \
-workspace Example.xcworkspace \
-scheme ExampleFrameworks \
-testPlan ExampleFrameworks \
-destination 'platform=iOS Simulator,name=iPhone 14' \
COMPILER_INDEX_STORE_ENABLE=NO \
SWIFT_COMPILATION_MODE=wholemodule \
CODE_SIGNING_ALLOWED=NO \
| xcbeautify --renderer github-actions
smoke-build-libs:
name: Smoke Build (Libraries)
needs: unit-tests
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: { name: rugby }
- run: chmod +x rugby && echo `pwd` >> $GITHUB_PATH
- run: rugby --version
- uses: actions/cache@v4
with:
path: Example/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('Example/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: CocoaPods
working-directory: ./Example
run: pod install --repo-update
- name: Rugby
working-directory: ./Example
run: rugby --prebuild --targets Pods-ExampleLibs --output multiline
- run: brew install xcbeautify
- name: XcodeBuild Test
working-directory: ./Example
run: |
set -o pipefail && env NSUnbufferedIO=YES xcodebuild test \
-workspace Example.xcworkspace \
-scheme ExampleLibs \
-testPlan ExampleLibs \
-destination 'platform=iOS Simulator,name=iPhone 14' \
COMPILER_INDEX_STORE_ENABLE=NO \
SWIFT_COMPILATION_MODE=wholemodule \
CODE_SIGNING_ALLOWED=NO \
| xcbeautify --renderer github-actions
smoke-test-multiproj:
name: Smoke Test (Multiproj)
needs: unit-tests
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: { name: rugby }
- run: chmod +x rugby && echo `pwd` >> $GITHUB_PATH
- run: rugby --version
- uses: actions/cache@v4
with:
path: Example/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('Example/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: CocoaPods
working-directory: ./Example
run: MULTIPLE_PROJECTS=true pod install --repo-update
- run: brew install xcbeautify
- name: Rugby
working-directory: ./Example
run: |
rugby _test --targets-as-regex framework \
--simulator-name 'iPhone 14' \
--testplan-template-path ExampleFrameworks
smoke-test:
name: Smoke Test (Frameworks)
needs: unit-tests
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: { name: rugby }
- run: chmod +x rugby && echo `pwd` >> $GITHUB_PATH
- run: rugby --version
- uses: actions/cache@v4
with:
path: Example/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('Example/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: CocoaPods
working-directory: ./Example
run: pod install --repo-update
- run: brew install xcbeautify
- name: Rugby
working-directory: ./Example
run: |
rugby _test --targets-as-regex framework \
--simulator-name 'iPhone 14' \
--testplan-template-path ExampleFrameworks