-
Notifications
You must be signed in to change notification settings - Fork 11
/
shared-bitrise.yml
204 lines (186 loc) · 5.82 KB
/
shared-bitrise.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
---
format_version: '8'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
workflows:
primary:
before_run:
- _setup
after_run:
- _report
- _deploy_artifacts
steps:
- fastlane@3:
inputs:
- update_fastlane: 'false'
- lane: ci
title: Build & Test
- script@1:
title: Export test results
is_always_run: true
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
# Source: https://devcenter.bitrise.io/testing/exporting-to-test-reports-from-custom-script-steps/
JUNIT=./artifacts/unit-tests/report.junit
if [ ! -f "$JUNIT" ]; then
echo "No JUnit file to export"
exit 0
fi
# Creating the sub-directory for the test run within the BITRISE_TEST_RESULT_DIR:
test_run_dir="$BITRISE_TEST_RESULT_DIR/result_dir_1"
mkdir "$test_run_dir"
# Exporting the JUnit XML test report:
cp "$JUNIT" "$test_run_dir/UnitTest.xml"
# Creating the test-info.json file with the name of the test run defined:
echo '{"test-name":"Tests scheme run"}' >> "$test_run_dir/test-info.json"
- sonarqube-scanner@1:
run_if: '{{getenv "SONAR_API_TOKEN" | ne "" | and (enveq "BITRISE_GIT_BRANCH" "master" | or (enveq "IS_RELEASE_BRANCH" "true") )}}'
inputs:
- scanner_properties: |-
sonar.host.url=$SONAR_HOST_URL
sonar.login=$SONAR_API_TOKEN
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
deploy:
before_run:
- _setup
after_run:
- _deploy_docs_worker
- _deploy_artifacts
steps:
- script@1:
title: Lint and push Cocoapods trunk
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
bundle exec pod spec lint --allow-warnings
bundle exec pod trunk push --allow-warnings --verbose
deploy_docs:
before_run:
- _setup
- _deploy_docs_worker
_deploy_docs_worker:
steps:
- brew-install@0:
title: Install svn
inputs:
- cache_enabled: 'yes'
- upgrade: 'no'
- packages: svn
- fastlane@2:
title: Generate and deploy Docs to Github Pages
inputs:
- update_fastlane: 'false'
- lane: deploy_ghpages ghpages_url:$GIT_REPOSITORY_URL github_token:$PUBLISHER_GITHUB_API_TOKEN
_deploy_artifacts:
steps:
- deploy-to-bitrise-io@2:
is_always_run: true
is_skippable: true
inputs:
- is_enable_public_page: "false"
- deploy_path: ./artifacts
- is_compress: "true"
integration_tests:
before_run:
- _setup
steps:
- xcode-test@4:
inputs:
- scheme: IntegrationTests
- destination: platform=iOS Simulator,name=iPhone 14,OS=latest
- cache-push@2:
inputs:
- cache_paths: |-
$BITRISE_CACHE_DIR
$GEM_CACHE_PATH
- slack@3:
inputs:
- channel: ''
- webhook_url: "$SLACK_CHANNEL_WEBHOOK"
- text: ''
- title: ''
- author_name: ''
- channel_on_error: ''
- pretext: ''
- pretext_on_error: ''
- message_on_error: |
$BITRISE_APP_TITLE » $BITRISE_GIT_BRANCH (_$BITRISE_TRIGGERED_WORKFLOW_TITLE_) - #$BITRISE_BUILD_NUMBER $SLACK_PR_INDICATOR
❌ *Failure*
[Stack: $STACK_INFO]
<$BITRISE_BUILD_URL|Open> $BITRISE_GIT_COMMIT
- message: |
$BITRISE_APP_TITLE » $BITRISE_GIT_BRANCH (_$BITRISE_TRIGGERED_WORKFLOW_TITLE_) - #$BITRISE_BUILD_NUMBER $SLACK_PR_INDICATOR
✅ *Success*
[Stack: $STACK_INFO]
<$BITRISE_BUILD_URL|Open> $BITRISE_GIT_COMMIT
- fields: ''
- buttons: ''
- footer: ''
- footer_icon: ''
- timestamp: 'no'
- icon_url_on_error: ''
- from_username_on_error: ''
- color_on_error: "#d10b20"
_setup:
steps:
- git-clone@6:
inputs:
- update_submodules: 'no'
- cache-pull@2: {}
- script@1:
title: Setup env vars
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
XCODE_VERSION=`/usr/bin/xcodebuild -version | grep Xcode`
envman add --key STACK_INFO --value "$XCODE_VERSION"
if [[ $BITRISE_GIT_BRANCH == release* ]]; then
envman add --key IS_RELEASE_BRANCH --value "true"
else
envman add --key IS_RELEASE_BRANCH --value "false"
fi
if [ "$PR" = true ]; then
envman add --key SLACK_PR_INDICATOR --value ":git:"
else
envman add --key SLACK_PR_INDICATOR --value ""
fi
- script@1:
title: Bundle install
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
if [ ! -f "Gemfile" ]; then
echo "No Gemfile detected. Skipping..."
exit 0
fi
rbenv local 3.1.4
bundle install
RBENV_DIR="`cd $(rbenv which ruby)/../..;pwd`"
echo "Gem cache directory: $RBENV_DIR"
envman add --key GEM_CACHE_PATH --value $RBENV_DIR
- brew-install@0:
title: Install swiftlint
inputs:
- cache_enabled: 'yes'
- upgrade: 'no'
- packages: swiftlint
- cocoapods-install@2:
inputs:
- verbose: 'false'
_report:
steps:
- danger@2:
inputs:
- github_api_token: "$DANGER_GITHUB_API_TOKEN"
- cache-push@2:
inputs:
- cache_paths: |-
$BITRISE_CACHE_DIR
$GEM_CACHE_PATH