Skip to content

Add config directory to linter. Format other ruby files #13

Add config directory to linter. Format other ruby files

Add config directory to linter. Format other ruby files #13

Workflow file for this run

name: CI/CD
on:
pull_request:
push:
branches: [main]
jobs:
scan_ruby:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Scan for security vulnerabilities in Ruby dependencies
run: bin/brakeman --no-pager
lint:
runs-on: ubuntu-latest
needs: scan_ruby
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Lint code for consistent style
run: |
bin/bundle exec stree check "{app,config,lib,spec,test}/**/*.rb"
bin/rubocop -f github
test:
runs-on: ubuntu-latest
needs: [scan_ruby, lint]
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips postgresql-client libpq-dev
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Precompile assets
run: bin/bundle exec rake assets:precompile
- name: Run tests
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432
run: |
bin/rails db:test:prepare
bin/rspec
- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: ${{ github.workspace }}/tmp/capybara
if-no-files-found: ignore
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [scan_ruby, lint, test]
steps:
- name: Deploy to Render
env:
deploy_url: ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
run: curl "$deploy_url"