znamenica/allslavic

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
# 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 install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "CI"
on:
   push:
      branches: [ "master" ]
   pull_request:
      branches: [ "master" ]
env:
   REDIS_URL: "redis://localhost:6379"
   RAILS_RESQUE_REDIS: "localhost:6379"
jobs:
   test:
      runs-on: ubuntu-latest
      strategy:
         matrix:
            redis-version: [6]
      services:
         postgres:
            image: postgres:11-alpine
            ports:
               - "5432:5432"
            env:
               POSTGRES_DB: allslavic_test
               POSTGRES_USER: allslavic
               POSTGRES_PASSWORD: allslavic
      env:
         RAILS_ENV: test
         DATABASE_URL: "postgres://allslavic:allslavic@localhost:5432/allslavic_test"
      steps:
       - name: Checkout code
         uses: actions/checkout@v3
           #- name: Install RVM
           #uses: rvm/ubuntu_rvm
           #- name: Install ruby
           #run: rvm install 3.1.2
       - name: Start Redis
         uses: supercharge/redis-github-action@1.4.0
         with:
            redis-version: ${{ matrix.redis-version }}
       - name: Install Ruby and gems
         uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa
         with:
            bundler-cache: true
       # Add or replace database setup steps here
       - name: Set up database schema
         run: bundle exec rake db:create db:migrate
       # Add or replace test runners here
       - name: Run tests
         run: bundle exec rake

   lint:
      runs-on: ubuntu-latest
      steps:
       - name: Checkout code
         uses: actions/checkout@v3
       - name: Install Ruby and gems
         uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa
         with:
            bundler-cache: true
       # Add or replace any other lints here
       - name: Security audit dependencies
         run: bundle exec bundle-audit --update
       - name: Security audit application code
         run: bundle exec brakeman -q -w2