Skip to content

Commit

Permalink
Set up CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Bot committed Jul 30, 2023
1 parent b615b11 commit 740dbb5
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: .github/workflows/verify.yml

on: [push]

jobs:
#
#
# Unit Tests
#
#
unit_tests:
runs-on: ubuntu-latest

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Install PostgreSQL client
run: |
sudo apt-get -yqq install libpq-dev
- name: Build App
env:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
RAILS_ENV: test
run: |
bin/rails db:setup
- name: Prep assets
env:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
RAILS_ENV: test
run: |
bundle install && yarn install && yarn build:css && yarn build
- name: Execute unit tests
env:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
RAILS_ENV: test
run: |
./bin/rails test
#
#
# Rubocop
#
#
rubocop:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1

- name: Run rubocop
run: |
gem install rubocop
rubocop app/
#
#
# Reek
#
#
reek:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1

- name: Run Reek
run: |
gem install reek
reek app/
32 changes: 32 additions & 0 deletions .reek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
detectors:
IrresponsibleModule:
enabled: false
DuplicateMethodCall:
enabled: false

exclude_paths:
- ./**/example*

# from https://github.com/troessner/reek#working-with-rails
directories:
"app/controllers":
IrresponsibleModule:
enabled: false
NestedIterators:
max_allowed_nesting: 2
UnusedPrivateMethod:
enabled: false
InstanceVariableAssumption:
enabled: false
"app/helpers":
IrresponsibleModule:
enabled: false
UtilityFunction:
enabled: false
"app/mailers":
InstanceVariableAssumption:
enabled: false
"app/models":
InstanceVariableAssumption:
enabled: false
# from https://github.com/troessner/reek#working-with-rails
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
inherit_from: .rubocop_todo.yml
Style/Documentation:
Enabled: false
95 changes: 95 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-07-30 00:15:29 UTC using RuboCop version 1.55.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: around, only_before
Layout/EmptyLinesAroundAccessModifier:
Exclude:
- 'app/controllers/examples_controller.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: normal, indented_internal_methods
Layout/IndentationConsistency:
Exclude:
- 'app/controllers/examples_controller.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Width, AllowedPatterns.
Layout/IndentationWidth:
Exclude:
- 'app/controllers/examples_controller.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Layout/SpaceInsidePercentLiteralDelimiters:
Exclude:
- 'app/controllers/examples_controller.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/RedundantCopDisableDirective:
Exclude:
- 'app/models/experiment.rb'

# Offense count: 6
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'app/controllers/examples_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/examples_helper.rb'
- 'app/mailers/application_mailer.rb'
- 'app/models/application_record.rb'
- 'app/models/user.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Exclude:
- 'app/controllers/examples_controller.rb'

# Offense count: 14
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'app/channels/application_cable/channel.rb'
- 'app/channels/application_cable/connection.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/examples_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/examples_helper.rb'
- 'app/jobs/application_job.rb'
- 'app/mailers/application_mailer.rb'
- 'app/models/application_record.rb'
- 'app/models/example.rb'
- 'app/models/user.rb'
- 'app/views/examples/_example.json.jbuilder'
- 'app/views/examples/index.json.jbuilder'
- 'app/views/examples/show.json.jbuilder'

# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'app/controllers/examples_controller.rb'
- 'app/mailers/application_mailer.rb'
- 'app/views/examples/index.json.jbuilder'
- 'app/views/examples/show.json.jbuilder'

0 comments on commit 740dbb5

Please sign in to comment.