-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.yml
More file actions
179 lines (164 loc) · 4.41 KB
/
Copy pathconfig.yml
File metadata and controls
179 lines (164 loc) · 4.41 KB
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
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/configuration-reference
version: 2.1
rails_build: &rails_build
resource_class: small
parameters:
web_awesome:
description: "Testing against Web Awesome?"
default: false
type: boolean
docker:
- image: cimg/ruby:3.4-browsers
- image: cimg/postgres:16.1
environment:
POSTGRES_DB: flip_on_the_awesome
POSTGRES_PASSWORD: ''
POSTGRES_USER: circleci-demo-ruby
environment:
WEB_AWESOME: "<< parameters.web_awesome >>"
BUNDLE_JOBS: '3'
BUNDLE_RETRY: '3'
PGHOST: 127.0.0.1
PGPASSWORD: ''
PGUSER: circleci-demo-ruby
RAILS_ENV: test
PARALLEL_WORKERS: 3
COVERAGE: 1
HEADLESS_TESTS: true
orbs:
bun: ksylvest/bun@1.0.1
ruby: circleci/ruby@2.1.1
jobs:
lint:
resource_class: medium
docker:
- image: cimg/ruby:3.4
steps:
- checkout
- ruby/install-deps
- ruby/rubocop-check:
format: progress
label: Inspecting with Rubocop
parallel: true
- run: bundle exec bundler-audit --update
- run: bundle exec brakeman -q -w2
coverage:
resource_class: small
docker:
- image: cimg/ruby:3.4
environment:
RAILS_ENV: test
steps:
- checkout
- attach_workspace:
at: .
- ruby/install-deps
- run:
name: Merge and check coverage
command: |
bundle exec rake coverage:report
- store_artifacts:
path: coverage
- run:
name: Setup Code Climate test-reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- run:
name: Format coverage results for CodeClimate
command: |
./cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.json
- run:
name: Upload to CodeClimate
command: |
./cc-test-reporter upload-coverage -i tmp/codeclimate.json
test:
<<: *rails_build
steps:
- checkout
- ruby/install-deps
- bun/install
- run: bun install
- run:
command: dockerize -wait tcp://localhost:5432 -timeout 1m
name: Wait for DB
- run:
command: bundle exec rails db:schema:load --trace
name: Database setup
- run: bundle exec rails test
- store_test_results:
path: test/reports
- store_artifacts:
path: log/
- store_artifacts:
path: tmp/capybara/
- run:
name: Stash Coverage Results
command: |
mkdir coverage_results
cp -R coverage/.resultset.json coverage_results/.resultset-${CIRCLE_JOB}-${CIRCLE_NODE_INDEX}.json
- persist_to_workspace:
root: .
paths:
- coverage_results
test-system:
<<: *rails_build
resource_class: medium
steps:
- checkout
- ruby/install-deps
- bun/install
- run: bun install
- run:
command: dockerize -wait tcp://localhost:5432 -timeout 1m
name: Wait for DB
- run:
command: bundle exec rails db:schema:load --trace
name: Database setup
- run: bundle exec rails test:system
- store_test_results:
path: test/reports
- store_artifacts:
path: log/
- store_artifacts:
path: tmp/capybara/
- run:
name: Stash Coverage Results
command: |
mkdir coverage_results
cp -R coverage/.resultset.json coverage_results/.resultset-${CIRCLE_JOB}-${CIRCLE_NODE_INDEX}.json
- persist_to_workspace:
root: .
paths:
- coverage_results
workflows:
build_and_test:
jobs:
- lint:
context:
- "My Context"
- test:
context:
- "My Context"
- test-system:
context:
- "My Context"
- coverage:
context:
- "My Context"
requires:
- test
- test-system
webawesome_test:
jobs:
- test:
name: "test-wa"
web_awesome: true
context:
- "My Context"
- test-system:
name: "test-system-wa"
web_awesome: true
context:
- "My Context"