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

Lexahu/art19 revision #6

Open
wants to merge 4 commits into
base: tatthurs/art19-revision
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

47 changes: 25 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
name: CI

on: [push, pull_request]
on:
push:
branches:
- main
- master
pull_request:

jobs:
ruby_rails_test_matrix:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3']
rails: ['6.1', '7.0', '7.1']
exclude:
- ruby: 3.2
rails: 6
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
rails: ["60", "61", "70", "71"]
env:
# $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
# See https://github.com/ruby/setup-ruby/blob/master/README.md#matrix-of-gemfiles
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.rails${{ matrix.rails }}

name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Runs code QA and tests
env:
RAILS_VERSION: ~> ${{ matrix.rails }}
run: |
rm -rf Gemfile.lock
sudo apt-get update
sudo apt-get install libsqlite3-dev
echo $RAILS_VERSION | grep -q '5' && export SQLITE3_VERSION='~> 1.3.6'
bundle
bundle exec rake
- run: |
bundle exec rake spec
env:
RAILS_ENV: test
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,6 @@ Then, run `rake spec` to run the tests.

To install this gem onto your local machine, run `bundle exec rake install`.

To release a new version, update the version number in `version.rb`, and then
run `bundle exec rake release`, which will create a git tag for the version,
push git commits and tags, and push the `.gem` file to
[rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at
Expand All @@ -394,6 +389,18 @@ This project is intended to be a safe, welcoming space for collaboration, and
contributors are expected to adhere to the
[Contributor Covenant](http://contributor-covenant.org) code of conduct.

### ART19 Gem Publishing

Releases are manual, performed locally on a developer's machine. Gems are published to Github Packages. A comprehensive outline of this process can be found here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry.

1. Increment the `ART19_REVISION` in [lib/jsonapi/version.rb#L5](https://github.com/art19/jsonapi.rb/blob/master/lib/jsonapi/version.rb#L4)

2. Publish the gem:

```
bundle exec rake publish
```

## License

The gem is available as open source under the terms of the
Expand Down
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ require 'rubocop/rake_task'
require 'yaml'
require 'yardstick'

desc 'Build the package and publish it to rubygems.pkg.github.com'
task publish: :build do
# Requires local setup of personal access token, see:
# 1. https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry#authenticating-with-a-personal-access-token
system("gem push --key github --host https://rubygems.pkg.github.com/art19 " \
"pkg/jsonapi.rb-#{JSONAPI::VERSION}.gem")
end

# rubocop:disable Rails/RakeEnvironment
desc('Documentation stats and measurements')
task('qa:docs') do
Expand Down
6 changes: 6 additions & 0 deletions gemfiles/Gemfile.rails60
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "railties", "~> 6.0.6"
gem "activerecord", "~> 6.0.6"

gemspec :path => "../"
6 changes: 6 additions & 0 deletions gemfiles/Gemfile.rails61
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "railties", "~> 6.1"
gem "activerecord", "~> 6.1"

gemspec :path => "../"
8 changes: 8 additions & 0 deletions gemfiles/Gemfile.rails70
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "ransack", "~> 4.1.0"

gem "railties", "~> 7.0"
gem "activerecord", "~> 7.0"

gemspec :path => "../"
8 changes: 8 additions & 0 deletions gemfiles/Gemfile.rails71
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "ransack", "~> 4.1.0"

gem "railties", "~> 7.1"
gem "activerecord", "~> 7.1"

gemspec :path => "../"
17 changes: 9 additions & 8 deletions jsonapi.rb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'jsonapi/version'

Gem::Specification.new do |spec|
spec.name = 'jsonapi.rb'
spec.version = JSONAPI::VERSION
spec.authors = ['Stas Suscov']
spec.email = ['stas@nerd.ro']
spec.name = 'jsonapi.rb'
spec.version = JSONAPI::VERSION
spec.metadata["allowed_push_host"] = 'https://rubygems.pkg.github.com/art19'
spec.authors = ['Stas Suscov']
spec.email = ['stas@nerd.ro']

spec.summary = 'So you say you need JSON:API support in your API...'
spec.description = (
Expand All @@ -29,16 +30,16 @@ Gem::Specification.new do |spec|

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'ransack'
spec.add_development_dependency 'railties', ENV['RAILS_VERSION']
spec.add_development_dependency 'activerecord', ENV['RAILS_VERSION']
spec.add_development_dependency 'sqlite3', ENV['SQLITE3_VERSION']
spec.add_development_dependency 'railties'
spec.add_development_dependency 'activerecord'
spec.add_development_dependency 'sqlite3', '~> 1.3'
spec.add_development_dependency 'ffaker'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'jsonapi-rspec'
spec.add_development_dependency 'yardstick'
spec.add_development_dependency 'rubocop-rails_config'
spec.add_development_dependency 'rubocop', ENV['RUBOCOP_VERSION']
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'rubocop-performance'
end
8 changes: 7 additions & 1 deletion lib/jsonapi/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
module JSONAPI
VERSION = '2.0.1'
##
# ART19 maintains a fork with patches applied on top of the upstream gem.
# We publish our fork with a revision number appended to the upstream version.
#
# @return [String] the ART19 revision number
ART19_REVISION = '1'.freeze
VERSION = "2.0.1.#{ART19_REVISION}".freeze
end
2 changes: 1 addition & 1 deletion spec/dummy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class NotesController < ActionController::Base
include JSONAPI::Deserialization

def update
raise_error! if params[:id] == 'tada'
raise StandardError.new if params[:id] == 'tada'

note = Note.find(params[:id])

Expand Down
4 changes: 2 additions & 2 deletions spec/pagination_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
page: { number: 2, size: 1 },
sort: '-created_at',
as_list: as_list
}.compact_blank
}.compact
end

context 'on an array of resources' do
Expand Down Expand Up @@ -157,7 +157,7 @@
{
page: { number: 5, size: 1 },
as_list: as_list
}.compact_blank
}.compact
end

context 'on an array of resources' do
Expand Down
Loading