Skip to content

Commit

Permalink
Revisit GitHub workflows (#2301)
Browse files Browse the repository at this point in the history
* Rename gemfiles to follow standard

* Use ubuntu-latest
Refactor ruby-matrix on test and edge
Add rubygems: latest
Add 3.2

* Fix typo

* Remove rack_3_0.gemfile

* Exclude ruby 2.6 for rails_7_0

* Add entry CHANGELOG.md

* Remove spaces in arrays
Add rubygems in danger.yml

* Include [Rails 5.2, Ruby 2.6]
Exclude [Rails 7.0, Ruby 2.6]

* Fix test.yml

* Only exclude

* Lock rails_7_0 to not include 7.1
Lock rack_3_0 to not include 3.1
Remove rack_2_2 in favor of 2_0 to test
Rename rack3 to rack_3_0
Testing workflow include/exclude

* testing ruby matrix '2.7', '3.0', '3.1', '3.2'
testing gemfile rack_2_0, rails_6_0, rails_6_1, rails_7_0
include 2.6 for rails_5_2
include 2.7 for rack_1_0, multi_json, multi_xml

* Fix integration and eager_load

* Try fixing test.yml

* Danger now on 2.7
Remove matrix os in edge
Add rubygems: latest to rubocop
  • Loading branch information
ericproulx authored Jan 9, 2023
1 parent c8b755d commit cdeaa13
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 110 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
name: danger

on: pull_request

jobs:
danger:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 2.7
bundler-cache: true
rubygems: latest
- name: Run Danger
run: |
# the token is public, has public_repo scope and belongs to the grape-bot user owned by @dblock, this is ok
Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,12 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- ruby: 2.7
gemfile: 'gemfiles/rails_edge.gemfile'
- ruby: 2.7
gemfile: 'gemfiles/rack_edge.gemfile'
- ruby: 2.7
gemfile: 'gemfiles/rack3.gemfile'
- ruby: "ruby-head"
- ruby: "truffleruby-head"
- ruby: "jruby-head"
ruby: ['2.7', '3.0', '3.1', '3.2', ruby-head, truffleruby-head, jruby-head]
gemfile: [rails_edge, rack_edge, rack_3_0]
runs-on: ubuntu-latest
continue-on-error: true
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v3

Expand Down
72 changes: 26 additions & 46 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,42 @@
---
name: test
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

on: [push, pull_request]

jobs:
lint:
name: RuboCop
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
rubygems: latest

- name: Run RuboCop
run: bundle exec rubocop

test:
strategy:
fail-fast: false
matrix:
ruby:
- 2.6
- 2.7
- "3.0"
gemfile:
- Gemfile
- gemfiles/rack1.gemfile
- gemfiles/rack2.gemfile
- gemfiles/rack2_2.gemfile
- gemfiles/rails_5.gemfile
- gemfiles/rails_6.gemfile
- gemfiles/rails_6_1.gemfile
ruby: ['2.7', '3.0', '3.1', '3.2']
gemfile: [rack_2_0, rails_6_0, rails_6_1, rails_7_0]
include:
- ruby: 3.1
gemfile: 'gemfiles/multi_json.gemfile'
- ruby: 3.1
gemfile: 'gemfiles/multi_xml.gemfile'
- ruby: 3.1
gemfile: 'gemfiles/rails_7.gemfile'
- ruby: "3.0"
gemfile: 'gemfiles/multi_json.gemfile'
- ruby: "3.0"
gemfile: 'gemfiles/multi_xml.gemfile'
- ruby: "3.0"
gemfile: 'gemfiles/rails_7.gemfile'
- ruby: 2.7
gemfile: 'gemfiles/multi_json.gemfile'
- ruby: 2.7
gemfile: 'gemfiles/multi_xml.gemfile'
- ruby: 2.7
gemfile: 'gemfiles/rails_7.gemfile'
runs-on: ubuntu-20.04
- ruby: '2.6'
gemfile: rails_5_2
- ruby: '2.7'
gemfile: rack_1_0
- ruby: '2.7'
gemfile: multi_json
- ruby: '2.7'
gemfile: multi_xml
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v3

Expand All @@ -67,20 +45,22 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
rubygems: latest

- name: Run tests
run: bundle exec rake spec

- name: Run tests (spec/integration/eager_load)
if: ${{ matrix.gemfile == 'Gemfile' }}
# rack_2_0.gemfile is equals to Gemfile
if: ${{ matrix.gemfile == 'rack_2_0' }}
run: bundle exec rspec spec/integration/eager_load

- name: Run tests (spec/integration/multi_json)
if: ${{ matrix.gemfile == 'gemfiles/multi_json.gemfile' }}
if: ${{ matrix.gemfile == 'multi_json' }}
run: bundle exec rspec spec/integration/multi_json

- name: Run tests (spec/integration/multi_xml)
if: ${{ matrix.gemfile == 'gemfiles/multi_xml.gemfile' }}
if: ${{ matrix.gemfile == 'multi_xml' }}
run: bundle exec rspec spec/integration/multi_xml

- name: Coveralls
Expand All @@ -98,4 +78,4 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
parallel-finished: true
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* [#2296](https://github.com/ruby-grape/grape/pull/2296): Fix cops and enables some - [@ericproulx](https://github.com/ericproulx).
* [#2302](https://github.com/ruby-grape/grape/pull/2302): Rack < 3 and update rack-test - [@ericproulx](https://github.com/ericproulx).
* [#2303](https://github.com/ruby-grape/grape/pull/2302): Rack >= 1.3.0 - [@ericproulx](https://github.com/ericproulx).
* [#2301](https://github.com/ruby-grape/grape/pull/2301): Revisit GH workflows - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

#### Fixes
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion gemfiles/rack2_2.gemfile → gemfiles/rack_2_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

source 'https://rubygems.org'

gem 'rack', '~> 2.2'
gem 'rack', '~> 2.0'

group :development, :test do
gem 'bundler'
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rack2.gemfile → gemfiles/rack_3_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

source 'https://rubygems.org'

gem 'rack', '~> 2.0.0'
gem 'rack', '~> 3.0.0'

group :development, :test do
gem 'bundler'
Expand Down
File renamed without changes.
File renamed without changes.
46 changes: 0 additions & 46 deletions gemfiles/rails_7.gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/rack3.gemfile → gemfiles/rails_7_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

source 'https://rubygems.org'

gem 'rack', '~> 3'
gem 'rails', '~> 7.0.0'

group :development, :test do
gem 'bundler'
Expand Down

0 comments on commit cdeaa13

Please sign in to comment.