Skip to content

Commit

Permalink
Update rubyonrails.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhamo1107 authored Sep 18, 2024
1 parent 9b024ac commit 441c917
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# 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: "Ruby on Rails CI"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -22,39 +18,60 @@ jobs:
POSTGRES_DB: rails_test
POSTGRES_USER: rails
POSTGRES_PASSWORD: password
options: >-
--health-cmd "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"

steps:
- name: Checkout code
uses: actions/checkout@v4
# Add or replace dependency steps here

- name: Install Ruby and gems
uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1 # Make sure to use the Ruby version you need
bundler-cache: true
# Add or replace database setup steps here
- name: Set up database schema
run: bin/rails db:schema:load
# Add or replace test runners here

- name: Ensure Rails binstubs are executable
run: chmod +x bin/rails bin/rake

- name: Set up database
run: |
bin/rails db:prepare
- name: Run tests
run: bin/rake

lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Ruby and gems
uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true

- name: Ensure binstubs are executable
run: chmod +x bin/bundler-audit bin/brakeman bin/rubocop

- name: Generate binstubs
run: bundle binstubs bundler-audit brakeman rubocop
# Add or replace any other lints here

- name: Security audit dependencies
run: bin/bundler-audit --update

- name: Security audit application code
run: bin/brakeman -q -w2

- name: Lint Ruby files
run: bin/rubocop --parallel

0 comments on commit 441c917

Please sign in to comment.