Skip to content

Report

Report #196

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
name: Ruby
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master", "develop" ]
permissions:
contents: read
jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0
- name: rubocop
uses: reviewdog/action-rubocop@v2.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
rubocop_version: gemfile
reporter: github-pr-check
unit_tests:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres:14.9
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Ruby 3.0.2
id: ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.2
bundler-cache: true
- name: Install required package
run: |
sudo apt-get update
sudo apt-get -yqq install libpq-dev
- name: Create DB
env:
RACK_ENV: test
DATABASE_URL: postgres://postgres:postgres@127.0.0.1
run: |
cp database_template.yml config/database.yml
cp db/schema.rb db/schema.rb.bak
bundle exec rake db:migrate:reset
if ! cmp db/schema.rb db/schema.rb.bak >/dev/null 2>&1; then
echo 'Your db/schema.rb differs from the schema generated by the migrations.'
echo 'Use "DATABASE=migrations bundle exec rake db:migrate:reset" to regenerate the schema.'
diff db/schema.rb db/schema.rb.bak
exit 1
fi
- name: Run specs
run: |
cp config_template.yml config.yml
bundle exec rspec -f j -o tmp/rspec_results.json -f p
- name: RSpec Report
uses: SonicGarden/rspec-report-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: 'Unit tests'
json-path: tmp/rspec_results.json
if: always()