Skip to content

Merge pull request #1458 from common-group/hotfix/footer-link #1843

Merge pull request #1458 from common-group/hotfix/footer-link

Merge pull request #1458 from common-group/hotfix/footer-link #1843

name: Catarse CI (back-end)
on: push
defaults:
run:
working-directory: ./services/catarse
jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: ./services/catarse
- name: Analyze code
run: bundle exec rubocop
brakeman:
name: Brakeman
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: ./services/catarse
- name: Install brakeman
run: gem install brakeman
- name: Scan code
run: brakeman -A -z -q
rspec:
name: RSpec
runs-on: ubuntu-20.04
needs: ['rubocop', 'brakeman']
env:
DATABASE_URL: postgres://postgres:example@localhost:5432/catarse_test
services:
postgres:
image: postgres:11.5
ports: ['5432:5432']
env:
POSTGRES_DB: catarse_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: example
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
# ruby-version: 3.0.0 # detects from .ruby-version or .tool-versions
# bundler: 2.2.8 # detects from BUNDLED_WITH from Gemfile.lock
bundler-cache: true # runs bundle install and caches gem automatically
working-directory: ./services/catarse # path to detect .ruby-version, .tool-versions, Gemfile and Gemfile.lock
- name: Install postgres client dependencies
run: sudo apt-get install libpq-dev
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 14.16.0
- name: Yarn package cache
uses: actions/cache@v2
with:
path: ./services/catarse/catarse.js/node_modules
key: ${{ runner.os }}-yarn-v2-${{ hashFiles('./services/catarse/catarse.js/yarn.lock') }}
- name: Install Yarn packages
run: |
yarn policies set-version
yarn install --pure-lockfile
- name: Create database
run: |
RAILS_ENV=test bundle exec rails db:create
RAILS_ENV=test bundle exec rails db:migrate
- name: Run tests
run: bundle exec rspec spec --format progress