Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to gh actions #49

Merged
merged 5 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions .circleci/config.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: tests

on:
push:

jobs:
rubocop:
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 --parallel --extra-details --display-style-guide

tests:
strategy:
matrix:
ruby-version: [2.6, 2.7, 3.0, 3.1]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "${{ matrix.ruby-version }}"
- name: Run tests
run: bundle exec rspec --format RSpec::Github::Formatter
32 changes: 18 additions & 14 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
inherit_gem:
gc_ruboconfig: rubocop.yml

require:
- rubocop-rspec

AllCops:
Exclude:
- prius.gemspec
- vendor/**/*
TargetRubyVersion: 2.6

# Limit lines to 80 characters.
LineLength:
Max: 80

ClassLength:
Max: 300

StringLiterals:
Enabled: false
TargetRubyVersion: 3.1

Style/Documentation:
Enabled: false

Style/SignalException:
EnforcedStyle: 'only_raise'
EnforcedStyle: "only_raise"

Layout/DotPosition:
EnforcedStyle: 'trailing'
EnforcedStyle: "trailing"

Metrics/BlockLength:
Exclude:
- "spec/**/*_spec.rb"

RSpec/NestedGroups:
Max: 5

Gemspec/RequiredRubyVersion:
Enabled: false

RSpec/MultipleExpectations:
Max: 5
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.2
3 changes: 2 additions & 1 deletion lib/prius/registry.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require "date"
require "prius/errors"

module Prius
Expand Down Expand Up @@ -46,7 +47,7 @@ def load_int(name, required)
value = load_string(name, required)
return value if value.nil?

unless value =~ /\A[0-9]+\z/
unless /\A[0-9]+\z/.match?(value)
raise TypeMismatchError, "'#{name}' value '#{value}' is not an integer"
end

Expand Down
19 changes: 11 additions & 8 deletions prius.gemspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
# frozen_string_literal: true

require "English"

lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'prius/version'
require "prius/version"

Gem::Specification.new do |spec|
spec.name = "prius"
spec.version = Prius::VERSION
spec.authors = ["GoCardless Engineering"]
spec.email = ["engineering@gocardless.com"]
spec.description = %q{Environmentally-friendly config}
spec.description = "Environmentally-friendly config"
spec.summary = spec.description
spec.homepage = "https://github.com/gocardless/prius"
spec.license = "MIT"

spec.files = `git ls-files`.split($/)
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.6"

spec.add_development_dependency "gc_ruboconfig", "~> 3.6.0"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rubocop", "~> 1.24"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.5.1"
spec.add_development_dependency "rubocop-performance", "~> 1.13"
spec.add_development_dependency "rspec-github", "~> 2.3.1"
spec.metadata["rubygems_mfa_required"] = "true"
end
6 changes: 4 additions & 2 deletions spec/prius/registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"AGE" => "25",
"ALIVE" => "yes",
"BORN" => "2022-09-02",
"INVALID_DATE" => "2022-02-99"
"INVALID_DATE" => "2022-02-99",
}
end
let(:registry) { Prius::Registry.new(env) }
let(:registry) { described_class.new(env) }

describe "#load" do
context "given an invalid option" do
Expand Down Expand Up @@ -120,6 +120,7 @@
describe "#get" do
context "given a name that has been loaded" do
before { registry.load(:name) }

it "returns the value" do
expect(registry.get(:name)).to eq("Harry")
end
Expand All @@ -134,6 +135,7 @@

context "given a nillable name that has been loaded" do
before { registry.load(:lightsabre, required: false) }

it "returns nil" do
expect(registry.get(:lightsabre)).to be_nil
end
Expand Down