diff --git a/.github/workflows/rubyonrails-tests.yml b/.github/workflows/rubyonrails-tests.yml new file mode 100644 index 0000000..0f78eec --- /dev/null +++ b/.github/workflows/rubyonrails-tests.yml @@ -0,0 +1,28 @@ +name: Rails - Install dependencies and run tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + run-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Ruby and install gems + uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e + with: + bundler-cache: true + + - name: Run security checks + run: | + bin/bundler-audit --update + bin/brakeman -q -w2 + + - name: Run tests + run: | + bin/rake diff --git a/Gemfile b/Gemfile index dfbcd19..33c0d88 100644 --- a/Gemfile +++ b/Gemfile @@ -37,6 +37,8 @@ group :test do # Easy installation and use of web drivers to run system tests with browsers gem 'webdrivers' + gem 'brakeman' + gem 'bundler-audit' gem 'factory_bot_rails' gem 'faker' gem 'rexml' # necessary if using ruby 3+ diff --git a/Gemfile.lock b/Gemfile.lock index f0f7c7a..a1dc4f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,7 +70,11 @@ GEM bindex (0.8.1) bootsnap (1.9.1) msgpack (~> 1.0) + brakeman (5.1.1) builder (3.2.4) + bundler-audit (0.9.0.1) + bundler (>= 1.2.0, < 3) + thor (~> 1.0) byebug (11.1.3) capybara (3.35.3) addressable @@ -224,6 +228,8 @@ PLATFORMS DEPENDENCIES active_model_serializers (~> 0.10.0) bootsnap (>= 1.4.4) + brakeman + bundler-audit byebug capybara (>= 3.26) factory_bot_rails diff --git a/bin/brakeman b/bin/brakeman new file mode 100755 index 0000000..4b79003 --- /dev/null +++ b/bin/brakeman @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'brakeman' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("brakeman", "brakeman") diff --git a/bin/bundle-audit b/bin/bundle-audit new file mode 100755 index 0000000..addea6f --- /dev/null +++ b/bin/bundle-audit @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle-audit' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("bundler-audit", "bundle-audit") diff --git a/bin/bundler-audit b/bin/bundler-audit new file mode 100755 index 0000000..3971084 --- /dev/null +++ b/bin/bundler-audit @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundler-audit' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("bundler-audit", "bundler-audit")