Skip to content

Commit

Permalink
add art19 revision number and publishing instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tate Thurston committed Jul 16, 2024
1 parent f04e84b commit cb3f58b
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 44 deletions.
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: ["3.0", "3.1", "3.2", "3.3"]
rails: ["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.rails61
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "railties", "~> 6.1.7"
gem "activerecord", "~> 6.1.7"

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

gem "railties", "~> 7.0.8"
gem "activerecord", "~> 7.0.8"

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

gem "railties", "~> 7.1.3"
gem "activerecord", "~> 7.1.3"

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 = ['[email protected]']
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 = ['[email protected]']

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.6'
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 "This is an exception" if params[:id] == 'tada'

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

Expand Down

0 comments on commit cb3f58b

Please sign in to comment.