Skip to content

Commit

Permalink
Migration from TravisCI to GitHub Actions (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
skalibog authored Nov 3, 2023
1 parent 6f0ac2f commit 8bb0c65
Show file tree
Hide file tree
Showing 24 changed files with 245 additions and 195 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Danger
on: [pull_request]
jobs:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: |
# Personal access token for dangerpr-bot - public, but base64 encoded to avoid tripping up GitHub
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
34 changes: 34 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
entry:
- { ruby: '2.6', mongodb: '4.4', gemfile: 'mongoid_4', bundler: '1.17.3' }
- { ruby: '2.7', mongodb: '4.4', gemfile: 'mongoid_5', bundler: '1.17.3' }
- { ruby: '2.7', mongodb: '4.4', gemfile: 'mongoid_6', bundler: '2.4.19' }
- { ruby: '2.7', mongodb: '4.4', gemfile: 'mongoid_7', bundler: '2.4.19' }
- { ruby: '2.7', mongodb: '4.4', gemfile: 'mongoid_8', bundler: '2.4.19' }
- { ruby: '3.0', mongodb: '4.4', gemfile: 'mongoid_8', bundler: '2.4.19' }
- { ruby: '3.1', mongodb: '4.4', gemfile: 'mongoid_8', bundler: '2.4.19' }
- { ruby: '3.2', mongodb: '4.4', gemfile: 'mongoid_8', bundler: '2.4.19' }
name: test (ruby=${{ matrix.entry.ruby }}, mongodb=${{ matrix.entry.mongodb }}), gemfile=${{ matrix.entry.gemfile }})
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.entry.gemfile }}.gemfile
steps:
- name: Set up MongoDB ${{ matrix.entry.mongodb }}
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.entry.mongodb }}
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler: '${{ matrix.entry.bundler || 1 }}'
bundler-cache: true
- name: Run tests
run: bundle exec rake
20 changes: 20 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Rubocop

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
env:
CI: true
TESTOPTS: "-v"
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 3.2.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true
- name: Run Rubocop
run: bundle exec rubocop --parallel
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Gemfile.lock
gemfiles/*.gemfile.lock
pkg/*
.idea/
.ruby-lsp/
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
AllCops:
NewCops: enable
Exclude:
- vendor/**/*
- bin/**/*
- data/**/*

Metrics:
Enabled: false

Layout/LineLength:
Max: 256

Style/Documentation:
Enabled: false
Expand Down
152 changes: 91 additions & 61 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-08-27 21:16:32 +0200 using RuboCop version 0.52.1.
# on 2023-10-27 14:56:27 UTC using RuboCop version 1.36.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: 6
# Configuration parameters: Include.
# Include: **/Gemfile, **/gems.rb
Bundler/DuplicatedGem:
Exclude:
- 'Gemfile'

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'mongoid-rspec.gemspec'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLineAfterGuardClause:
Exclude:
- 'lib/matchers/allow_mass_assignment.rb'
- 'lib/matchers/associations.rb'
- 'lib/matchers/validations/custom_validation_of.rb'
- 'lib/matchers/validations/numericality_of.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideHashLiteralBraces:
Exclude:
- 'spec/models/article.rb'

# Offense count: 6
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Expand All @@ -32,64 +43,51 @@ Lint/AssignmentInCondition:
- 'lib/matchers/validations/uniqueness_of.rb'

# Offense count: 1
# Configuration parameters: AllowComments.
Lint/EmptyWhen:
Exclude:
- 'lib/matchers/validations/numericality_of.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect.
# SupportedStylesAlignWith: keyword, variable, start_of_line
Lint/EndAlignment:
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/RedundantDirGlobSort:
Exclude:
- 'lib/matchers/validations/exclusion_of.rb'
- 'lib/matchers/validations/inclusion_of.rb'
- 'spec/spec_helper.rb'

# Offense count: 2
Lint/UselessAssignment:
Exclude:
- 'lib/matchers/accept_nested_attributes.rb'
- 'lib/matchers/validations/length_of.rb'

# Offense count: 10
Metrics/AbcSize:
Max: 115

# Offense count: 5
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 56

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 261

# Offense count: 7
Metrics/CyclomaticComplexity:
Max: 36

# Offense count: 12
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 138

# Offense count: 8
Metrics/PerceivedComplexity:
Max: 54
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, BlockForwardingName.
# SupportedStyles: anonymous, explicit
Naming/BlockForwarding:
Exclude:
- 'lib/matchers/validations/numericality_of.rb'

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'lib/mongoid-rspec.rb'

# Offense count: 1
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, db, id, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/matchers/validations/numericality_of.rb'

# Offense count: 7
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
# NamePrefix: is_, has_, have_
# NamePrefixBlacklist: is_, has_, have_
# NameWhitelist: is_a?
# ForbiddenPrefixes: is_, has_, have_
# AllowedMethods: is_a?
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicateName:
Exclude:
Expand All @@ -100,54 +98,86 @@ Naming/PredicateName:
- 'lib/matchers/indexes/v3/have_index_for.rb'
- 'lib/matchers/indexes/v4/have_index_for.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
# SupportedStyles: assign_to_condition, assign_inside_condition
Style/ConditionalAssignment:
Exclude:
- 'lib/matchers/allow_mass_assignment.rb'

# Offense count: 1
# Configuration parameters: .
# SupportedStyles: annotated, template, unannotated
Style/FormatStringToken:
EnforcedStyle: unannotated
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/ExpandPathArguments:
Exclude:
- 'Rakefile'
- 'mongoid-rspec.gemspec'

# Offense count: 50
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false

# Offense count: 2
# Configuration parameters: MinBodyLength.
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
Style/GuardClause:
Exclude:
- 'lib/matchers/validations.rb'
- 'spec/validators/ssn_validator.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowIfModifier.
Style/IfInsideElse:
Exclude:
- 'lib/matchers/allow_mass_assignment.rb'

# Offense count: 6
# Cop supports --auto-correct.
# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'lib/matchers/allow_mass_assignment.rb'
- 'lib/matchers/have_field.rb'
- 'lib/matchers/indexes/v3/have_index_for.rb'
- 'spec/unit/associations_spec.rb'
- 'spec/validators/ssn_validator.rb'

# Offense count: 1
Style/MethodMissing:
Style/MissingRespondToMissing:
Exclude:
- 'lib/matchers/validations/numericality_of.rb'

# Offense count: 15
# This cop supports safe autocorrection (--autocorrect).
Style/NegatedIfElseCondition:
Exclude:
- 'lib/matchers/associations.rb'
- 'lib/matchers/validations/format_of.rb'

# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'lib/matchers/associations.rb'

# Offense count: 1
# Cop supports --auto-correct.
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantFileExtensionInRequire:
Exclude:
- 'spec/models/person.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RescueModifier:
Exclude:
- 'lib/matchers/be_stored_in.rb'

# Offense count: 163
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 161
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowModifier.
Style/SoleNestedConditional:
Exclude:
- 'lib/matchers/have_field.rb'
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 8bb0c65

Please sign in to comment.