diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a44a9dac --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + if: github.repository_owner == 'voxpupuli' + steps: + - uses: actions/checkout@v2 + - name: Install Ruby 3.0 + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + env: + BUNDLE_WITHOUT: release + - name: Build gem + run: gem build *.gemspec + - name: Publish gem to rubygems.org + run: gem push *.gem + env: + GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}' + - name: Setup GitHub packages access + run: | + mkdir -p ~/.gem + echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials + chmod 0600 ~/.gem/credentials + - name: Publish gem to GitHub packages + run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..0937024e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Test + +on: + - pull_request + - push + +env: + BUNDLE_WITHOUT: release + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - ruby: "2.4" + - ruby: "2.5" + coverage: "yes" + env: + COVERAGE: ${{ matrix.coverage }} + steps: + - uses: actions/checkout@v2 + - name: Install Ruby ${{ matrix.ruby }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake + - name: Build gem + run: gem build *.gemspec diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e12623d0..00000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: "ruby" - -rvm: - - "1.9" - - "2.0" - - "2.1" - - "2.2" - - "2.3" - - "2.4" - - "2.5" - - "jruby-1.7" - - "jruby-9.1" - -sudo: false - -install: - - bundle install --retry=3 - -matrix: - include: - - rvm: "1.9" - gemfile: "gemfiles/Gemfile.ruby_19.x" - - rvm: "jruby-1.7" - gemfile: "gemfiles/Gemfile.ruby_19.x" - - rvm: "2.5" - gemfile: "gemfiles/Gemfile.multi_json.x" - - rvm: "2.5" - gemfile: "gemfiles/Gemfile.yajl-ruby.x" - - rvm: "2.5" - gemfile: "gemfiles/Gemfile.uuidtools.x" diff --git a/Gemfile b/Gemfile index 5bf28e53..81222954 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,19 @@ -source "https://rubygems.org" +source 'https://rubygems.org' gemspec -gem "json", ">= 1.7", :platforms => :mri_19 -gem 'simplecov', :require => false +group :release do + gem 'github_changelog_generator', require: false +end + +group :coverage, optional: ENV['COVERAGE']!='yes' do + gem 'simplecov-console', :require => false + gem 'codecov', :require => false +end + +group :tests do + gem 'rubocop', '~> 1.11.0' + gem 'rubocop-rspec', '~> 2.2.0' + gem 'rubocop-rake', '~> 0.5.1' + gem 'rubocop-performance', '~> 1.10.2' +end diff --git a/README.md b/README.md index 29c4ad6f..5b2750a1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -[![Gem Version](https://badge.fury.io/rb/json-schema.svg)](https://badge.fury.io/rb/json-schema) -[![Travis](https://travis-ci.org/ruby-json-schema/json-schema.svg?branch=master)](https://travis-ci.org/ruby-json-schema/json-schema) -[![Code Climate](https://codeclimate.com/github/ruby-json-schema/json-schema/badges/gpa.svg)](https://codeclimate.com/github/ruby-json-schema/json-schema) +# Ruby JSON Schema Validator -Ruby JSON Schema Validator -========================== +[![License](https://img.shields.io/github/license/voxpupuli/json-schema.svg)](https://github.com/voxpupuli/json-schema/blob/master/LICENSE) +[![Test](https://github.com/voxpupuli/json-schema/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/json-schema/actions/workflows/test.yml) +[![Release](https://github.com/voxpupuli/json-schema/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/json-schema/actions/workflows/release.yml) +[![RubyGem Version](https://img.shields.io/gem/v/json-schema.svg)](https://rubygems.org/gems/json-schema) +[![RubyGem Downloads](https://img.shields.io/gem/dt/json-schema.svg)](https://rubygems.org/gems/json-schema) +[![Donated by Iain Beeston](https://img.shields.io/badge/donated%20by-Iain%20Beeston-fb7047.svg)](#transfer-notice) This library is intended to provide Ruby with an interface for validating JSON objects against a JSON schema conforming to [JSON Schema Draft @@ -472,3 +474,23 @@ value is of the correct datatype (e.g., an instance value is validated to be an integer or a float in the case of 'utc-millisec'). Additionally, JSON::Validator does not handle any json hyperschema attributes. + +# Transfer Notice + +This plugin was originally authored by [Iain Beeston](https://github.com/iainbeeston). +The maintainer preferred that [Vox Pupuli](https://voxpupuli.org/) take ownership of the module for future improvement and maintenance. +Existing pull requests and issues were transferred, please fork and continue to contribute [here](https://github.com/voxpupuli/json-schema). + +# License + +This gem is licensed unter the [MIT license](LICENSE.md). + +## Release information + +To make a new release, please do: +* update the version in VERSION.yml +* Install gems with `bundle install --with release --path .vendor` +* generate the changelog with `bundle exec rake changelog` +* Check if the new version matches the closed issues/PRs in the changelog +* Create a PR with it +* After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages diff --git a/gemfiles/Gemfile.multi_json.x b/gemfiles/Gemfile.multi_json.x deleted file mode 100644 index 349d18d8..00000000 --- a/gemfiles/Gemfile.multi_json.x +++ /dev/null @@ -1,5 +0,0 @@ -source "https://rubygems.org" - -gemspec :path => "../" - -gem "multi_json" diff --git a/gemfiles/Gemfile.ruby_19.x b/gemfiles/Gemfile.ruby_19.x deleted file mode 100644 index 6fb8eaf7..00000000 --- a/gemfiles/Gemfile.ruby_19.x +++ /dev/null @@ -1,7 +0,0 @@ -source "https://rubygems.org" - -gemspec :path => "../" - -gem "json", "~> 1.0" -gem "addressable", "< 2.5" -gem "webmock", "< 3" diff --git a/gemfiles/Gemfile.uuidtools.x b/gemfiles/Gemfile.uuidtools.x deleted file mode 100644 index e3f30e93..00000000 --- a/gemfiles/Gemfile.uuidtools.x +++ /dev/null @@ -1,5 +0,0 @@ -source "https://rubygems.org" - -gemspec :path => "../" - -gem "uuidtools" diff --git a/gemfiles/Gemfile.yajl-ruby.x b/gemfiles/Gemfile.yajl-ruby.x deleted file mode 100644 index c9f10cca..00000000 --- a/gemfiles/Gemfile.yajl-ruby.x +++ /dev/null @@ -1,5 +0,0 @@ -source "https://rubygems.org" - -gemspec :path => "../" - -gem "yajl-ruby" diff --git a/json-schema.gemspec b/json-schema.gemspec index 60c6d267..60979a14 100644 --- a/json-schema.gemspec +++ b/json-schema.gemspec @@ -7,9 +7,9 @@ gem_name = "json-schema" Gem::Specification.new do |s| s.name = gem_name s.version = version - s.authors = ["Kenny Hoxworth"] - s.email = "hoxworth@gmail.com" - s.homepage = "http://github.com/ruby-json-schema/json-schema/tree/master" + s.authors = ["Kenny Hoxworth", "Vox Pupuli"] + s.email = "voxpupuli@groups.io" + s.homepage = "http://github.com/voxpupuli/json-schema/" s.summary = "Ruby JSON Schema Validator" s.files = Dir[ "lib/**/*", "resources/*.json" ] s.require_path = "lib" diff --git a/test/support/test_helper.rb b/test/support/test_helper.rb index 8c831daa..ec9d5c30 100644 --- a/test/support/test_helper.rb +++ b/test/support/test_helper.rb @@ -1,8 +1,27 @@ -if ENV['COVERAGE'] +# frozen_string_literal: true + +begin require 'simplecov' + require 'simplecov-console' + require 'codecov' +rescue LoadError +else SimpleCov.start do - add_filter '/test/' + track_files 'lib/**/*.rb' + + add_filter '/test' + + enable_coverage :branch + + # do not track vendored files + add_filter '/vendor' + add_filter '/.vendor' end + + SimpleCov.formatters = [ + SimpleCov::Formatter::Console, + SimpleCov::Formatter::Codecov, + ] end require 'minitest/autorun'