Skip to content

Commit

Permalink
Merge pull request #6174 from samvera/ci-dassie
Browse files Browse the repository at this point in the history
test Ruby 3.2 with docker/dassie
  • Loading branch information
hackartisan authored Aug 24, 2023
2 parents f8b08f8 + dc0bba0 commit 50db3c0
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 19 deletions.
164 changes: 145 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,138 @@ orbs:
ruby: circleci/ruby@2
node: circleci/node@5

executors:
hyrax:
parameters:
fcrepo_version:
type: string
default: '4.7.5'
hyrax_app:
type: string
default: 'dassie'
postgres_version:
type: string
default: '9.6'
redis_version:
type: string
default: '6.2'
ruby_type:
type: string
default: 'ruby'
ruby_version:
type: string
default: '2.5.5'
solr_port:
type: string
default: '8985'
solr_version:
type: string
default: '8.11-slim'
environment:
RAILS_ENV: test
RACK_ENV: test
FCREPO_PORT: 8080
POSTGRES_DB: circle_test
POSTGRES_HOST: 127.0.0.1
POSTGRES_USER: postgres
docker:
- image: "ghcr.io/samvera/hyrax/<< parameters.hyrax_app >>-dev:<< pipeline.git.revision >>"
- image: seleniarm/standalone-chromium:114.0
environment:
SE_NODE_SESSION_TIMEOUT: 1200
START_XVFB: "false"

- image: samvera/fcrepo4:<< parameters.fcrepo_version >>
environment:
CATALINA_OPTS: "-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
- image: zookeeper:3.4
- image: solr:<< parameters.solr_version >>
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"}}}'
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:<< parameters.redis_version >>
- image: cimg/postgres:<< parameters.postgres_version >>

jobs:
kaniko-build:
parameters:
hyrax_app:
type: string
default: dassie
ruby_version:
type: string
default: 3.2.2
docker:
- image: gcr.io/kaniko-project/executor:v1.14.0-debug
entrypoint: ""
steps:
- run:
name: Configure GHCR credentials
command: |
cat > /kaniko/.docker/config.json \<<- JSON
{
"auths": {
"ghcr.io": {
"auth": "$(echo -n $GHCR_USER:$GHCR_TOKEN | base64)"
}
}
}
JSON
- run:
name: Build and Push image
command: |
/kaniko/executor \
--cache=true \
--build-arg "EXTRA_APK_PACKAGES=git bash chromium" \
--build-arg "APP_PATH=.<< parameters.hyrax_app >>" \
--build-arg "RUBY_VERSION=<< parameters.ruby_version >>" \
--context "git://github.com/samvera/hyrax#refs/heads/${CIRCLE_BRANCH}#${CIRCLE_SHA1}" \
--target "hyrax-engine-dev" \
--destination "ghcr.io/samvera/hyrax/<< parameters.hyrax_app >>-dev:${CIRCLE_SHA1}"
hyrax-test:
parameters:
hyrax_app:
type: string
default: dassie
hyrax_valkyrie:
type: string
default: "false"
ruby_version:
type: string
default: 3.2.2
executor:
name: hyrax
hyrax_app: << parameters.hyrax_app >>
ruby_version: << parameters.ruby_version >>
resource_class: large
parallelism: 12
environment:
CHROME_HEADLESS_MODE: true
DATABASE_URL: postgresql://[email protected]/circle_test
HUB_URL: http://localhost:4444/wd/hub
HYRAX_VALKYRIE: << parameters.hyrax_valkyrie >>
IN_DOCKER: true
KARMA_BROWSER: ChromiumHeadlessCustom
VALKYRIE_SOLR_CORE: valkyrie-test
VALKYRIE_SOLR_PORT: 8985
steps:
- run:
name: yarn
command: cd /app/samvera/hyrax-engine && yarn
- run:
name: Create solr core
command: |
cd /app/samvera/hyrax-webapp/solr/conf
zip -1 -r solr_conf.zip ./*
db-wait.sh localhost:8985 # wait for solr to be available before hitting the API
curl -H "Content-type:application/octet-stream" --data-binary @solr_conf.zip "http://solr:[email protected]:8985/solr/admin/configs?action=UPLOAD&name=solrconfig"
curl -H 'Content-type: application/json' http://solr:[email protected]:8985/api/collections/ -d '{create: {name: hydra-test, config: solrconfig, numShards: 1}}'
curl -H 'Content-type: application/json' http://solr:[email protected]:8985/api/collections/ -d '{create: {name: valkyrie-test, config: solrconfig, numShards: 1}}'
- ruby/rspec-test:
app-dir: /app/samvera/hyrax-engine

bundle:
parameters:
ruby_version:
Expand Down Expand Up @@ -189,31 +320,26 @@ jobs:

workflows:
version: 2
ruby3-2:
dassie:
jobs:
- bundle:
ruby_version: "3.2.2"
rails_version: "6.1.7.4"
bundler_version: "2.4.15"
- build:
- kaniko-build:
name: "dassie-build"
ruby_version: "3.2.2"
rails_version: "6.1.7.4"
bundler_version: "2.4.15"
requires:
- bundle
- test:
name: "ruby3-2"
hyrax_app: "dassie"
- hyrax-test:
name: "dassie-test"
ruby_version: "3.2.2"
bundler_version: "2.4.15"
hyrax_app: "dassie"
requires:
- build
- test:
name: "ruby3-2-valkyrie"
- dassie-build
- hyrax-test:
name: "dassie-valkyrie-test"
ruby_version: "3.2.2"
bundler_version: "2.4.15"
hyrax_valkyrie: "true"
hyrax_app: "dassie"
hyrax_valkyrie: "1"
requires:
- build
- dassie-build

ruby2-7:
jobs:
- bundle:
Expand Down
1 change: 1 addition & 0 deletions .dassie/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.assets.debug = true

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
Expand Down
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Dockerfile

*.rdb

.circleci/*
.github/*

artifacts/*
coverage/*
chart/*
Expand Down
1 change: 1 addition & 0 deletions .koppie/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.assets.debug = true

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
Expand Down
1 change: 1 addition & 0 deletions lib/hyrax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
require 'hyrax/inflections'
require 'hyrax/name'
require 'hyrax/valkyrie_can_can_adapter'
require 'retriable'
require 'valkyrie/indexing_adapter'
require 'valkyrie/indexing/solr/indexing_adapter'
require 'valkyrie/indexing/null_indexing_adapter'
Expand Down

0 comments on commit 50db3c0

Please sign in to comment.