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

Fix: CI. #81

Merged
merged 2 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 20 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb: ["4.4"]
ruby: ["2.5", "2.6", "2.7", "3.0"]
gemfile:
- mongoid-3.1
- mongoid-4.0
- mongoid-5.0
- mongoid-6.0
- mongoid-7.0
- mongoid-8.0

entry:
- { ruby: "2.6", mongodb: '4.4', gemfile: 'mongoid-4.0', bundler: '2.0.0.pre.3' }
- { ruby: "2.7", mongodb: '4.4', gemfile: 'mongoid-5.0', bundler: '2.0.0.pre.3' }
- { ruby: "2.7", mongodb: '4.4', gemfile: 'mongoid-6.0' }
- { ruby: "2.7", mongodb: '4.4', gemfile: 'mongoid-7.0' }
- { ruby: "3.1", mongodb: '4.4', gemfile: 'mongoid-8.0' }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CONFUSED] I don't understand this refactor of the matrix. I'd rather see a traditional build matrix and possible include or exclude keys for edge cases.

i.e. This entry array doesn't make sense to me. What am I misunderstanding?

Copy link
Contributor Author

@dblock dblock Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this a lot cleaner and more declarative because we benefit little from a matrix.

  1. This is a 6x4 matrix and we should also be testing multiple MongoDB versions, so this will be 6x4x3 = 72 builds where about 75% are completely redundant. Even here, I started with a regular matrix and ended up with a long list of excludes, this avoids doing that.
  2. For these older Rubies we need a different version of bundler (2.0.0.pre.3). This is yet another parameter then, matrix explodes.

name: test (ruby=${{ matrix.entry.ruby }}, mongodb=${{ matrix.entry.mongodb }}), gemfile=${{ matrix.entry.gemfile }})
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
BUNDLE_GEMFILE: gemfiles/${{ matrix.entry.gemfile }}.gemfile
steps:
- name: Set up MongoDB ${{ matrix.mongodb }}
- name: Set up MongoDB ${{ matrix.entry.mongodb }}
uses: supercharge/mongodb-github-action@1.8.0
with:
mongodb-version: ${{ matrix.mongodb }}
# https://github.com/marketplace/actions/checkout
mongodb-version: ${{ matrix.entry.mongodb }}
- uses: actions/checkout@v2
# https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
ruby-version: ${{ matrix.entry.ruby }}
- name: Bundle install w/custom bundler
if: ${{ matrix.entry.bundler }}
run: |
gem install bundler:${{ matrix.entry.bundler }}
bundle _${{ matrix.entry.bundler }}_ install
- name: Bundle install with default bundler
if: ${{ !matrix.entry.bundler }}
run: bundle install
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CONFUSED] ruby/setup-ruby supports a bundler option.

For example:

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler: ${{ matrix.bundler }}

Why the extra work here to specify the bundler version? Also, for older ruby versions, just specify bundler 1.

Copy link
Contributor Author

@dblock dblock Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot get the older rubies + rails to work with anything other than bundler 2.0.0.pre.3. So I chose the version recommended. That said, I think I can do bundler: 2.0.0.pre.3, I didn't realize that was a setting.'

Update: ruby-setup doesn't support 2.0.0.pre.3 format, but this works with the latest 1.x. ruby/setup-ruby#439

- name: Run tests
run: bundle exec rake
19 changes: 19 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: PR Linter
on: [pull_request]
jobs:
danger:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: |
# the personal token is public, this is ok, base64 encode to avoid tripping Github
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### 2.4.1 (Next)

* [#81](https://github.com/mongoid/mongoid-grid_fs/pull/81): Mongoid 8 support - [@dblock](https://github.com/dblock), [@rmm5t](https://github.com/rmm5t).
* [#81](https://github.com/mongoid/mongoid-grid_fs/pull/81): Dropped support for Mongoid 3 - [@dblock](https://github.com/dblock), [@rmm5t](https://github.com/rmm5t).
* Your contribution here.

### 2.4.0 (2018/07/11)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ git push origin my-feature-branch -f

#### Check on Your Pull Request

Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
Go back to your pull request after a few minutes and see whether it passed muster with CI. Everything should look green, otherwise fix issues and amend your commit as described above.

#### Be Patient

Expand Down
5 changes: 5 additions & 0 deletions Gemfile.danger
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

group :test do
gem 'mongoid-danger', '~> 0.2.0'
end
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mongoid-grid_fs
---------------

[![Gem Version](https://badge.fury.io/rb/mongoid-grid_fs.svg)](https://badge.fury.io/rb/mongoid-grid_fs)
[![Build Status](https://travis-ci.org/mongoid/mongoid-grid_fs.svg)](https://travis-ci.org/mongoid/mongoid-grid_fs)
[![CI](https://github.com/mongoid/mongoid-grid_fs/actions/workflows/ci.yml/badge.svg)](https://github.com/mongoid/mongoid-grid_fs/actions/workflows/ci.yml)

A pure Mongoid/Moped implementation of the MongoDB GridFS specification

Expand Down
6 changes: 0 additions & 6 deletions gemfiles/mongoid-3.1.gemfile

This file was deleted.

1 change: 1 addition & 0 deletions gemfiles/mongoid-5.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ source 'https://rubygems.org'

gem 'mongoid', '~> 5.0.0'
gem 'rails', '~> 4.0'
gem 'bigdecimal', '~> 1.3'

gemspec path: '../'