Merge pull request #275 from ddemaio/master #305
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: Run Tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
type: [coverage, features, helpers, mailer, models, rubocop] | |
runs-on: ubuntu-latest | |
container: registry.opensuse.org/opensuse/infrastructure/tsp/containers/base:main | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache ruby dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/usr/lib64/ruby/gems/ | |
/usr/bin/ | |
key: ${{ hashFiles('Gemfile.lock') }} | |
- name: Install ruby dependencies | |
run: | | |
gem.ruby2.7 install mini_racer -v 0.6.3 | |
bundler.ruby2.7 install | |
- name: Set up the environment | |
run: | | |
cp config/database.test.yml config/database.yml | |
cp config/site.example.yml config/site.yml | |
bundler.ruby2.7 exec rake db:migrate RAILS_ENV=test | |
- if: ${{ matrix.type == 'rubocop' }} | |
name: Run rubocop | |
run: bundler.ruby2.7 exec rubocop | |
- if: ${{ contains(fromJson('["features", "helpers", "mailer", "models"]'), matrix.type) }} | |
name: Run spec | |
run: bundler.ruby2.7 exec rspec spec/${{ matrix.type }}/ | |
- if: ${{ matrix.type == 'coverage' }} | |
name: Run spec | |
run: bundler.ruby2.7 exec rspec | |
- if: ${{ matrix.type == 'coverage' }} | |
name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} |