osem-fcy/.github/workflows/spec.yml
Henne Vogelsang 2ddc8c2ea7
Run next-rails specs if PR comes from next-rails
If the source branch of you PR contains the string next-rails,
we run the spec for the next rails version.
2021-08-17 14:16:11 +02:00

56 lines
1.5 KiB
YAML

name: Specs
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
bundler-cache: true
- run: bundle exec rubocop
- run: bundle exec haml-lint app/views
spec:
needs: linters
runs-on: ubuntu-latest
name: spec
env:
OSEM_DB_ADAPTER: sqlite3
RAILS_ENV: test
strategy:
matrix:
suite: [models, features, controllers, ability, leftovers]
steps:
- uses: actions/checkout@v2
- name: Sets env vars for next-rails
run: |
echo "BUNDLE_GEMFILE=Gemfile.next" >> $GITHUB_ENV
echo "BUNDLE_CACHE_PATH=vendor/cache.next" >> $GITHUB_ENV
if: contains(github.head_ref, 'next-rails')
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
bundler-cache: true
- name: Prepare spec
run: |
rm -f osem_test osem_development
bundle exec rake db:setup --trace
bundle exec bin/rails webdrivers:chromedriver:update
- name: spec/${{ matrix.suite }}
run: bundle exec rake spec:${{ matrix.suite }}
- name: coverage upload ${{ matrix.suite }}
uses: codacy/codacy-coverage-reporter-action@master
if: github.ref == 'refs/heads/master'
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/coverage.xml