From 70b8d579f3e6c8e8f16fa00e9f8041bdc8361821 Mon Sep 17 00:00:00 2001 From: Mathieu Jobin Date: Mon, 30 Oct 2023 13:30:20 +0900 Subject: [PATCH] remove active_attr, setup github actions --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++ .github/workflows/rubocop-challenger.yml | 26 ++++++++++++ lib/ph_model.rb | 1 - ph_model.gemspec | 5 +-- 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/rubocop-challenger.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c9a57e1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: ci + +on: + - push + - pull_request + +jobs: + test: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + gemfile: ['rails_7.0', 'rails_7.1'] + ruby: [3.3, 3.2, 3.1] + include: + - gemfile: rails_7.0 + ruby: '3.0' + - gemfile: rails_7.0 + ruby: 2.7 + - gemfile: rails_6.1 + ruby: 2.7 + - gemfile: rails_6.0 + ruby: 2.7 + - gemfile: rails_5.2 + ruby: 2.7 + - gemfile: rails_5.1 + ruby: 2.7 + - gemfile: rails_5.0 + ruby: 2.7 + + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile + CI: true + COVERALLS_REPO_TOKEN: izk0cvqAVqD2Vdews2UjsnOZHLgzocyQL + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: RSpec and Rubocop + run: | + bundle exec rubocop -c .rubocop.yml + bundle exec rspec diff --git a/.github/workflows/rubocop-challenger.yml b/.github/workflows/rubocop-challenger.yml new file mode 100644 index 0000000..b58382f --- /dev/null +++ b/.github/workflows/rubocop-challenger.yml @@ -0,0 +1,26 @@ +name: "RuboCop Challenge" + +on: + schedule: + - cron: '30 23 * * 2,3,4' # この設定の場合、火水木のAM8:30に自動でPRが作られます。 + +jobs: + create-pr: + name: Create Pull Request + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby 2.7 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.5 + - name: Install bundler + run: gem install bundler + - name: Install gems + run: bundle install --jobs 4 --retry 3 + - name: Set git configuration + run: git config remote.origin.url "git@github.com:payrollhero/webhook_system.git" # プロジェクトごとに変わる値です。 + - name: Create RuboCop challenge pull request + env: + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: bundle exec rubocop_challenger go --exclude-limit=180 --base-branch=master --email=rubocop@payrollhero.com --name="Rubocop Challenger" --mode=random diff --git a/lib/ph_model.rb b/lib/ph_model.rb index e9faacc..9b13e4f 100644 --- a/lib/ph_model.rb +++ b/lib/ph_model.rb @@ -1,6 +1,5 @@ require 'active_support/all' require 'active_model' -require 'active_attr' ActiveModel::Validations # ensure its loaded since we're patching it diff --git a/ph_model.gemspec b/ph_model.gemspec index 9b93221..bd0b622 100644 --- a/ph_model.gemspec +++ b/ph_model.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |gem| gem.authors = ['Piotr Banasik'] gem.email = 'piotr@payrollhero.com' - gem.summary = 'ph-model -- active_model, active_attr brought together at last' + gem.summary = 'ph-model -- active_model, ??? active_attr brought together at last' gem.description = 'Because why do less if you can do more with non db models' gem.homepage = 'https://github.com/payrollhero/ph_model' gem.license = 'MIT' @@ -20,10 +20,9 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'activesupport', '> 3.2' gem.add_runtime_dependency 'activemodel', '> 3.2' - gem.add_runtime_dependency 'active_attr', '~> 0.8' gem.add_development_dependency 'faraday' - gem.add_development_dependency 'bundler', '~> 1.0' + gem.add_development_dependency 'bundler', '~> 2.3' gem.add_development_dependency 'rake', '~> 10.0' gem.add_development_dependency 'rspec', '~> 3.0' gem.add_development_dependency 'rubygems-tasks', '~> 0.2'