From 22c6a37faaa3ff57b9ee3024d423f21c36639bb4 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 29 Jul 2024 18:01:44 +0900 Subject: [PATCH] Travis CI => GH Actions --- .github/dependabot.yml | 7 +++ .github/workflows/main.yml | 105 +++++++++++++++++++++++++++++++++++++ .travis.yml | 18 ------- Gemfile | 37 ++++++++++++- still_life.gemspec | 1 - 5 files changed, 147 insertions(+), 21 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..670c7e6 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 + +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..c683891 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,105 @@ +name: build + +on: + push: + pull_request: + schedule: + - cron: '05 12 * * *' + +jobs: + build: + name: Ruby ${{ matrix.ruby_version }} / Rails ${{ matrix.rails_version }}${{ matrix.api == '1' && ' / API' || '' }} + strategy: + matrix: + ruby_version: [ruby-head, '3.3', '3.2', '3.1'] + rails_version: [edge, '7.1', '7.0', '6.1'] + test_framework: ['test-unit', 'minitest', 'rspec'] + + include: + - ruby_version: '3.0' + rails_version: '7.1' + test_framework: 'test-unit' + - ruby_version: '3.0' + rails_version: '7.1' + test_framework: 'minitest' + - ruby_version: '3.0' + rails_version: '7.1' + test_framework: 'rspec' + - ruby_version: '3.0' + rails_version: '7.0' + test_framework: 'test-unit' + - ruby_version: '3.0' + rails_version: '7.0' + test_framework: 'minitest' + - ruby_version: '3.0' + rails_version: '7.0' + test_framework: 'rspec' + - ruby_version: '3.0' + rails_version: '6.1' + test_framework: 'test-unit' + - ruby_version: '3.0' + rails_version: '6.1' + test_framework: 'minitest' + - ruby_version: '3.0' + rails_version: '6.1' + test_framework: 'rspec' + + - ruby_version: '2.7' + rails_version: '7.1' + test_framework: 'test-unit' + - ruby_version: '2.7' + rails_version: '7.1' + test_framework: 'minitest' + - ruby_version: '2.7' + rails_version: '7.1' + test_framework: 'rspec' + - ruby_version: '2.7' + rails_version: '7.0' + test_framework: 'test-unit' + - ruby_version: '2.7' + rails_version: '7.0' + test_framework: 'minitest' + - ruby_version: '2.7' + rails_version: '7.0' + test_framework: 'rspec' + - ruby_version: '2.7' + rails_version: '6.1' + test_framework: 'test-unit' + - ruby_version: '2.7' + rails_version: '6.1' + test_framework: 'minitest' + - ruby_version: '2.7' + rails_version: '6.1' + test_framework: 'rspec' + - ruby_version: '2.7' + rails_version: '6.0' + test_framework: 'test-unit' + - ruby_version: '2.7' + rails_version: '6.0' + test_framework: 'minitest' + - ruby_version: '2.7' + rails_version: '6.0' + test_framework: 'rspec' + + env: + RAILS_VERSION: ${{ matrix.rails_version }} + TEST_FRAMEWORK: ${{ matrix.test_framework }} + + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + rubygems: ${{ (matrix.ruby_version < '2.7' && 'default') || (matrix.ruby_version < '3' && '3.4.22') || 'latest' }} + bundler: ${{ matrix.bundler_version }} + bundler-cache: true + continue-on-error: ${{ matrix.allow_failures == 'true' }} + + - uses: browser-actions/setup-chrome@v1 + - run: chrome --version + + - run: bundle exec rake + continue-on-error: ${{ matrix.allow_failures == 'true' }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 38b39c2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -dist: focal -language: ruby -cache: bundler - -addons: - chrome: stable - -before_install: - - sudo apt update -qq - - sudo apt install -y chromium-chromedriver - -rvm: - - 2.7.3 - -env: - - TEST_FRAMEWORK=test-unit - - TEST_FRAMEWORK=minitest - - TEST_FRAMEWORK=rspec diff --git a/Gemfile b/Gemfile index 72a8c48..102f8e4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,37 @@ -source "https://rubygems.org" +# frozen_string_literal: true + +source 'https://rubygems.org' -# Specify your gem's dependencies in still_life.gemspec gemspec + +if ENV['RAILS_VERSION'] == 'edge' + gem 'rails', git: 'https://github.com/rails/rails.git' + gem 'rackup' +elsif ENV['RAILS_VERSION'] + gem 'rails', "~> #{ENV['RAILS_VERSION']}.0" + if ENV['RAILS_VERSION'] <= '5.0' + gem 'sqlite3', '< 1.4' + elsif (ENV['RAILS_VERSION'] <= '8') || (RUBY_VERSION < '3') + gem 'sqlite3', '< 2' + end + gem 'rackup' if ENV['RAILS_VERSION'] > '7.1' +else + gem 'rails' +end + +if RUBY_VERSION < '2.7' + gem 'puma', '< 6' +else + gem 'puma' +end + +gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7' +gem 'loofah', RUBY_VERSION < '2.5' ? '< 2.21.0' : '>= 0' +gem 'concurrent-ruby', RUBY_VERSION < '2.3' ? '~> 1.1.0' : '>= 1.2' +gem 'selenium-webdriver', RUBY_VERSION == '3.0' ? '4.9.0' : '>= 0' +gem 'webdrivers' if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'] >= '6' +gem 'net-smtp' if RUBY_VERSION >= '3.1' +gem 'jbuilder' unless ENV['API'] == '1' +gem 'mutex_m' if RUBY_VERSION >= '3.4' +gem 'base64' if RUBY_VERSION >= '3.4' +gem 'bigdecimal' if RUBY_VERSION >= '3.4' diff --git a/still_life.gemspec b/still_life.gemspec index e67f643..5b6c507 100644 --- a/still_life.gemspec +++ b/still_life.gemspec @@ -26,5 +26,4 @@ Gem::Specification.new do |spec| spec.add_development_dependency "bundler", "~> 2.0" spec.add_development_dependency "rake" spec.add_development_dependency "byebug" - spec.add_development_dependency 'test-unit-rails' end