Skip to content

Commit

Permalink
CI enhancements (#532)
Browse files Browse the repository at this point in the history
* Add evil martians' setup for brower tests

* Add standard config for rubocop

* Use double quotes in gemfile

* Add test-prof, update specs setup and add POC system spec

* Fix failing alert specs

* Fix failing message model specs

* Fix failing orgs model specs

* Fix rubocop format offenses, skip failing system spec for refactoring

* Fix autocorrectable offenses; remove unused files

* Update Github actions workflow

* Update rubocop todo

* Update rubocop todo

* Update test_id for home search btn

* Setup node

* Set node minor version

* Upgrade rails minor version (fixes vulnerabilities)

* Remove develop branch
  • Loading branch information
aliciapaz authored Mar 19, 2024
1 parent bdcc9a7 commit ae1f106
Show file tree
Hide file tree
Showing 206 changed files with 2,290 additions and 1,900 deletions.
61 changes: 43 additions & 18 deletions .github/workflows/ruby-ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
name: RubyCI
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, synchronize, reopened, ready_for_review]

env:
# Add secret key to Repository secrets
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test
REDIS_URL: redis://localhost:6379/0

jobs:
rubocop:
name: Rubocop
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run Rubocop
run: |
bundle exec rubocop
security:
name: Security
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run brakeman
run: |
bundle exec brakeman -w3
- name: Run bundler-audit
run: |
bundle exec bundle-audit check --update
tests:
name: Tests
env:
Expand Down Expand Up @@ -44,6 +81,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16.18.1
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -59,20 +99,5 @@ jobs:
bin/yarn install --ignore-engines
- name: Run tests
run: |
bundle exec rspec --fail-fast -exclude-pattern ./spec/system/admin_organization_system_spec.rb
security:
name: Security
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
bundle exec rspec --fail-fast
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run security checks
run: |
bundle exec brakeman -w3 -o tmp/brakeman.html
54 changes: 0 additions & 54 deletions .rubocol.yml

This file was deleted.

29 changes: 24 additions & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
inherit_from: .rubocop_todo.yml
inherit_mode:
merge:
- Exclude

require:
- standard
- standard-custom
- standard-performance
- rubocop-performance
- rubocop-rails

inherit_gem:
standard: config/base.yml
standard-performance: config/base.yml
standard-custom: config/base.yml
standard-rails: config/base.yml

inherit_from:
- .rubocop/rspec.yml
- .rubocop/custom.yml
- .rubocop_todo.yml
- .rubocop/strict.yml

AllCops:
NewCops: enable
Exclude:
- 'db/**/*'
- 'bin/*'
SuggestExtensions: false
TargetRubyVersion: 3.1
1 change: 1 addition & 0 deletions .rubocop/custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Put custom cops here
55 changes: 55 additions & 0 deletions .rubocop/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
require:
- rubocop-rspec

# Disable all cops by default,
# only enable those defined explcitly in this configuration file
RSpec:
Enabled: false

RSpec/Focus:
Enabled: true

RSpec/EmptyExampleGroup:
Enabled: true

RSpec/EmptyLineAfterExampleGroup:
Enabled: true

RSpec/EmptyLineAfterFinalLet:
Enabled: true

RSpec/EmptyLineAfterHook:
Enabled: true

RSpec/EmptyLineAfterSubject:
Enabled: true

RSpec/HookArgument:
Enabled: true

RSpec/HooksBeforeExamples:
Enabled: true

RSpec/ImplicitExpect:
Enabled: true

RSpec/IteratedExpectation:
Enabled: true

RSpec/LetBeforeExamples:
Enabled: true

RSpec/MissingExampleGroupArgument:
Enabled: true

RSpec/ReceiveCounts:
Enabled: true

Capybara/CurrentPathExpectation:
Enabled: true

FactoryBot/AttributeDefinedStatically:
Enabled: true

FactoryBot/CreateList:
Enabled: true
24 changes: 24 additions & 0 deletions .rubocop/strict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Inherit from TODO here to make sure we enforce the rules below
# (and TODO is ignored)
inherit_from:
- ../.rubocop_todo.yml

Lint/Debugger: # don't leave binding.pry
Enabled: true
Exclude: []

RSpec/Focus: # run ALL tests on CI
Enabled: true
Exclude: []

Rails/Output: # Don't leave puts-debugging
Enabled: true
Exclude: []

Rails/FindEach: # each could badly affect the performance, use find_each
Enabled: true
Exclude: []

Rails/UniqBeforePluck: # uniq.pluck and not pluck.uniq
Enabled: true
Exclude: []
Loading

0 comments on commit ae1f106

Please sign in to comment.