From f8a86f622afd9cbc61ce8f294f5a06f492d18e4e Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Wed, 30 Dec 2020 16:21:56 +0900 Subject: [PATCH 1/4] Allow Ransack runs test atainst Rails master branch aka 6.2.0.alpha There was a similar change made for Rails 6.1 via #1035 --- lib/polyamorous/activerecord_6.2_ruby_2/join_association.rb | 1 + lib/polyamorous/activerecord_6.2_ruby_2/join_dependency.rb | 1 + lib/polyamorous/activerecord_6.2_ruby_2/reflection.rb | 1 + 3 files changed, 3 insertions(+) create mode 100644 lib/polyamorous/activerecord_6.2_ruby_2/join_association.rb create mode 100644 lib/polyamorous/activerecord_6.2_ruby_2/join_dependency.rb create mode 100644 lib/polyamorous/activerecord_6.2_ruby_2/reflection.rb diff --git a/lib/polyamorous/activerecord_6.2_ruby_2/join_association.rb b/lib/polyamorous/activerecord_6.2_ruby_2/join_association.rb new file mode 100644 index 000000000..793116428 --- /dev/null +++ b/lib/polyamorous/activerecord_6.2_ruby_2/join_association.rb @@ -0,0 +1 @@ +require 'polyamorous/activerecord_6.1_ruby_2/join_association' diff --git a/lib/polyamorous/activerecord_6.2_ruby_2/join_dependency.rb b/lib/polyamorous/activerecord_6.2_ruby_2/join_dependency.rb new file mode 100644 index 000000000..6609b0db8 --- /dev/null +++ b/lib/polyamorous/activerecord_6.2_ruby_2/join_dependency.rb @@ -0,0 +1 @@ +require 'polyamorous/activerecord_6.1_ruby_2/join_dependency' diff --git a/lib/polyamorous/activerecord_6.2_ruby_2/reflection.rb b/lib/polyamorous/activerecord_6.2_ruby_2/reflection.rb new file mode 100644 index 000000000..685ee2f92 --- /dev/null +++ b/lib/polyamorous/activerecord_6.2_ruby_2/reflection.rb @@ -0,0 +1 @@ +require 'polyamorous/activerecord_6.1_ruby_2/reflection' From f586e19d8ffddf9fe13657e4dc06ed183a65cb48 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Wed, 30 Dec 2020 16:40:22 +0900 Subject: [PATCH 2/4] Tweak Gemfile to allow Rails 'master' branch name --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 568adc5e7..eed7e41d7 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ rails_version = case rails end gem 'faker', '~> 2.0' -gem 'sqlite3', ::Gem::Version.new(rails_version) >= ::Gem::Version.new('6-0-stable') ? '~> 1.4.1' : '~> 1.3.3' +gem 'sqlite3', ::Gem::Version.new(rails_version == 'master' ? '6.2.0.alpha' : rails_version) >= ::Gem::Version.new('6-0-stable') ? '~> 1.4.1' : '~> 1.3.3' gem 'pg', '~> 1.0' gem 'pry', '~> 0.12.2' gem 'byebug' From c6166334ba67cf218dd9097d51a2ac1dffef686b Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Wed, 30 Dec 2020 22:24:43 +0900 Subject: [PATCH 3/4] Add GitHub job `cronjob` to run CI against Rails master branch daily https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#schedule --- .github/workflows/cronjob.yml | 105 ++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .github/workflows/cronjob.yml diff --git a/.github/workflows/cronjob.yml b/.github/workflows/cronjob.yml new file mode 100644 index 000000000..fdf35d50b --- /dev/null +++ b/.github/workflows/cronjob.yml @@ -0,0 +1,105 @@ +name: cronjob + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + sqlite3: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + ruby: + - 3.0.0 + - 2.7.2 + - 2.6.6 + env: + DB: sqlite3 + RAILS: master + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Install dependencies + run: bundle install + - name: Run tests + run: bundle exec rspec + + mysql: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + ruby: + - 3.0.0 + - 2.7.2 + - 2.6.6 + env: + DB: mysql + RAILS: master + MYSQL_USERNAME: root + MYSQL_PASSWORD: root + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Startup MySQL + run: | + sudo systemctl start mysql.service + - name: Setup databases + run: | + mysql --user=root --password=root --host=127.0.0.1 -e 'create database ransack collate utf8_general_ci;'; + mysql --user=root --password=root --host=127.0.0.1 -e 'use ransack;show variables like "%character%";show variables like "%collation%";'; + - name: Install dependencies + run: bundle install + - name: Run tests + run: bundle exec rspec + + postgres: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + ruby: + - 3.0.0 + - 2.7.2 + - 2.6.6 + env: + DB: postgres + RAILS: master + DATABASE_USERNAME: postgres + DATABASE_PASSWORD: postgres + DATABASE_HOST: 127.0.0.1 + services: + postgres: + image: postgres + ports: + - 5432:5432 + env: + POSTGRES_PASSWORD: postgres + POSTGRES_HOST_AUTH_METHOD: trust + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Setup databases + run: | + psql -h localhost -p 5432 -W postgres -c 'create database ransack;' -U postgres; + - name: Install dependencies + run: bundle install + - name: Run tests + run: bundle exec rspec From 5a861daeaa279c590a2cb7fa248bf96006cc6792 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Sun, 17 Jan 2021 09:01:50 +0900 Subject: [PATCH 4/4] Rails default branch name changed from master to main --- .github/workflows/cronjob.yml | 6 +++--- Gemfile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cronjob.yml b/.github/workflows/cronjob.yml index fdf35d50b..24c71469a 100644 --- a/.github/workflows/cronjob.yml +++ b/.github/workflows/cronjob.yml @@ -16,7 +16,7 @@ jobs: - 2.6.6 env: DB: sqlite3 - RAILS: master + RAILS: main steps: - uses: actions/checkout@v2 - name: Set up Ruby @@ -39,7 +39,7 @@ jobs: - 2.6.6 env: DB: mysql - RAILS: master + RAILS: main MYSQL_USERNAME: root MYSQL_PASSWORD: root steps: @@ -71,7 +71,7 @@ jobs: - 2.6.6 env: DB: postgres - RAILS: master + RAILS: main DATABASE_USERNAME: postgres DATABASE_PASSWORD: postgres DATABASE_HOST: 127.0.0.1 diff --git a/Gemfile b/Gemfile index eed7e41d7..bec08447c 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ rails_version = case rails end gem 'faker', '~> 2.0' -gem 'sqlite3', ::Gem::Version.new(rails_version == 'master' ? '6.2.0.alpha' : rails_version) >= ::Gem::Version.new('6-0-stable') ? '~> 1.4.1' : '~> 1.3.3' +gem 'sqlite3', ::Gem::Version.new(rails_version == 'main' ? '6.2.0.alpha' : rails_version) >= ::Gem::Version.new('6-0-stable') ? '~> 1.4.1' : '~> 1.3.3' gem 'pg', '~> 1.0' gem 'pry', '~> 0.12.2' gem 'byebug'