Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 98 additions & 46 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,130 @@
# 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:
# scan_ruby:
# runs-on: ubuntu-latest

# steps:
# - name: Checkout code
# uses: actions/checkout@v6

# - name: Set up Ruby
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: .ruby-version
# bundler-cache: true

# - name: Scan for common Rails security vulnerabilities using static analysis
# run: bin/brakeman --no-pager
# - name: Security audit dependencies
# run: bin/bundler-audit --update

scan_js:
runs-on: ubuntu-latest

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

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
cache-version: 1 # Increment this to clear cache if needed
- name: Unfreeze Bundler for Dependabot
if: github.actor == 'dependabot[bot]'
run: bundle config set frozen false

- name: Scan for security vulnerabilities in JavaScript dependencies
run: bin/importmap audit

lint_ruby:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
cache-version: 1 # Increment this to clear cache if needed
- name: Unfreeze Bundler for Dependabot
if: github.actor == 'dependabot[bot]'
run: bundle config set frozen false

- name: Lint code for consistent style
run: bundle exec standardrb
# Add or replace any other linters here
# - name: Reek
# run: bundle exec reek

test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
image: postgres:11-alpine
ports:
- "5432:5432"
env:
POSTGRES_DB: rails_test
POSTGRES_USER: rails
POSTGRES_PASSWORD: password
# redis:
# image: redis
# ports:
# - 6379:6379
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips imagemagick sqlite3

- name: Checkout code
uses: actions/checkout@v6
# Add or replace dependency steps here
- name: Unfreeze Bundler for Dependabot
if: github.actor == 'dependabot[bot]'
run: bundle config set frozen false
- name: Install Ruby and gems

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
cache-version: 1 # Increment this to clear cache if needed
# Add or replace database setup steps here
- name: Set up database schema
run: bin/rails db:schema:load
- name: Unfreeze Bundler for Dependabot
if: github.actor == 'dependabot[bot]'
run: bundle config set frozen false

# Add or replace test runners here
- name: Run tests
run: bundle exec rspec
- name: Run testsgb
env:
RAILS_ENV: test
# REDIS_URL: redis://localhost:6379/0
run: bin/rails db:schema:load && bundle exec rspec

- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v7
if: failure()
with:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore

check_seeds:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
services:
postgres:
image: postgres:16-alpine
image: postgres:11-alpine
ports:
- "5432:5432"
env:
Expand All @@ -62,41 +137,18 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v6

# Add or replace dependency steps here
- name: Unfreeze Bundler for Dependabot
if: github.actor == 'dependabot[bot]'
run: bundle config set frozen false
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
cache-version: 1 # Increment this to clear cache if needed
- name: Unfreeze Bundler for Dependabot
if: github.actor == 'dependabot[bot]'
run: bundle config set frozen false
# Add or replace database setup steps here
- name: Set up database schema
run: bin/rails db:schema:load
- name: Check Seeds
run: bundle exec rake db:seed

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
# Add or replace dependency steps here
- name: Unfreeze Bundler for Dependabot
if: github.actor == 'dependabot[bot]'
run: bundle config set frozen false
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
cache-version: 1 # Increment this to clear cache if needed
- name: Standard RB
run: bundle exec standardrb
# #Add or replace any other lints here
# - name: Reek
# run: bundle exec reek
# - name: Security audit dependencies
# run: bin/bundler-audit --update
# - name: Security audit application code
# run: bin/brakeman -q -w2
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ GEM
prism (>= 1.3.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.19.8)
json (2.19.9)
language_server-protocol (3.17.0.5)
launchy (3.1.1)
addressable (~> 2.8)
Expand Down Expand Up @@ -517,8 +517,8 @@ GEM
logger
sexp_processor (4.17.5)
shellany (0.0.1)
shoulda-matchers (7.0.1)
activesupport (>= 7.1)
shoulda-matchers (8.0.1)
activesupport (>= 7.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down Expand Up @@ -755,7 +755,7 @@ CHECKSUMS
importmap-rails (2.2.3) sha256=7101be2a4dc97cf1558fb8f573a718404c5f6bcfe94f304bf1f39e444feeb16a
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
irb (1.18.0) sha256=de9454a0703a54704b9811a5ef31a60c86949fbf4013fcf244fabc7c775248e3
json (2.19.8) sha256=6354310fd76ef69b87d5bd1f38b40d730613baf90b6803d2d0a48f618d32dfaa
json (2.19.9) sha256=9b9025b7cdddafa38d316eca0b2358488e42d417045c1b90d216a9fefe46b79a
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
launchy (3.1.1) sha256=72b847b5cc961589dde2c395af0108c86ff0119f42d4648d25b5440ebb10059e
letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2
Expand Down Expand Up @@ -858,7 +858,7 @@ CHECKSUMS
sentry-ruby (6.6.2) sha256=a64aaf757d10058598fe5871de925b2a5a3d78273feb9bca23fff843accc6cd6
sexp_processor (4.17.5) sha256=ae2b48ba98353d5d465ce8759836b7a05f2e12c5879fcd14d7815b026de32f0e
shellany (0.0.1) sha256=0e127a9132698766d7e752e82cdac8250b6adbd09e6c0a7fbbb6f61964fedee7
shoulda-matchers (7.0.1) sha256=b4bfd8744c10e0a36c8ac1a687f921ee7e25ed529e50488d61b79a8688749c77
shoulda-matchers (8.0.1) sha256=5dbb46e5765b9da225111b085e0819e8c8a121ff94bba430a153eb1ea2c60288
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
Expand Down