Skip to content

Commit

Permalink
Merge pull request #55 from Sage/ruby-32-support
Browse files Browse the repository at this point in the history
Set minimum Ruby version to v3 and relax dependency constraints
  • Loading branch information
robkilby authored Sep 7, 2023
2 parents d43d156 + 7acec69 commit 3148706
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 60 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
- push

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby-version: ['3.2', '3.1', '3.0']

steps:
- uses: actions/checkout@v4

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

- name: Run tests
run: bundle exec rspec

- name: Code Coverage
uses: paambaati/codeclimate-action@v5
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{github.workspace}}/coverage/.coverage.json:simplecov
publish:
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build yaml_normalizer.gemspec
gem push yaml_normalizer-*.gem
env:
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require:
- rubocop-performance

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 3.2

# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5
3.2.2
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

53 changes: 44 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,91 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added

### Changed

### Removed

## [2.0.0] - 2023-09-06

### Added

- Tests now run against Ruby 3.0, 3.1, and 3.2

### Changed

- Update minimum Ruby version to v3.0
- Relaxed version constraint on Rake
- Set minimum Psych version to v5

## [1.2.0] - 2019-08-08

### Added

- Versioning and help messages for CLI

### Changed
- Extended allowed line length to 120
- Change the mutant to only scan the latest commits

- Extended allowed line length to 120
- Change the mutant to only scan the latest commits

## [1.1.0] - 2019-05-21

### Added

- Add rubocop-performance gem

### Changed

- Update Ruby version to 2.5
- Reduce average code complexity threshold to 6.3
- Use thread safe output in peach blocks
- Only require `pathname` when used


## [1.0.1] - 2018-05-04

### Changed
- Specify executables in Gemspec

- Specify executables in Gemspec

## [1.0.0] - 2018-05-04

### Added

- Add .ruby-version file to improve development experience
- Add gem version badge to README
- Add pry-doc
- Add helper method to retrieve relative path for a file
- Add executable "yaml_check" to check normalization of YAML files

### Changed

- Clean up README
- Rename executable to normalize YAML files to "yaml_normalize"
- Lower average complexity threshold to 6.5

### Removed

- Remove parallel_tests
- Remove console and setup executables
- Remove bundler/gem_tasks


## [0.3.0] - 2018-03-26

### Added

- Add YamlNormalizer::Ext::Nested to generate nested hash from namespaces key-value pairs
- Add Codeclimate integration https://codeclimate.com/github/Sage/yaml_normalizer/

### Changed

- Change flog method to :average, set threshold to 7.7
- Reset default_proc before returning to app code
- Open-source Yaml Normalizer at https://github.com/Sage/yaml_normalizer
Expand All @@ -71,39 +96,47 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Support sorting keys of different types

### Removed
- Remove Coveralls.io integration

- Remove Coveralls.io integration

## [0.2.2] - 2017-06-23

### Added

- Add hint to run normalize task when check task fails

### Changed

- Fix check rake task's exit value
- Fix return when checking YAMLs
- Fix section "rake -t" in README.md
- Fix mutant output parsing

### Removed
- Stop requiring simplecov when running mutation tests

- Stop requiring simplecov when running mutation tests

## [0.2.1] - 2017-06-01

### Added

- CHANGELOG.md

### Changed
- Fix handling of UTF-8-encoded files using byte order mark

- Fix handling of UTF-8-encoded files using byte order mark

## [0.2.0] - 2017-05-10

### Added

- Add file configuration to rake task
- Add YAML check service, including rake task
- Add ci_task helper methods
- Add more documentation and improve wording

### Changed

- Enable RSpec's verify_partial_doubles and disable_monkey_patching
- Change License to Apache-2.0
- Move CI helper methods to separate file
Expand All @@ -113,11 +146,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Make "rake ci" the default rake task

### Removed

- Remove flay
- Remove cane
- Remove Ruby refinements


## [0.1.0] - 2017-04-07

### Added

- Minimal initial version of "YAML Normalizer", fmi see README.md
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

source 'https://rubygems.org'

ruby '~> 2.5'

gem 'simplecov', require: false, group: :test
ruby '>= 3.0'

gemspec
3 changes: 1 addition & 2 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
# rspec may be run, below are examples of the most common uses.
# * bundler: 'bundle exec rspec'
# * bundler binstubs: 'bin/rspec'
# * spring: 'bin/rspec' (This will use spring if running and you have
# installed the spring binstubs per the docs)
# * spring: 'bin/rspec' (This will use spring if running and you have installed the spring binstubs per the docs)
# * zeus: 'zeus rspec' (requires the server to be started separately)
# * 'just' rspec: 'rspec'

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Yaml Normalizer

[![Build Status](https://travis-ci.org/Sage/yaml_normalizer.svg?branch=master)](https://travis-ci.org/Sage/yaml_normalizer)
[![Build Status](https://github.com/Sage/yaml_normalizer/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Sage/yaml_normalizer/actions/workflows/ci.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/8dccb6c06fcd8bc0e587/maintainability)](https://codeclimate.com/github/Sage/yaml_normalizer/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/8dccb6c06fcd8bc0e587/test_coverage)](https://codeclimate.com/github/Sage/yaml_normalizer/test_coverage)
[![Gem Version](https://badge.fury.io/rb/yaml_normalizer.svg)](https://badge.fury.io/rb/yaml_normalizer)
Expand Down Expand Up @@ -112,7 +112,7 @@ Guard keeps track of file changes and automatically runs the unit tests related

##### Run RSpec
$ bundle exec rake spec
This task runs the full unit test suite based on RSpec.
This task runs the full unit test suite based on RSpec.

#### Test Tests using mutant
$ bundle exec rake mutant
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require './tmpfix/rake_application'
require './spec/ci_helper'

require 'rspec/core/rake_task'
Expand Down
2 changes: 1 addition & 1 deletion lib/yaml_normalizer/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module YamlNormalizer
# The current Yaml Normalizer version
VERSION = '1.2.1'
VERSION = '2.0.0'
end
17 changes: 17 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
ENV['ENV'] = 'test'
unless defined?(Mutant)
require 'simplecov'
require 'simplecov_json_formatter'

SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
SimpleCov.start do
add_filter '/spec'
end
Expand Down Expand Up @@ -35,4 +38,18 @@ def data_path
mocks.verify_partial_doubles = true
end
config.disable_monkey_patching!

original_stderr = $stderr
original_stdout = $stdout

config.before(:all) do
# Redirect stderr and stdout
$stderr = File.open(File::NULL, "w")
$stdout = File.open(File::NULL, "w")
end

config.after(:all) do
$stderr = original_stderr
$stdout = original_stdout
end
end
13 changes: 0 additions & 13 deletions tmpfix/rake_application.rb

This file was deleted.

12 changes: 8 additions & 4 deletions yaml_normalizer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'yaml_normalizer/version'

Gem::Specification.new do |spec|
spec.name = 'yaml_normalizer'
spec.version = YamlNormalizer::VERSION
spec.authors = ['Wolfgang Teuber', 'Jan Taras']
spec.email = ['jan.taras@sage.com']
spec.authors = ['The Sage Group plc']
spec.email = ['support@sageone.com']

spec.summary = 'Yaml Normalizer normalizes YAML files'
spec.description = "Yaml Normalizer follows the notion that there is
Expand All @@ -22,9 +23,11 @@ Gem::Specification.new do |spec|
spec.executables = %w[yaml_check yaml_normalize]
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'peach', '~> 0.5'
spec.add_dependency 'psych', '~> 2.2'
spec.add_dependency 'rake', '~> 12.0'
spec.add_dependency 'psych', '~> 5.0'
spec.add_dependency 'rake', '< 14.0'

spec.add_development_dependency 'awesome_print'
spec.add_development_dependency 'bundler'
Expand All @@ -43,5 +46,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop-performance'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'yard'
end

0 comments on commit 3148706

Please sign in to comment.