You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -194,7 +197,12 @@ The build script just builds the project
194
197
195
198
### script/test
196
199
197
-
The test script builds and run the tests. If the project has a `.podspec` file is runs the cocoapod linter.
200
+
The test script builds and run the tests.
201
+
202
+
* If the project has a `.swiftlint.yml` file the the [Swift linter](https://github.com/realm/SwiftLint) is run.
203
+
* If the project uses [linterbot](https://github.com/guidomb/linterbot), the `script/test` is run on CI for a pull request and `swiftlint` is avaliable then the `linterbot` will be executed.
204
+
`swiftlint` has been run then t
205
+
* If the project has a `.podspec` file the Cocoapods podspec linter is run.
198
206
199
207
### script/coverage
200
208
@@ -210,6 +218,35 @@ Updates the project's dependencies using the underlaying dependency management m
210
218
211
219
This script must be run in the CI environment. It bootstraps the project, builds it and run the test.
212
220
221
+
#### Configure SwiftLint run script for CI
222
+
223
+
If your project is using [SwiftLint](https://github.com/realm/SwiftLint) it is recommended to configure the run script as follow instead of how it is explained in the SwiftLint docs.
224
+
225
+
```bash
226
+
if [ ! -z "$RUNNING_ON_CI" ]
227
+
then
228
+
echo "SwiftLint run script has been disabled"
229
+
exit 0
230
+
fi
231
+
232
+
if which swiftlint >/dev/null; then
233
+
swiftlint
234
+
else
235
+
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
236
+
fi
237
+
```
238
+
239
+
This allows disabling the run script when running on CI and running the linter twice.
240
+
241
+
#### Configure linterbot for CI
242
+
243
+
If your project is using [SwiftLint](https://github.com/realm/SwiftLint) and [linterbot](https://github.com/guidomb/linterbot) then you need to add the following environmental variables when running `script/cibuild`:
244
+
245
+
*`REPO_SLUG`: The GitHub repository slug, like `guidomb/ios-scripts`.
246
+
*`PULL_REQUEST`: The pull request number to be analyzed if the current build was triggered by a pull request or `false` otherwise.
247
+
248
+
Keep in mind that the linterbot also uses the enviromental variable `GITHUB_ACCESS_TOKEN` (which is also used by Carthage). The GitHub user associated with that token should have write access to the repository and is the user that will be used to comment on every linter validation in the pull request.
249
+
213
250
### General configuration variables
214
251
215
252
*`VERBOSE` if you set the `VERBOSE` environmental with a value the scripts will print more information.
0 commit comments