.github/workflows/specs.yml
name: Specs and Percy
on: [push] # push OR PR
env:
RAILS_ENV: test
RUBYOPT: --yjit
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
MORPHSVG: ${{ secrets.MORPHSVG }}
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false # let both suites run to completion
matrix:
include:
- name: Normal Specs
command: bundle exec rspec --exclude-pattern "spec/features/**/*_spec.rb"
morph: false
- name: Feature Specs & Percy
command: npx percy exec -- bundle exec rspec --pattern "spec/features/**/*_spec.rb"
morph: true
steps:
- name: Installing apt dependencies
run: |
sudo add-apt-repository ppa:chris-needham/ppa
sudo apt-get update
sudo apt-get install libvips libvips-dev audiowaveform rustc # libexpat1-dev gettext libglib2.0-dev liborc-0.4-dev libfftw3-dev liblcms2-dev libmagickwand-dev libopenexr-dev libcfitsio-dev libgif-dev libgsf-1-dev libmatio-dev libopenslide-dev libpango1.0-dev libpoppler-glib-dev librsvg2-dev libwebp-dev
vips --version
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/packs-test
tmp/webpacker
./node_modules/
key: ${{ runner.os }}-yarn6-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn6-
- name: Set up Ruby and Bundle Install
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.0
bundler-cache: true
- name: Yarn install
run: yarn install
if: steps.yarn-cache.outputs.cache-hit != 'true'
- name: Put MorphSVGPlugin.js in place for feature specs
run: |
printf "%s" "$MORPHSVG" > "app/javascript/animation/MorphSVGPlugin.js"
if: ${{ matrix.morph }}
- name: Start db, copy config, setup db
run: |
sudo systemctl start mysql.service
bin/rails setup:copy_config setup:touch_js db:drop db:create db:schema:load
- name: ${{ matrix.name }}
run: ${{ matrix.command }}
# deploy:
# runs-on: ubuntu-20.04
# needs: test
# if: github.ref == 'refs/heads/master'
# steps
# - uses: actions/checkout@v2
# - name: Deploy