Prepare for heroku-24 #4220
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: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ '**' ] | |
env: | |
# these are all referenced in our app's database.yml for test | |
POSTGRES_HOST: localhost | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
jobs: | |
tests: | |
services: | |
db: | |
image: postgres:14.3 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: ['5432:5432'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
# should take ruby version from .ruby-version, | |
# bundler-cache should be save to use cause we | |
# have a checked in Gemfile.lock | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: 'pip' | |
- name: Install python dependencies | |
run: pip install -r requirements.txt | |
- name: Install apt dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install libvips-tools ffmpeg mediainfo tesseract-ocr qpdf imagemagick exiftool poppler-utils ghostscript | |
# GitHub Actions VMs come with a pre-installed version of node.js - as of early 2024, 18.19.1. | |
# See package.json under key "engines", which lists allowed versions of node and yarn. | |
- name: Set up app | |
run: | | |
RAILS_ENV=test bundle exec rails db:test:prepare | |
yarn install | |
# This cache probably doesn't actually save us any time, but it hopes to save | |
# us being throttled by apache foundation servers unhappy that solr_wrapper | |
# is downloading solr over and over again. | |
- name: Cache solr install | |
uses: actions/cache@v3 | |
with: | |
# these paths specified in .solr_wrapper.yml: | |
path: | | |
tmp/solr_dist | |
key: ${{ runner.os }}-solr-${{ hashFiles('.solr_wrapper.yml') }} | |
- name: Start test Solr | |
env: | |
RAILS_ENV: test | |
run: | | |
bundle exec rake solr:start | |
- name: Run tests | |
run: | | |
bundle exec rspec | |
- name: Archive capybara failure screenshots | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: dist-without-markdown | |
path: tmp/capybara/*.png | |
if-no-files-found: ignore | |