... | ... | @@ -11,6 +11,17 @@ stages: |
|
|
- test
|
|
|
- crashlytics
|
|
|
|
|
|
before_all do
|
|
|
ENV["SLACK_URL"] = "MySlackHookURL"
|
|
|
clear_derived_data
|
|
|
end
|
|
|
error do |lane, exception|
|
|
|
slack(
|
|
|
message: exception.message,
|
|
|
success: false
|
|
|
)
|
|
|
end
|
|
|
|
|
|
analyzation:
|
|
|
stage: analyze
|
|
|
script:
|
... | ... | @@ -34,7 +45,7 @@ crashlytics_build: |
|
|
except:
|
|
|
- triggers
|
|
|
```
|
|
|
Add only stages you need.
|
|
|
Add only stages you need. Replace MySlackHookURL with your Slack incoming webhook. Or remove if not needed.
|
|
|
|
|
|
**2. Analyzation Stage**
|
|
|
|
... | ... | @@ -99,4 +110,55 @@ analyzation: |
|
|
- triggers
|
|
|
```
|
|
|
|
|
|
* Commit those changes to the repository. If everything is setup correctly, Analyzation stage should be invoked on each commit. |
|
|
\ No newline at end of file |
|
|
* Commit those changes to the repository. If everything is setup correctly, Analyzation stage should be invoked on each commit.
|
|
|
|
|
|
**3. Testing Stage**
|
|
|
|
|
|
This stage allows to run unit tests on each commit. To achieve that, add the following code to .gitlab-ci.yml file:
|
|
|
|
|
|
```
|
|
|
testing:
|
|
|
stage: test
|
|
|
script:
|
|
|
- xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme -configuration MyConfiguration -destination "platform=iOS Simulator,name=iPhone 7,OS=10.3" build test | xcpretty
|
|
|
except:
|
|
|
- triggers
|
|
|
```
|
|
|
|
|
|
Replace MyWorkspace, MyScheme and MyConfiguration with appropriate values. Also, make sure that simulator name and OS version are relevant.
|
|
|
|
|
|
**4. Crashlytics Build Stage**
|
|
|
|
|
|
This stage allows builds to be uploaded to Crashlytics automatically with each commit or merge to develop brach.
|
|
|
* Setup fastlane, if not yet done. To do that, run `fastlane init` in project's root folder and follow the steps.
|
|
|
* Create a line for Crashlytics build in `fastfile`. It should look like this:
|
|
|
|
|
|
```
|
|
|
lane :lane_name do
|
|
|
gym(scheme: "MyScheme", configuration: "MyConfiguration")
|
|
|
crashlytics(
|
|
|
api_token: "MyAPIToken",
|
|
|
build_secret: "MyBuildSecret",
|
|
|
debug: true,
|
|
|
groups: ["members"],
|
|
|
notifications: true,
|
|
|
notes: last_git_commit[:message]
|
|
|
)
|
|
|
end
|
|
|
```
|
|
|
|
|
|
Replace lane_name, MyScheme and MyConfiguration with appropriate values of your project. Replace MyAPIToken and MyBuildSecret from appropriate values from Crashlytics configuration.
|
|
|
|
|
|
* Test this line by invoking `fastlane ios lane_name.
|
|
|
* Add crashlytics stage to .gitlab-ci.yml. Don't forget to replace lane_name with your lane name:
|
|
|
|
|
|
```
|
|
|
crashlytics_build:
|
|
|
stage: crashlytics
|
|
|
script:
|
|
|
- fastlane ios lane_name
|
|
|
only:
|
|
|
- develop
|
|
|
except:
|
|
|
- triggers
|
|
|
``` |
|
|
\ No newline at end of file |