Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor lint/tests to run with github actions #1116

Merged
merged 85 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
002ef24
first pass @ lint
rococodogs Mar 8, 2024
681bed3
check compose version
rococodogs Mar 8, 2024
b357cbb
whoops
rococodogs Mar 8, 2024
a3f9b57
put off docker compose until we can use our new .envs
rococodogs Mar 10, 2024
fedc649
install test gems
rococodogs Mar 10, 2024
3979092
whoops
rococodogs Mar 10, 2024
ecf90c1
use bundler-cache to kick off install
rococodogs Mar 10, 2024
4e710c7
pull circleci config
rococodogs Mar 26, 2024
d1410e7
restore circleci job to be noop
rococodogs Apr 23, 2024
d0aeea1
fix circleci
rococodogs Apr 23, 2024
37e4638
once more
rococodogs Apr 23, 2024
4e1d44d
🙃
rococodogs Apr 23, 2024
210bd10
start breaking out test job
rococodogs May 1, 2024
42f1609
first pass @ running tests
rococodogs Jun 21, 2024
6447bf6
solr first pass
rococodogs Jul 11, 2024
3c7d7cf
fix solr config path
rococodogs Aug 21, 2024
ad2a7f2
run test in ubuntu container to access network
rococodogs Aug 21, 2024
d454b86
install system dependencies first
rococodogs Aug 21, 2024
100dd5f
sudo not found?
rococodogs Aug 21, 2024
32a7eda
split build into its own step
rococodogs Aug 21, 2024
1015548
fix needs
rococodogs Aug 21, 2024
8dcceb8
update apt
rococodogs Aug 21, 2024
43c16cc
🙃
rococodogs Aug 21, 2024
5e624fc
ok let's try using the dockerfile setup
rococodogs Aug 21, 2024
3a06de7
split rubo into its own :lint group
rococodogs Aug 21, 2024
2f9809b
try that manually
rococodogs Aug 21, 2024
348f8ca
cache lint gems
rococodogs Aug 21, 2024
e7d8f5d
it's always that one character
rococodogs Aug 21, 2024
f33d383
ok maybe we need to be explicit
rococodogs Aug 21, 2024
df4fd3a
try setting up the services before the app
rococodogs Aug 21, 2024
ef14151
install chrome dependencies
rococodogs Aug 21, 2024
91dc99b
enable cloud mode for solr
rococodogs Aug 21, 2024
9f3ad47
*sigh* let's try this again
rococodogs Aug 21, 2024
ac2f795
we're really not including curl with coreutils ok
rococodogs Aug 21, 2024
c354427
try solr using bitnami example config
rococodogs Aug 21, 2024
1353d55
add solr auth
rococodogs Aug 21, 2024
4d4ac3f
*sigh* guess we need node after all
rococodogs Aug 21, 2024
62483e6
skip lint while troubleshooting testsa
rococodogs Aug 21, 2024
e7b6757
postgres :(
rococodogs Aug 21, 2024
78d86c1
whoops
rococodogs Aug 21, 2024
34f1b04
try starting zookeeper before solr
rococodogs Aug 21, 2024
68d2be1
make sure chrome install path is in PATH
rococodogs Aug 21, 2024
d5d1a6a
try using WD_CHROME_PATH for webdrivers
rococodogs Aug 21, 2024
c63e7b2
try stable channel of chrome
rococodogs Aug 21, 2024
52553a0
restore lint check
rococodogs Aug 22, 2024
0375964
add code coverage report
rococodogs Aug 22, 2024
63d69d8
some niceties
rococodogs Aug 22, 2024
1a9e9c9
add titles
rococodogs Aug 22, 2024
8552ac6
clear out old (unused) tools
rococodogs Aug 22, 2024
0138d3a
use ruby/setup-ruby action for gems
rococodogs Aug 22, 2024
93f91b7
remove dev seeds for now
rococodogs Aug 22, 2024
e3c8a10
revert :lint group changes
rococodogs Aug 22, 2024
763850d
revert gem install on test to our own caching
rococodogs Aug 23, 2024
6575f38
put bundle config at the top of test
rococodogs Aug 23, 2024
bd38965
update Gemfile.lock
rococodogs Aug 23, 2024
c763dee
add firefox to gha
rococodogs Aug 23, 2024
09d9581
use firefox / silence deprecations / rubo github output
rococodogs Aug 26, 2024
06b597b
only require rspec-github if in CI
rococodogs Aug 26, 2024
645c81a
newline
rococodogs Aug 26, 2024
9baccba
omfg rubo
rococodogs Aug 26, 2024
c1e0557
try using firefox latest-esr
rococodogs Aug 26, 2024
630b6a0
add gtk3 package for firefox
rococodogs Aug 26, 2024
ecc21f2
libgtk-3-0
rococodogs Aug 26, 2024
a5ed997
install recommends why not?
rococodogs Aug 26, 2024
4ef5525
fingers crossed
rococodogs Aug 26, 2024
85c6618
.....
rococodogs Aug 26, 2024
0791f8d
fix rspec-github
rococodogs Aug 26, 2024
e12cb16
silence all warnings in CI runs via env
rococodogs Aug 27, 2024
457e273
add geckodriver
rococodogs Aug 28, 2024
3d91b29
add geckodriver to PATH
rococodogs Aug 28, 2024
357d2c2
i guess setup-geckodriver doesn't have exports
rococodogs Aug 28, 2024
31bc2f5
maybe rspec-github isn't worth it
rococodogs Aug 29, 2024
3e48bad
sigh
rococodogs Aug 29, 2024
3f25891
let's try
rococodogs Sep 3, 2024
c636274
i can't say the deprecation hiding was doing anything
rococodogs Sep 3, 2024
ab4a9ec
build 'develop' images on PR merge
rococodogs Sep 3, 2024
fcd9aac
run lint_and_test before the release process
rococodogs Sep 3, 2024
d21326c
don't run lint_and_test twice for prereleases
rococodogs Sep 3, 2024
2565c07
try triggering reusable workflow on push as separate workflow
rococodogs Sep 3, 2024
aeefaf1
use branches-ignore
rococodogs Sep 3, 2024
bdb35e2
?
rococodogs Sep 3, 2024
6b1d8b9
how about... ?
rococodogs Sep 3, 2024
066f565
permissions
rococodogs Sep 3, 2024
9a2c67c
delete caches after closing branch
rococodogs Sep 3, 2024
21147b4
names
rococodogs Sep 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 6 additions & 204 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,213 +1,15 @@
version: 2.1
orbs:
browser-tools: circleci/[email protected]

executors:
ruby:
docker:
- image: cimg/ruby:2.7.8-browsers
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
working_directory: ~/spot
environment:
BUNDLE_PATH: vendor/bundle

application:
docker:
- image: cimg/ruby:2.7.8-browsers
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
- image: cimg/redis:6.2
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
- image: postgres:13-alpine
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
environment:
POSTGRES_USER: spot_dev_user
POSTGRES_PASSWORD: password
POSTGRES_DB: spot_test
- image: samvera/fcrepo4:4.7.5
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: solr:8.11.2
environment:
SOLR_AUTH_TYPE: basic
SOLR_AUTHENTICATION_OPTS: "-Dbasicauth=solr:SolrRocks"
command: |
bash -c 'bin/solr start -cloud -p 8983 && bin/solr auth enable -credentials solr:SolrRocks && bin/solr stop && solr-foreground -cloud -p 8983'
working_directory: ~/spot
environment:
BUNDLE_PATH: vendor/bundle
CAS_BASE_URL: http://localhost
CI: 1
FEDORA_TEST_URL: http://localhost:8080/rest
IIIF_BASE_URL: http://localhost/iiif/2
RAILS_ENV: test
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
PSQL_DATABASE: spot_test
PSQL_USER: spot_dev_user
PSQL_PASSWORD: password
SOLR_TEST_URL: http://solr:SolrRocks@localhost:8983/solr/spot-test
URL_HOST: http://localhost

jobs:
bundle:
executor: ruby
steps:
- checkout
- restore_cache:
name: Restore cached bundle
key: spot-gems-{{ checksum "Gemfile.lock" }}
- restore_cache:
name: Restore cached node_modules
key: spot-node_modules-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies (ruby)
command: bundle check || bundle install
- run:
name: Install dependencies (js)
command: yarn install
- save_cache:
name: Store cache of bundle
key: spot-gems-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- save_cache:
name: Store cache of node_modules
key: spot-node_modules-{{ checksum "yarn.lock" }}
paths:
- node_modules
- persist_to_workspace:
root: ~/
paths:
- spot/*
- spot/**/*

lint:
executor: ruby
steps:
- attach_workspace:
at: ~/
- run:
name: Fine, we'll install bundler again
command: gem install bundler
- run:
name: Get 'em Rubocop!
command: (bundle check || bundle install) && bundle exec rubocop

test:
executor: application
parallelism: 4
steps:
- attach_workspace:
at: ~/

# install dependencies
- run:
name: Install Postgres 13
command: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
curl -s https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql-13

- browser-tools/install-firefox
- browser-tools/install-geckodriver

# start firefox
- run:
name: Start headless Firefox browser
command: firefox --headless --remote-debugging-port=9222 http://localhost &

- run:
name: Make sure dependencies are valid
command: |
gem install bundler:1.16.1
bundle check || bundle install

- run:
name: Load config into Solr
command: |
cd docker/solr/config
zip -1 spot_solr_config.zip ./*
curl --user solr:SolrRocks -H "Content-type: application/octet-stream" --data-binary @spot_solr_config.zip "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=spot"
curl --user solr:SolrRocks -H "Content-type: application/json" http://localhost:8983/api/collections/ -d "{create: {name: spot-test, config: spot, numShards: 1}}"

- 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

- run:
name: Run RSpec tests
command: |
bundle exec rake db:migrate
mkdir /tmp/test-results
./cc-test-reporter before-build
bundle exec rspec \
--backtrace \
--format RspecJunitFormatter \
--out /tmp/test-results/rspec.xml \
--format progress\
-- \
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)

- run:
name: Code Climate test coverate
command: |
./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"

- persist_to_workspace:
root: coverage
paths:
- codeclimate.*.json

- store_test_results:
path: /tmp/test-results

- store_artifacts:
path: /tmp/test-results
destination: test-results

upload-coverage:
executor: ruby
echo_skip:
docker:
- image: cimg/base:current
steps:
- attach_workspace:
at: ~/spot
- 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
- run:
command: |
./cc-test-reporter sum-coverage --output - codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
command: echo "skipping circleci tests"

workflows:
version: 2
ci:
noop:
jobs:
- bundle:
context:
- dss-docker-auth
- lint:
context:
- dss-docker-auth
requires:
- bundle
- test:
context:
- dss-docker-auth
requires:
- lint
- upload-coverage:
context:
- dss-docker-auth
requires:
- test
- echo_skip
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
!/vendor/.keep

# allow files @ app root
!.env.development
!.rspec
!.rubocop.yml
!.rubocop_todo.yml
!.scss-lint.yml
!config.ru
!Gemfile
!Gemfile.lock
Expand Down
Loading
Loading