diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 714e2234..240f0850 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,17 +4,24 @@ on: - pull_request - push +env: + BUNDLE_WITHOUT: release + jobs: test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - ruby: - - '2.5' - - '2.6' - - '2.7' - - '3.0' + include: + - ruby: '2.4' + - ruby: '2.5' + - ruby: '2.6' + - ruby: '2.7' + - ruby: '3.0' + coverage: 'yes' + env: + COVERAGE: ${{ matrix.coverage }} steps: - uses: actions/checkout@v2 - name: Install Ruby ${{ matrix.ruby }} @@ -22,8 +29,6 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - env: - BUNDLE_WITHOUT: release - name: Run tests run: bundle exec rake spec - name: something diff --git a/Gemfile b/Gemfile index 10d5ea1c..625a2427 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +source ENV['GEM_SOURCE'] || 'https://rubygems.org' gemspec @@ -7,3 +7,12 @@ if facterversion = ENV['FACTER_GEM_VERSION'] else gem 'facter', :require => false end + +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 diff --git a/README.md b/README.md index b0984b58..49f635d4 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ rspec-puppet-facts ================== -[![Build Status](https://img.shields.io/travis/mcanevet/rspec-puppet-facts/master.svg)](https://travis-ci.org/mcanevet/rspec-puppet-facts) -[![Gem Version](https://img.shields.io/gem/v/rspec-puppet-facts.svg)](https://rubygems.org/gems/rspec-puppet-facts) -[![Gem Downloads](https://img.shields.io/gem/dt/rspec-puppet-facts.svg)](https://rubygems.org/gems/rspec-puppet-facts) +[![License](https://img.shields.io/github/license/voxpupuli/rspec-puppet-facts.svg)](https://github.com/voxpupuli/rspec-puppet-facts/blob/master/LICENSE) +[![Test](https://github.com/voxpupuli/rspec-puppet-facts/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/rspec-puppet-facts/actions/workflows/test.yml) +[![codecov](https://codecov.io/gh/voxpupuli/rspec-puppet-facts/branch/master/graph/badge.svg?token=Mypkl78hvK)](https://codecov.io/gh/voxpupuli/rspec-puppet-facts) +[![Release](https://github.com/voxpupuli/rspec-puppet-facts/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/rspec-puppet-facts/actions/workflows/release.yml) +[![RubyGem Version](https://img.shields.io/gem/v/rspec-puppet-facts.svg)](https://rubygems.org/gems/rspec-puppet-facts) +[![RubyGem Downloads](https://img.shields.io/gem/dt/rspec-puppet-facts.svg)](https://rubygems.org/gems/rspec-puppet-facts) [![Donated by Camptocamp](https://img.shields.io/badge/donated%20by-camptocamp-fb7047.svg)](#transfer-notice) Based on an original idea from [apenney](https://github.com/apenney/puppet_facts/), diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b72ff6bd..bd1d3fe0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,25 @@ -if ENV['COVERAGE'] - require 'coveralls' - Coveralls.wear! +begin + require 'simplecov' + require 'simplecov-console' + require 'codecov' +rescue LoadError +else + SimpleCov.start do + track_files 'lib/**/*.rb' + + add_filter '/spec' + + 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 'rspec'