-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.yml
115 lines (108 loc) · 2.93 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
---
version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.4.4
coveralls: coveralls/coveralls@2.2.1
commands:
install_dependencies:
steps:
- run: gem install bundler -v '2.3.22'
- run: cp Gemfile.lock Gemfile.lock.bak
- restore_cache:
key: &gem_key pdc_describe-cimg-{{ checksum "Gemfile.lock.bak" }}
- run: bundle config set path './vendor/bundle'
- run: bundle config set --local without production
- run: bundle install --jobs=4 --retry=3
- save_cache:
key: *gem_key
paths:
- ./vendor/bundle
- restore_cache:
name: Restore Yarn Package Cache
key: &yarn_key pdc_describe-yarn-cimg-{{ checksum "yarn.lock" }}
- run:
name: Install NPM Dependencies via Yarn
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: *yarn_key
paths:
- ~/.cache/yarn
jobs:
build:
working_directory: ~/pdc_describe
docker:
- &ruby_docker
image: cimg/ruby:3.1.6-browsers
environment:
RAILS_ENV: test
steps:
- checkout
- run: sudo apt update && sudo apt install postgresql-client libmsgpack-dev
- install_dependencies
- persist_to_workspace:
root: &root '~/pdc_describe'
paths: '*'
rubocop:
working_directory: *root
docker:
- *ruby_docker
steps:
- attach_workspace:
at: *root
- run:
name: Run rubocop
command: bundle exec rubocop
eslint:
# We don't actually need any of the ruby environment to lint JS... but use what we have for now.
working_directory: ~/pdc_describe
docker:
- image: cimg/ruby:3.1.6-browsers
environment:
RAILS_ENV: test
steps:
- attach_workspace:
at: '~/pdc_describe'
- install_dependencies
- run:
name: Run eslint
command: yarn lint
test:
working_directory: *root
docker:
- *ruby_docker
- image: postgres:15-alpine
environment:
POSTGRES_USER: pdc_describe_user
POSTGRES_DB: test_db
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- attach_workspace:
at: *root
- browser-tools/install-firefox
- run:
name: Wait for PostgreSQL
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: bundle exec rake db:create RAILS_ENV=test
- run: bundle exec rake db:migrate RAILS_ENV=test
- run:
name: Run Rspec
command: bundle exec rspec spec
- store_artifacts:
path:
~/pdc_describe/coverage
- coveralls/upload
workflows:
version: 2
build_accept_deploy:
jobs:
- build
- test:
requires:
- build
- rubocop:
requires:
- build
- eslint:
requires:
- build