-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathconfig.yml
396 lines (371 loc) · 12.4 KB
/
config.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
version: 2.1
orbs:
browser-tools: circleci/[email protected]
codecov: codecov/[email protected]
executors:
base:
parameters: ¶meters
ruby:
type: string
default: "3.1"
working_directory: &workdir ~/solidus
environment: &environment
DEFAULT_MAX_WAIT_TIME: 10
SOLIDUS_RAISE_DEPRECATIONS: true
CIRCLE_TEST_REPORTS: /tmp/test-results
CIRCLE_ARTIFACTS: /tmp/test-artifacts
BUNDLE_WITHOUT: "lint,release"
docker:
- image: &image cimg/ruby:<< parameters.ruby >>-browsers
postgres:
parameters: *parameters
working_directory: *workdir
environment:
<<: *environment
DB: postgresql
DB_HOST: localhost
DB_USERNAME: root
docker:
- image: *image
- image: jhawthorn/circleci-postgres-fast
environment:
POSTGRES_USER: root
mysql:
parameters: *parameters
working_directory: *workdir
environment:
<<: *environment
DB: mysql
DB_HOST: 127.0.0.1
DB_USERNAME: root
docker:
- image: *image
- image: cimg/mysql:5.7
sqlite:
parameters: *parameters
working_directory: *workdir
environment:
<<: *environment
DB: sqlite
docker:
- image: *image
commands:
setup:
steps:
- checkout
- browser-tools/install-chrome
- run:
name: Check chrome version
command: |
google-chrome --version
- browser-tools/install-chromedriver
- run:
name: Check chromedriver version
command: |
chromedriver --version
- run:
name: "Lock dependencies"
command: |
sudo gem update --system
gem install bundler -v"~> 2.3" --conservative
bundle lock
ruby -v > .ruby-version
- restore_cache:
keys:
- solidus-gems-v4-{{checksum ".ruby-version"}}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- solidus-gems-v4-{{checksum ".ruby-version"}}-{{ .Branch }}
- solidus-gems-v4-{{checksum ".ruby-version"}}-main
- solidus-gems-v4-{{checksum ".ruby-version"}}
- run: |
bundle config set path 'vendor/bundle'
bundle check || bundle install
bundle clean
- save_cache:
key: solidus-gems-v4-{{checksum ".ruby-version"}}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- libvips
test:
steps:
- run:
name: "Run Admin Tests"
command: ./bin/build-ci admin
- run:
name: "Run Api Tests"
command: ./bin/build-ci api
- run:
name: "Run Backend Tests"
command: ./bin/build-ci backend
- run:
name: "Run Backend JS Tests"
command: ./bin/build-ci "backend JS"
- run:
name: "Run Core Tests"
command: ./bin/build-ci core
- run:
name: "Run Sample Tests"
command: ./bin/build-ci sample
- run:
name: "Run Legacy Promotion Tests"
command: ./bin/build-ci legacy_promotions
- run:
name: "Run Friendly Promotion Tests"
command: ./bin/build-ci promotions
- store_artifacts:
path: /tmp/test-artifacts
destination: test-artifacts
- store_artifacts:
path: /tmp/test-results
destination: raw-test-output
- store_test_results:
path: /tmp/test-results
libvips:
steps:
- run:
name: Install libvips
command: |
sudo apt-get update
sudo apt-get install -yq libvips-dev
install_solidus:
parameters:
flags:
type: string
default: "# no options"
description: "flags to be passed to `bin/rails g solidus:install"
steps:
- run:
name: "Cleanup & check rails version"
command: |
sudo gem update --system
gem install bundler -v"~> 2.4"
gem environment path
rm -rf /tmp/my_app /tmp/.ruby-versions # cleanup previous runs
rm -rf /tmp/my_app /tmp/.gems-versions # cleanup previous runs
ruby -v >> /tmp/.ruby-versions
gem --version >> /tmp/.gems-versions
bundle --version >> /tmp/.gems-versions
gem search -eq rails -v "~> 7" -v "< 8.0" >> /tmp/.gems-versions # get the latest rails from rubygems
gem search -eq solidus >> /tmp/.gems-versions # get the latest solidus from rubygems
cat /tmp/.ruby-versions
cat /tmp/.gems-versions
- restore_cache:
keys:
- solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
- solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-
- run:
name: "Prepare the rails application"
command: |
cd /tmp
test -d my_app || (gem install rails -v "< 8.0" && gem install solidus)
test -d my_app || rails new my_app --skip-git
- save_cache:
key: solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
paths:
- /tmp/my_app
- /home/circleci/.rubygems
- run:
name: "Run `solidus:install` with `<<parameters.flags>>`"
command: |
cd /tmp/my_app
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
unset RAILS_ENV # avoid doing everything on the test environment
bin/rails generate solidus:install --auto-accept <<parameters.flags>>
test_page:
parameters:
app_root:
type: string
default: "/tmp/my_app"
path:
type: string
default: "/"
expected_text:
type: string
steps:
- run:
name: "Check the contents of the <<parameters.path>> page"
command: |
cd <<parameters.app_root>>
unset RAILS_ENV # avoid doing everything on the test environment
bin/rails server -p 3000 &
wget --quiet --output-document - --tries=30 --retry-connrefused "http://localhost:3000<<parameters.path>>" | grep "<<parameters.expected_text>>"
echo "Exited with $?"
kill $(cat "tmp/pids/server.pid")
install_dummy_app:
parameters:
extra_gems:
type: string
default: ""
description: "Gems to be added to the extension's Gemfile before running the installer"
steps:
- run:
name: "Test `rake task: extensions:test_app` <<#parameters.extra_gems>>(with <<parameters.extra_gems>>)<</parameters.extra_gems>>"
command: |
rm -rf /tmp/dummy_extension # cleanup previous runs
mkdir -p /tmp/dummy_extension
cd /tmp/dummy_extension
bundle init
bundle add rails -v "< 8.0" --skip-install
bundle add sqlite3 -v "~> 2.0" --skip-install
test -n "<<parameters.extra_gems>>" && bundle add <<parameters.extra_gems>> --skip-install
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
export LIB_NAME=set # dummy requireable file
bundle exec rake -rrails -rspree/testing_support/extension_rake -e'Rake::Task["extension:test_app"].invoke'
jobs:
solidus_installer:
executor:
name: sqlite
ruby: "3.1"
steps:
- checkout
- run:
name: "Skip for Solidus older than 4.2"
command: |
ruby -I. -rcore/lib/spree/core/version.rb -e "exit Spree.solidus_gem_version >= Gem::Version.new('4.2')" ||
circleci-agent step halt
- libvips
- install_solidus:
flags: "--sample=false --frontend=starter --authentication=devise"
- test_page:
expected_text: "<title>Sample Store</title>"
- run:
name: Ensure the correct PayPal is installed for SSF
command: |
cd /tmp/my_app
bundle list | grep 'solidus_paypal_commerce_platform (1.'
- install_solidus:
flags: "--sample=false --frontend=starter --authentication=devise --payment-method=stripe"
- test_page:
expected_text: "<title>Sample Store</title>"
- install_dummy_app
- run:
name: "Ensure extension test app is created"
command: |
test -d /tmp/dummy_extension/spec/dummy
test_solidus:
parameters:
database:
type: string
default: postgres
ruby:
type: string
default: "3.2"
rails:
type: string
default: "7.1"
paperclip:
type: boolean
default: true
executor:
name: << parameters.database >>
ruby: << parameters.ruby >>
parallelism: 3
environment:
DISABLE_ACTIVE_STORAGE: << parameters.paperclip >>
BUILDKITE_ANALYTICS_EXECUTION_NAME_PREFIX: "(<< parameters.ruby >>:<< parameters.rails >>:<< parameters.database >>:<< parameters.paperclip >>)"
steps:
- checkout
- run:
name: "Set the RAILS_VERSION environment variable"
command: |
# If << parameters.rails >> is a kown branch name, use the latest version of that branch
# otherwise interpret it as a partial version number.
RAILS_VERSION=$(echo "<< parameters.rails >>" | grep -qE "(stable|main)" && echo "~> << parameters.rails >>.0" || echo "<< parameters.rails >>")
echo "RAILS_VERSION=$RAILS_VERSION" >> $BASH_ENV
source $BASH_ENV
- setup
- test
# This job creates a dir to hold coverage data, run test suites with coverage enabled and
# generate the coverage report.
test_solidus_with_coverage:
parameters:
database:
type: string
default: postgres
ruby:
type: string
default: "3.2"
executor:
name: << parameters.database >>
ruby: << parameters.ruby >>
parallelism: 3
environment:
COVERAGE: "true"
COVERAGE_DIR: /tmp/coverage
DISABLE_ACTIVE_STORAGE: false
steps:
- setup
- run:
name: Setup Coverage Env Vars
command: |
echo 'export COVERAGE_FILE=/tmp/coverage/coverage.xml' >> $BASH_ENV
source $BASH_ENV
- run:
name: Verify Coverage Env Vars
command: |
echo $COVERAGE
echo /tmp/coverage
echo /tmp/coverage/coverage.xml
- run:
name: Setup Coverage Directory
command: mkdir -p /tmp/coverage
- test
- run:
name: Report Coverage
command: bundle exec rake solidus:coverage[cobertura]
- codecov/upload:
file: /tmp/coverage/coverage.xml
workflows:
build:
jobs:
- solidus_installer
- test_solidus_with_coverage # Only test with coverage support with the default versions
# Based on supported versions for the current Solidus release and recommended versions from
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html.
- test_solidus:
name: &name "test-rails-<<matrix.rails>>-ruby-<<matrix.ruby>>-<<matrix.database>>-<<#matrix.paperclip>>paperclip<</matrix.paperclip>><<^matrix.paperclip>>activestorage<</matrix.paperclip>>"
matrix:
{
parameters:
{
rails: ["7.0", "7.1", "7.2"],
ruby: ["3.1"],
database: ["mysql"],
paperclip: [true],
},
}
- test_solidus:
name: *name
matrix:
{
parameters:
{
rails: ["7.0", "7.1", "7.2"],
ruby: ["3.1"],
database: ["postgres"],
paperclip: [false],
},
}
- test_solidus:
name: *name
matrix:
{
parameters:
{
rails: ["7.1"],
ruby: ["3.2"],
database: ["sqlite"],
paperclip: [false],
},
}
- test_solidus:
name: *name
matrix:
{
parameters:
{
rails: ["7.2", "main"],
ruby: ["3.3.5"],
database: ["sqlite"],
paperclip: [false],
},
}