Skip to content

Commit

Permalink
ci: add ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
FlandreDaisuki committed Oct 22, 2024
1 parent c15b8dc commit 39464f8
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

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
env:
RAILS_ENV: test
with:
ruby-version: .ruby-version
bundler-cache: true

- name: Scan for common Rails security vulnerabilities using static analysis
run: bin/brakeman --no-pager

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

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


- name: Lint code for consistent style
run: bin/rubocop -f github

rspec_test:
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: Run rspec
env:
RAILS_ENV: test
run: bundle exec rspec
8 changes: 7 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ gem 'rack-cors'

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i[mri windows]
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"

# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem "brakeman", require: false

# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false
end

group :development do
Expand Down
20 changes: 20 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ GEM
bindex (0.8.1)
bootsnap (1.18.3)
msgpack (~> 1.2)
brakeman (6.2.2)
racc
builder (3.3.0)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
Expand Down Expand Up @@ -262,6 +264,22 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.26.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
ruby-progressbar (1.13.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -317,6 +335,7 @@ PLATFORMS
DEPENDENCIES
bcrypt (~> 3.1.7)
bootsnap
brakeman
debug
htmlbeautifier (~> 1.4)
importmap-rails
Expand All @@ -331,6 +350,7 @@ DEPENDENCIES
rspec-rails (~> 6.1)
rswag (~> 2.13)
rubocop (~> 1.64)
rubocop-rails-omakase
sprockets-rails
stimulus-rails
tailwindcss-rails
Expand Down

0 comments on commit 39464f8

Please sign in to comment.