-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.yml
251 lines (250 loc) · 9.21 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
---
version: 2
jobs:
build:
working_directory: ~/figgy
docker:
- image: circleci/ruby:2.6.5-node-browsers
environment:
RAILS_ENV: test
FIGGY_DB_HOST: localhost
FIGGY_DB_USERNAME: figgy
FIGGY_DB_PASSWORD: ""
- image: postgres:10.6-alpine
environment:
POSTGRES_USER: figgy
POSTGRES_DB: figgy_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- checkout
- run: sudo apt update -y
- run: sudo sh bin/ci_mediainfo_install.sh
- run: sudo apt-get install gdal-bin libgdal-dev libcairo2-dev libpango1.0-dev mediainfo libopenjp2-tools libopenjp2-7 lsof
- run: sudo sh bin/ci_simple_tiles_install.sh
- run: sudo sh bin/ci_free_tds_install.sh
- run: sudo sh bin/ci_vips_install.sh
- run:
name: Install node@lts/erbium (need right version for `yarn`)
command: |
set +e
touch $BASH_ENV
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
echo 'nvm install lts/erbium' >> $BASH_ENV
echo 'nvm alias default lts/erbium' >> $BASH_ENV
- run:
name: Check current version of node
command: node -v
# Restore Cached Dependencies
- type: cache-restore
name: Restore bundle cache
key: figgy-{{ checksum "Gemfile.lock" }}
# Remove cached simpler-tiles - needs to be reinstalled every time.
- run: rm vendor/bundle/ruby/2.6.0/specifications/simpler-tiles-0.3.1.gemspec || true
# Install Bundler
- run: gem install bundler -v '2.2.14'
# Bundle install dependencies
- run: bundle install --path vendor/bundle
# Cache Dependencies
- type: cache-save
name: Store bundle cache
key: figgy-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
# Only necessary if app uses webpacker or yarn in some other way
- restore_cache:
name: Restore Yarn Package Cache
keys:
- figgy-yarn-{{ checksum "yarn.lock" }}-cc732be
- figgy-yarn-
- run:
name: Install NPM Dependencies via Yarn
command: yarn install --frozen-lockfile
# Store yarn / webpacker cache
- save_cache:
name: Save Yarn Package Cache
key: figgy-yarn-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run: NODE_ENV=test bundle exec rails webpacker:compile
- persist_to_workspace:
root: '~/figgy'
paths: '*'
test:
working_directory: ~/figgy
docker:
- image: circleci/ruby:2.6.5-node-browsers
environment:
RAILS_ENV: test
FIGGY_DB_HOST: localhost
FIGGY_DB_USERNAME: figgy
FIGGY_DB_PASSWORD: ""
MEDIAINFO_PATH: /usr/bin/mediainfo
- image: postgres:9.6-alpine
environment:
POSTGRES_USER: figgy
POSTGRES_DB: figgy_test
POSTGRES_HOST_AUTH_METHOD: trust
- image: solr:7.7-alpine
command: bin/solr -cloud -noprompt -f -p 8984
parallelism: 4
environment:
SPEC_OPTS: --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress
COVERALLS_PARALLEL: true
steps:
- attach_workspace:
at: '~/figgy'
- run:
name: Install Chrome
command: |
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt update -y
sudo apt-get -y install google-chrome-stable
- run: sudo apt update -y
- run: sudo sh bin/ci_mediainfo_install.sh
- run: sudo apt-get install gdal-bin libgdal-dev libcairo2-dev libpango1.0-dev tesseract-ocr tesseract-ocr-ita tesseract-ocr-eng mediainfo ffmpeg postgresql-client libopenjp2-tools libopenjp2-7 ocrmypdf lsof python3-pip
- run: sudo sh bin/ci_simple_tiles_install.sh
- run: sudo sh bin/ci_free_tds_install.sh
- run: sudo sh bin/ci_vips_install.sh
- run: sudo pip3 install pip -U
- run: sudo pip3 install morecantile==3.0.5
- run: sudo pip3 install cogeo-mosaic
- run:
name: Install node@lts/erbium (need right version for `yarn`)
command: |
set +e
touch $BASH_ENV
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
echo 'nvm install lts/erbium' >> $BASH_ENV
echo 'nvm alias default lts/erbium' >> $BASH_ENV
- run:
name: Check current version of node
command: node -v
# Wait for DB
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
# Remove cached simpler-tiles - needs to be reinstalled every time.
- run: rm vendor/bundle/ruby/2.6.0/specifications/simpler-tiles-0.3.1.gemspec || true
# Install Bundler
- run: gem install bundler -v '2.2.14'
# Bundle install dependencies
- run: bundle install --path vendor/bundle
- run: yarn exec jest --coverage
- run:
name: Load config into solr
command: |
cd solr/config
zip -1 -r solr_config.zip ./*
curl -H "Content-type:application/octet-stream" --data-binary @solr_config.zip "http://localhost:8984/solr/admin/configs?action=UPLOAD&name=figgy"
curl -H 'Content-type: application/json' http://localhost:8984/api/collections/ -d '{create: {name: figgy-core-test, config: figgy, numShards: 1}}'
- run: bundle exec rake db:migrate
- run:
name: Run rspec in parallel
command: |
mkdir /tmp/test-results
bundle exec rspec $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
- run:
name: Stash Coverage Results
command: |
mkdir coverage_results
cp -R coverage/.resultset.json coverage_results/.resultset-${CIRCLE_NODE_INDEX}.json
- persist_to_workspace:
root: '~/figgy'
paths: 'coverage_results'
# collect reports
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
destination: test-results
coverage_report:
working_directory: ~/figgy
docker:
- image: circleci/ruby:2.6.5-node-browsers
steps:
- attach_workspace:
at: '~/figgy'
- run: gem install simplecov -v '~> 0.16.0'
- run: gem install activesupport -v 5.1.6.2
- run:
name: Merge and check coverage
command: |
RAILS_ENV=test ruby ./scripts/combine_coverage.rb
- store_artifacts:
path: ~/figgy/coverage
destination: coverage
rubocop:
working_directory: ~/figgy
docker:
- image: circleci/ruby:2.6.5-node-browsers
environment:
RAILS_ENV: test
FIGGY_DB_HOST: localhost
FIGGY_DB_USERNAME: figgy
FIGGY_DB_PASSWORD: ""
steps:
- attach_workspace:
at: '~/figgy'
- run: sudo apt update -y
- run: sudo sh bin/ci_mediainfo_install.sh
- run: sudo apt-get install gdal-bin libgdal-dev libcairo2-dev libpango1.0-dev mediainfo lsof
- run: sudo sh bin/ci_simple_tiles_install.sh
- run: sudo sh bin/ci_free_tds_install.sh
- run: sudo sh bin/ci_vips_install.sh
- run:
name: Install node@lts/erbium (need right version for `yarn`)
command: |
set +e
touch $BASH_ENV
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
echo 'nvm install lts/erbium' >> $BASH_ENV
echo 'nvm alias default lts/erbium' >> $BASH_ENV
- run:
name: Check current version of node
command: node -v
# Remove cached simpler-tiles - needs to be reinstalled every time.
- run: rm vendor/bundle/ruby/2.6.0/specifications/simpler-tiles-0.3.1.gemspec || true
# Install Bundler
- run: gem install bundler -v '2.2.14'
# Bundle install dependencies
- run: bundle install --path vendor/bundle
- run: bundle exec rake rubocop
- run: yarn lint
workflows:
version: 2
build_accept_deploy:
jobs:
- build
- test:
requires:
- build
- rubocop:
requires:
- build
- coverage_report:
requires:
- test
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- main
jobs:
- build
- test:
requires:
- build
- rubocop:
requires:
- build
- coverage_report:
requires:
- test