Skip to content

Commit

Permalink
Merge branch 'main' into lease-helper-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
dunn authored Aug 25, 2023
2 parents 1e20cae + 2e3aae6 commit 596a24f
Show file tree
Hide file tree
Showing 106 changed files with 753 additions and 1,438 deletions.
313 changes: 116 additions & 197 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,237 +5,156 @@ orbs:
ruby: circleci/ruby@2
node: circleci/node@5

jobs:
bundle:
executors:
hyrax:
parameters:
fcrepo_version:
type: string
default: '4.7.5'
hyrax_app:
type: string
default: 'dassie'
postgres_version:
type: string
default: '14.9'
redis_version:
type: string
default: '6.2'
ruby_type:
type: string
default: 'ruby'
ruby_version:
type: string
default: 2.7.8
bundler_version:
default: '2.5.5'
solr_port:
type: string
default: 2.4.15
rails_version:
default: '8985'
solr_version:
type: string
default: 6.1.7.4
executor:
name: 'samvera/ruby'
ruby_version: << parameters.ruby_version >>
resource_class: medium
default: '8.11-slim'
environment:
RAILS_VERSION: << parameters.rails_version >>
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
steps:
- samvera/cached_checkout
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"

- run:
name: Check for a branch named 'master'
command: |
git fetch --all --quiet --prune --prune-tags
if [[ -n "$(git branch --all --list master */master)" ]]; then
echo "A branch named 'master' was found. Please remove it."
echo "$(git branch --all --list master */master)"
fi
[[ -z "$(git branch --all --list master */master)" ]]
- 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 >>

- samvera/bundle:
ruby_version: << parameters.ruby_version >>
bundler_version: << parameters.bundler_version >>

# Run rubocop in parallel with caching
# This should get added to the orb once proven here

- restore_cache:
name: Restore rubocop cache
keys:
- v1-rubocop-ruby<< parameters.ruby_version >>-bundle{{ checksum "Gemfile.lock" }}
- v1-rubocop-ruby<< parameters.ruby_version >>
- v1

- run:
name: Run rubocop in parallel
command: bundle exec rubocop --parallel

- save_cache:
name: Save rubocop cache
key: v1-rubocop-ruby<< parameters.ruby_version >>-bundle{{ checksum "Gemfile.lock" }}
paths:
- ~/.cache/rubocop_cache

- persist_to_workspace:
root: ~/
paths:
- project/*
- project/**/*

build:
jobs:
kaniko-build:
parameters:
ruby_version:
type: string
default: 2.7.8
bundler_version:
hyrax_app:
type: string
default: 2.4.15
rails_version:
default: dassie
ruby_version:
type: string
default: 6.1.7.4
executor:
name: 'samvera/ruby_fcrepo_solr_redis_postgres'
ruby_version: << parameters.ruby_version >>
solr_version: 8.11-slim
resource_class: medium
environment:
RAILS_VERSION: << parameters.rails_version >>
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
ENGINE_CART_RAILS_OPTIONS: --database=postgresql --skip-git --skip-bundle --skip-listen --skip-spring --skip-keeps --skip-test --skip-bootsnap --skip-javascript
DATABASE_URL: postgresql://[email protected]/circle_test # Hard-coded with data from CircleCI orb, related to https://github.com/samvera-labs/samvera-circleci-orb/issues/42
default: 3.2.2
docker:
- image: gcr.io/kaniko-project/executor:v1.14.0-debug
entrypoint: ""
steps:
- attach_workspace:
at: ~/
- samvera/engine_cart_generate:
cache_key: v1-internal-test-app-{{ checksum "hyrax.gemspec" }}-{{ checksum ".regen" }}-{{ checksum ".circleci/config.yml" }}-<< parameters.rails_version >>-<< parameters.ruby_version >>
- samvera/bundle:
ruby_version: << parameters.ruby_version >>
bundler_version: << parameters.bundler_version >>
- run:
name: Generate .internal_test_app/Gemfile.lock
command: bundle lock
working_directory: .internal_test_app
- ruby/install-deps:
app-dir: .internal_test_app
- node/install-packages:
pkg-manager: yarn
app-dir: .internal_test_app
- persist_to_workspace:
root: ~/
paths:
- project/*
- project/**/*
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" \
--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}"
test:
hyrax-test:
parameters:
ruby_version:
hyrax_app:
type: string
default: 2.7.8
bundler_version:
type: string
default: 2.4.15
default: dassie
hyrax_valkyrie:
type: string
default: "false"
ruby_version:
type: string
default: 3.2.2
executor:
name: 'samvera/ruby_fcrepo_solr_redis_postgres'
name: hyrax
hyrax_app: << parameters.hyrax_app >>
ruby_version: << parameters.ruby_version >>
solr_version: 8.11-slim
resource_class: medium+
parallelism: 10
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: remote-chromium
VALKYRIE_SOLR_CORE: valkyrie-test
VALKYRIE_SOLR_PORT: 8985
DATABASE_URL: postgresql://[email protected]/circle_test # Hard-coded with data from CircleCI orb, related to https://github.com/samvera-labs/samvera-circleci-orb/issues/42
KARMA_BROWSER: ChromeHeadlessCustom
RAILS_ROOT: .internal_test_app
SPEC_OPTS: "" # Clear output conflicts between samvera orb executor and ruby orb rspec command
steps:
- attach_workspace:
at: ~/
- run:
name: Install system dependencies
command: |
sudo apt-get update
sudo apt-get install imagemagick librsvg2-bin lsof
- browser-tools/install-chrome
- browser-tools/install-chromedriver
name: yarn
command: cd /app/samvera/hyrax-engine && yarn
- run:
name: Check Chrome install
name: Create solr core
command: |
google-chrome --version
chromedriver --version
- restore_cache:
keys:
- engine-node-v1-{{ checksum "package.json" }}
# Call yarn directly for hyrax engine; node orb demands a lockfile to use caching
- run:
name: Yarn Install (engine)
command: yarn install
- save_cache:
key: engine-node-v1-{{ checksum "package.json" }}
paths:
- node_modules
- samvera/install_solr_core:
solr_config_path: .internal_test_app/solr/conf
- samvera/install_solr_core:
solr_config_path: .internal_test_app/solr/conf
core_name: hyrax-valkyrie-test
# Rerun bundler in case this is a different ruby version than bundle and build steps
- samvera/bundle:
ruby_version: << parameters.ruby_version >>
bundler_version: << parameters.bundler_version >>
# Ensure gems needed by the test app are installed
- ruby/install-deps:
app-dir: .internal_test_app
- node/install-packages:
pkg-manager: yarn
app-dir: .internal_test_app
- run:
command: bundle exec rake db:migrate
working_directory: .internal_test_app
- ruby/rspec-test
- store_artifacts:
path: Gemfile.lock
destination: engine-gemfile-lock
- store_artifacts:
path: .internal_test_app/Gemfile.lock
destination: webapp-gemfile-lock
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

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"
requires:
- build
ruby2-7:
jobs:
- bundle:
ruby_version: "2.7.8"
rails_version: "6.1.7.4"
bundler_version: "2.4.15"
- build:
ruby_version: "2.7.8"
rails_version: "6.1.7.4"
bundler_version: "2.4.15"
requires:
- bundle
- test:
name: "ruby2-7"
ruby_version: "2.7.8"
bundler_version: "2.4.15"
requires:
- build
- test:
name: "ruby2-7-valkyrie"
ruby_version: "2.7.8"
bundler_version: "2.4.15"
hyrax_valkyrie: "true"
hyrax_app: "dassie"
hyrax_valkyrie: "1"
requires:
- build
- dassie-build
4 changes: 3 additions & 1 deletion .dassie/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ FCREPO_HOST=fcrepo
FCREPO_PORT=8080
FCREPO_REST_PATH=rest
FCREPO_TEST_BASE_PATH=/test
FITS_SERVLET_URL=http://fits:8080/fits
HUB_URL=http://chrome:4444/wd/hub
HYRAX_ANALYTICS=false
HYRAX_ANALYTICS_PROVIDER=google
HYRAX_DERIVATIVES_PATH=/app/samvera/hyrax-webapp/derivatives/
HYRAX_ENGINE_PATH=/app/samvera/hyrax-engine
HYRAX_UPLOAD_PATH=/app/samvera/hyrax-webapp/uploads/
IN_DOCKER=true
KARMA_BROWSER=ChromiumHeadlessCustom
KARMA_BROWSER=remote-chromium
KARMA_HOSTNAME=app
MEMCACHED_HOST=memcached
RACK_ENV=development
RAILS_ENV=development
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
4 changes: 3 additions & 1 deletion .dassie/config/initializers/hyrax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
config.work_requires_files = false
config.citations = true

config.characterization_options = { ch12n_tool: ENV.fetch('CH12N_TOOL', 'fits').to_sym }

# Returns a URL that resolves to an image provided by a IIIF image server
config.iiif_image_url_builder = lambda do |file_id, base_url, size, format|
Riiif::Engine.routes.url_helpers.image_url(file_id, host: base_url, size: size)
Expand All @@ -40,7 +42,7 @@
config.browse_everything = nil
end

# config.geonames_username = ''
config.geonames_username = ENV['GEONAMES_USERNAME'] || ''

##
# Set the system-wide virus scanner
Expand Down
Loading

0 comments on commit 596a24f

Please sign in to comment.