-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathconfig.yml
176 lines (154 loc) · 6.35 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
version: 2.1
orbs:
samvera: samvera/circleci-orb@1
jobs:
build:
docker:
# Primary container image where all steps run.
- image: avalonmediasystem/avalon:develop
environment:
- DATABASE_URL=postgresql://postgres@localhost:5432/postgres
- FEDORA_URL=http://fedoraAdmin:fedoraAdmin@localhost:8080/fcrepo/rest
- FEDORA_BASE_PATH=/test
- FEDORA_TIMEOUT=300
- RAILS_ENV=test
# Secondary container image on common network.
- image: postgres:10-alpine
environment:
- POSTGRES_USER=postgres
- POSTGRES_DB=avalon
- POSTGRES_PASSWORD=password
- image: fcrepo/fcrepo:6.5-tomcat9
environment:
CATALINA_OPTS: -Dfcrepo.autoversioning.enabled=false
- image: zookeeper:3.9
environment:
ZOO_ADMINSERVER_ENABLED: false
- image: solr:9
environment:
VERBOSE: yes
SECURITY_JSON: '{"authentication":{"blockUnknown": false, "class":"solr.BasicAuthPlugin", "credentials":{"solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="}, "realm":"My Solr users", "forwardCredentials": false}, "authorization":{ "class":"solr.RuleBasedAuthorizationPlugin", "permissions":[{"name":"security-edit", "role":"admin"}], "user-role":{"solr":"admin"}}}'
SOLR_MODULES: "analysis-extras,extraction"
command: sh -c "server/scripts/cloud-scripts/zkcli.sh -zkhost localhost:2181 -cmd put /security.json \"${SECURITY_JSON}\" && solr-fg -cloud -noprompt -p << parameters.solr_port >> -z localhost:2181"
- image: redis:alpine
parameters:
ruby_ver:
description: 'Ruby version'
default: '3.1'
type: 'string'
solr_port:
type: string
default: '8985'
parallelism:
type: integer
default: 4
solr_config_path:
type: string
default: 'solr/conf'
core_name:
type: string
default: 'hydra-test'
working_directory: /home/app/avalon
parallelism: << parameters.parallelism >>
steps:
- run:
name: Clean out existing code
command: rm -rf .[!.]* *
- run: git config --global --add safe.directory /home/app/avalon
- samvera/cached_checkout
- run: cp config/controlled_vocabulary.yml.example config/controlled_vocabulary.yml
- run:
command: |
unset BUNDLE_APP_CONFIG
bundle install --with aws development test postgres --without production --jobs=4 --retry=3
bundle exec rake db:migrate
- restore_cache:
keys:
- yarn-cache-v1-{{ arch }}-{{ checksum "yarn.lock" }}
- run: yarn
- save_cache:
key: yarn-cache-v1-{{ arch }}-{{ checksum "yarn.lock" }}
paths:
- .cache/yarn
# Copy solr 8 compliant step from unreleased version of orb
#- samvera/install_solr_core:
# solr_config_path: << parameters.solr_config_path >>
- run:
name: Wait for Solr
command: dockerize -wait tcp://localhost:<< parameters.solr_port >> -timeout 1m
- run:
name: Create solr core
command: |
if [ -d << parameters.solr_config_path >> ]
then
cd << parameters.solr_config_path >>
else
if [ -d "$(bundle show active-fedora)/lib/generators/active_fedora/config/solr/templates/solr/conf" ]
then
cd "$(bundle show active-fedora)/lib/generators/active_fedora/config/solr/templates/solr/conf"
else
cd "$(bundle show active-fedora)/lib/generators/active_fedora/config/solr/templates/solr/config"
fi
fi
zip -1 -r solr_conf.zip ./*
curl -H "Content-type:application/octet-stream" --data-binary @solr_conf.zip "http://solr:[email protected]:<< parameters.solr_port >>/solr/admin/configs?action=UPLOAD&name=solrconfig"
curl "http://solr:[email protected]:<< parameters.solr_port >>/solr/admin/collections?action=CREATE&name=hydra-test&numShards=1&collection.configName=solrconfig"
- run:
command: |
if [[ $(command -v cc-test-reporter) == "" ]]; then
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
fi
- run:
command: ./cc-test-reporter before-build
# Pull in the parallel_rspec step and modify it to ensure that test results get stored
# - samvera/parallel_rspec
- run: mkdir /tmp/test-results
- run:
name: Run rspec in parallel
command: |
circleci tests glob "spec/**/*_spec.rb" | circleci tests run --command="xargs bundle exec rspec --format progress --format RspecJunitFormatter -o /tmp/test-results/rspec.xml" --verbose --split-by=timings
# collect reports
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
destination: test-results
- run:
command: ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
- persist_to_workspace:
root: coverage
paths:
- codeclimate.*.json
upload-coverage:
parameters:
parallelism:
type: integer
default: 4
docker:
# Primary container image where all steps run.
- image: avalonmediasystem/avalon:7.8.0-dev
working_directory: /home/app/avalon
steps:
- attach_workspace:
at: /home/app/avalon
- run:
name: Install 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
- deploy:
# CC_TEST_REPORTER_ID set within the circleci web interface
command: ./cc-test-reporter sum-coverage --output - --parts << parameters.parallelism >> codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
workflows:
version: 2
build_test_report:
jobs:
- build:
ruby_ver: '3.3'
name: 'Ruby3-3'
parallelism: 4
- upload-coverage:
parallelism: 4
requires:
- Ruby3-3