Skip to content

Commit

Permalink
Ruby test and lint github action workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
abachman committed Jun 1, 2024
1 parent d92af32 commit 5327cb1
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: "Continuous Integration"

on:
push:
branches: ['main']
pull_request:
types: ['opened', 'reopened', 'synchronize', 'unlocked']

jobs:
ruby-lint:
name: Ruby Lint
runs-on: ubuntu-latest

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

- name: Set up Ruby
uses: ruby/setup-ruby@v1.178.0
with:
ruby-version: '3.2.3'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Ruby Lint
run: bundle exec standardrb --parallel -f github

rails-test:
name: Rails Test
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
ports:
- "5432:5432"
env:
POSTGRES_DB: sif
POSTGRES_USER: sif
POSTGRES_PASSWORD: password
redis:
image: redis:7.0

env:
RAILS_ENV: test
DATABASE_URL: "postgres://sif:password@localhost:5432/sif"
REDIS_URL: "redis://localhost:6379/1"
BROWSERSLIST_IGNORE_OLD_DATA: true

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

- name: Set up Ruby
uses: ruby/setup-ruby@v1.178.0
with:
ruby-version: '3.2.3'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Set up database
run: bin/rails db:setup

- name: Run tests
run: bin/rails test
5 changes: 5 additions & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parallel: true
ruby_version: 3.2

plugins:
- standard-rails
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ group :development, :test do

# a linting tool, to encourage/enforce a consistent code style
gem "standardrb"
gem "standard-rails"
end

group :development do
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ GEM
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.23.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (1.13.0)
rubyzip (2.3.2)
sassc (2.4.0)
Expand Down Expand Up @@ -310,6 +315,9 @@ GEM
standard-performance (1.4.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
standard-rails (1.0.2)
lint_roller (~> 1.0)
rubocop-rails (~> 2.23.1)
standardrb (1.0.1)
standard
stimulus-rails (1.3.3)
Expand Down Expand Up @@ -368,6 +376,7 @@ DEPENDENCIES
selenium-webdriver
shadcn-ui (~> 0.0.12)
sprockets-rails
standard-rails
standardrb
stimulus-rails
turbo-rails
Expand Down

0 comments on commit 5327cb1

Please sign in to comment.