.circleci/config.yml
version: 2.1orbs: ruby: circleci/ruby@1.8.0 node: circleci/node@5.0.2jobs: build: resource_class: large parallelism: 4 docker: - image: cimg/ruby:2.7.6-browsers - image: cimg/mysql:5.7.36 environment: MYSQL_DATABASE: circle_ruby_test MYSQL_ROOT_PASSWORD: passw0rd environment: RACK_ENV: test RAILS_ENV: test steps: - checkout - run: mkdir -p test-results test-results/rspec test-results/cucumber - run: gem install bundler -v 1.17.3 - node/install: install-yarn: true node-version: '18.7.0' - ruby/install-deps - node/install-packages: pkg-manager: yarn - run: sudo curl --output /usr/local/bin/phantomjs https://s3.amazonaws.com/circle-downloads/phantomjs-2.1.1; sudo chmod 755 /usr/local/bin/phantomjs - run: |- mkdir -p config && echo 'test: adapter: mysql2 encoding: utf8 host: 127.0.0.1 port: 3306 username: root password: passw0rd database: circle_ruby_test ' > config/database.yml - run: # Our primary container isn't MYSQL so run a sleep command until it's ready. name: Waiting for MySQL to be ready command: | for i in `seq 1 10`; do nc -z 127.0.0.1 3306 && echo Success && exit 0 echo -n . sleep 1 done echo Failed waiting for MySQL && exit 1 - run: command: 'bundle exec rails db:schema:load --trace' - ruby/rspec-test: include: spec/**/*_spec.rb out-path: test-results/rspec - store_test_results: path: test-results/rspec - run: | FEATURE_FILES=$(circleci tests glob "features/**/*.feature" | circleci tests split) if [[ -n "$FEATURE_FILES" ]]; then bundle exec cucumber --format junit --out test-results/cucumber -- ${FEATURE_FILES} fi - store_test_results: path: test-results/cucumber - run: | ETS_PDFS=$(circleci tests glob "db/raw/ets/**/*.pdf" | circleci tests split) bundle exec thor ets_pdf:etl -d ${ETS_PDFS} - run: | RUBOCOP_FILES=$(bundle exec rubocop -L | circleci tests split) bundle exec rubocop -- ${RUBOCOP_FILES} - run: | VIEW_FILES=$(circleci tests glob "app/views/**/*.haml" | circleci tests split) bundle exec haml-lint app/views -- ${VIEW_FILES} - run: | JS_FILES=$(circleci tests glob "app/assets/javascripts/**/*.js" | circleci tests split) yarn run eslint ${JS_FILES}