diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dfc26f9..a44a9da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,22 +1,32 @@ name: Release on: - create: - ref_type: tag + push: + tags: + - '*' jobs: release: runs-on: ubuntu-latest - if: github.repository == 'voxpupuli/voxpupuli-test' + if: github.repository_owner == 'voxpupuli' steps: - uses: actions/checkout@v2 - - name: Install Ruby 2.7 + - name: Install Ruby 3.0 uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.0' + env: + BUNDLE_WITHOUT: release - name: Build gem run: gem build *.gemspec - - name: Publish gem + - 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 index 6ed8149..ba30178 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,11 +13,15 @@ jobs: strategy: fail-fast: false matrix: - ruby: - - "2.4" - - "2.5" - - "2.6" - - "2.7" + 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 }} diff --git a/Gemfile b/Gemfile index 841c3ba..48fd79d 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,8 @@ gemspec 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 66ad930..4c3d96a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # Voxpupuli Test Gem +[![License](https://img.shields.io/github/license/voxpupuli/voxpupuli-test.svg)](https://github.com/voxpupuli/voxpupuli-test/blob/master/LICENSE) +[![Test](https://github.com/voxpupuli/voxpupuli-test/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/voxpupuli-test/actions/workflows/test.yml) +[![codecov](https://codecov.io/gh/voxpupuli/voxpupuli-test/branch/master/graph/badge.svg?token=Mypkl78hvK)](https://codecov.io/gh/voxpupuli/voxpupuli-test) +[![Release](https://github.com/voxpupuli/voxpupuli-test/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/voxpupuli-test/actions/workflows/release.yml) +[![RubyGem Version](https://img.shields.io/gem/v/voxpupuli-test.svg)](https://rubygems.org/gems/voxpupuli-test) +[![RubyGem Downloads](https://img.shields.io/gem/dt/voxpupuli-test.svg)](https://rubygems.org/gems/voxpupuli-test) + This is a helper Gem to test the various Vox Pupuli Puppet modules. This Gem currently serves only to encapsulate common `rake` tasks related to releasing modules. The aim is to reduce the boiler plate and need for modulesync. # Usage diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1c24802..73fb578 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1,25 @@ +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/core'