Skip to content

Commit dc66f44

Browse files
author
Guido Marucci Blas
committed
Updates README.md with latest changes.
1 parent f8b35d4 commit dc66f44

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ In case you need to install more dependencies or execute some configuration scri
163163
You can disable bootstrap hooks by defining `DISABLE_BOOTSTRAP_HOOKS`
164164
environmental variable.
165165

166+
If your hooks need to know if they are running on CI they can check if the
167+
environmental `$RUNNING_ON_CI` is defined.
168+
166169
#### Build configuration for Travis CI
167170

168171
If you are using Travis CI to build and test your project you only need to tell travis to
@@ -174,7 +177,7 @@ osx_image: xcode7.2
174177
before_install:
175178
- gem install bundler
176179
script:
177-
- FORCE_CARTHAGE_VERSION=true script/cibuild
180+
- REPO_SLUG="$TRAVIS_REPO_SLUG" PULL_REQUEST="$TRAVIS_PULL_REQUEST" FORCE_CARTHAGE_VERSION=true script/cibuild
178181
branches:
179182
only:
180183
- master
@@ -194,7 +197,12 @@ The build script just builds the project
194197
195198
### script/test
196199
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.
198206
199207
### script/coverage
200208
@@ -210,6 +218,35 @@ Updates the project's dependencies using the underlaying dependency management m
210218
211219
This script must be run in the CI environment. It bootstraps the project, builds it and run the test.
212220
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+
213250
### General configuration variables
214251

215252
* `VERBOSE` if you set the `VERBOSE` environmental with a value the scripts will print more information.

0 commit comments

Comments
 (0)