Skip to content

it's always that one character #30

it's always that one character

it's always that one character #30

Workflow file for this run

name: Lint and Run Tests
on:
push:
jobs:
lint:
runs-on: ubuntu-latest
env:
BUNDLE_WITH: lint
BUNDLE_PATH: vendor/bundle
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
-
name: Restore installed Gems
uses: actions/cache@v4
with:
path: vendor/bundle
key: spot-bundle-lint-${{ hashFiles('Gemfile.lock') }}
-
name: Install gems
run: bundle install
-
name: Run Rubocop
run: bundle exec rubocop --format junit --out rubocop-$(date +'%Y%m%md').xml
-
name: Publish Rubo report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: 'rubocop*.xml'
test:
runs-on: ubuntu-latest
container: ruby:2.7.8-slim-bullseye
needs: lint
services:
database:
image: postgres:13-alpine
ports:
- 5432:5432
env:
POSTGRES_DB: spot_test
POSTGRES_USER: spot_test_user
POSTGRES_PASSWORD: spot_test_pw
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
fedora:
image: samvera/fcrepo4:4.7.5
ports:
- 8080:8080
env:
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'
redis:
image: redis:6.2-alpine
ports:
- 6379:6379
solr:
image: bitnami/solr:8.11.2
ports:
- 8983:8983
env:
SOLR_ADMIN_USERNAME: solr_admin
SOLR_ADMIN_PASSWORD: solr_password
options: --name solr
env:
CAS_BASE_URL: ''
FEDORA_TEST_URL: http://fedora:8080/rest
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
PSQL_PASSWORD: spot_test_pw
PSQL_USER: spot_test_user
PSQL_DATABASE: spot_test
RAILS_ENV: test
SOLR_TEST_URL: http://solr:8983/solr/spot-test
URL: http://localhost:3000
steps:
- uses: actions/checkout@v4
-
name: Install system dependencies from Dockerfile
run: |
apt-get clean && apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update -y && apt-get install -y --no-install-recommends \
awscli build-essential coreutils git libpq-dev libxml2 libxml2-dev libxslt-dev \
netcat-openbsd nodejs openssl ruby-dev tzdata zip
-
name: Restore installed Gems
uses: actions/cache@v4
with:
path: vendor/bundle
key: spot-bundle-${{ hashFiles('Gemfile.lock') }}
-
name: Install gem dependencies
run: |
gem install bundler:$(tail -n 1 Gemfile.lock | sed -e "s/ *//")
BUNDLE_WITH=test BUNDLE_PATH=vendor/bundle bundle install
-
name: Setup Chrome
uses: browser-actions/setup-chrome@v1
-
name: "Restore Solr config.zip from cache"
id: solr-config-cache
uses: actions/cache@v4
with:
path: /tmp/spot_solr_config.zip
key: spot-solr-${{ hashFiles('docker/solr/config') }}
-
name: "Build Solr config.zip"
if: steps.solr-config-cache.outputs.cache-hit != 'true'
run: |
cd docker/solr/config
zip -1 /tmp/spot_solr_config.zip ./*
-
name: Setup Solr core with local configs
run: |
curl --user solr_admin:solr_password -H "Content-type: application/octet-stream" --data-binary @/tmp/spot_solr_config.zip "http://solr:8983/solr/admin/configs?action=UPLOAD&name=spot"
curl --user solr_admin:solr_password -H "Content-type: application/json" http://solr:8983/api/collections/ -d "{create: {name: spot-test, config: spot, numShards: 1}}"
-
name: Run migrations
run: bundle exec rake db:migrate
-
name: Run tests
run: |
mkdir /tmp/test-results
bundle exec rspec --backtrace --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress
-
name: Publish RSpec report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: /tmp/test-results/*.xml