make sure chrome install path is in PATH #43
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Run Tests | |
on: | |
push: | |
jobs: | |
lint: | |
if: false | |
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 | |
zookeeper: | |
image: bitnami/zookeeper:3.9 | |
ports: | |
- 2181:2181 | |
env: | |
ZOO_SERVER_ID: 1 | |
ALLOW_ANONYMOUS_LOGIN: yes | |
ZOO_SERVERS: zookeeper:2888:3888 | |
ZOO_4LW_COMMANDS_WHITELIST: srvr,mntr,conf,ruok | |
solr: | |
image: bitnami/solr:8.11.2 | |
ports: | |
- 8983:8983 | |
env: | |
SOLR_ADMIN_USERNAME: solr_admin | |
SOLR_ADMIN_PASSWORD: solr_password | |
SOLR_CLOUD_BOOTSTRAP: yes | |
SOLR_ENABLE_AUTHENTICATION: yes | |
SOLR_ENABLE_CLOUD_MODE: yes | |
SOLR_HOST: solr | |
SOLR_ZK_HOSTS: zookeeper:2181 | |
env: | |
BUNDLE_WITH: test | |
BUNDLE_PATH: vendor/bundle | |
CAS_BASE_URL: '' | |
CI: 1 | |
FEDORA_TEST_URL: http://fedora:8080/rest | |
IIIF_BASE_URL: http://localhost/iiif/2 | |
NOKOGIRI_USE_SYSTEM_LIBRARIES: true | |
PSQL_PASSWORD: spot_test_pw | |
PSQL_USER: spot_test_user | |
PSQL_DATABASE: spot_test | |
PSQL_HOST: database | |
RAILS_ENV: test | |
SOLR_TEST_URL: http://solr_admin:solr_password@solr:8983/solr/spot-test | |
URL_HOST: http://localhost:3000 | |
steps: | |
- | |
name: Install system dependencies from Dockerfile | |
run: | | |
apt-get update -y && 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 \ | |
build-essential coreutils curl git libpq-dev libxml2 libxml2-dev libxslt-dev \ | |
netcat-openbsd nodejs openssl postgresql-13 ruby-dev tzdata unzip zip | |
- | |
name: Setup Chrome | |
uses: browser-actions/setup-chrome@v1 | |
id: setup-chrome | |
with: | |
install-dependencies: true | |
install-chromedriver: true | |
- | |
name: Get Chrome bin directory | |
id: chrome-bin-directory | |
run: | |
echo "dirname=$(dirname ${{ steps.setup-chrome.outputs.chrome-path }})" >> "$GITHUB_OUTPUT" | |
- | |
name: Checkout code | |
uses: actions/checkout@v4 | |
- | |
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: 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 install | |
- | |
name: Run migrations | |
run: bundle exec rake db:migrate | |
- | |
name: Run tests | |
run: | | |
mkdir /tmp/test-results | |
export PATH="${{ steps.chrome-bin-directory.outputs.dirname }}:$PATH" | |
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 |