Merge pull request #466 from metikular/dependabot/bundler/rspec-rails… #941
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 all tests | |
on: [push] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Pull repository | |
uses: actions/checkout@v4 | |
- name: Bundle install and cache result | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Run Ruby lint | |
run: bundle exec standardrb | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
database_url: | |
- postgresql://postgres:postgres@localhost/coupon_store_test | |
- sqlite3:db/data/coupons.sqlite3 | |
services: | |
postgres: | |
image: postgres:16-alpine | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Pull repository | |
uses: actions/checkout@v4 | |
- name: Bundle install and cache result | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Run rspec | |
run: | | |
export DATABASE_URL=${{ matrix.database_url }} | |
bundle exec rails db:create | |
bundle exec rails db:schema:load >/dev/null | |
RAILS_ENV=test bundle exec rails assets:precompile | |
bundle exec rails spec | |
- name: Upload screenshots of failures | |
uses: actions/[email protected] | |
if: ${{ failure() }} | |
with: | |
name: capybara-screenshots-${{ github.sha }} | |
path: tmp/capybara/screenshot_* | |
retention-days: 30 |