Skip to content

Commit

Permalink
Merge pull request #162 from bastelfreak/cleanup
Browse files Browse the repository at this point in the history
Implement codecov; update README.md
  • Loading branch information
bastelfreak authored Aug 9, 2021
2 parents c7399c8 + 1d9e4b0 commit 58e1432
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 68 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
name: Release

on:
create:
ref_type: tag
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
if: github.repository == 'voxpupuli/beaker-puppet'
env:
BUNDLE_WITHOUT: release
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
25 changes: 16 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,33 @@ on:
- pull_request
- push

env:
BUNDLE_WITHOUT: release

jobs:
test:
rspec:
runs-on: ubuntu-latest
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:
BUNDLE_WITHOUT: release
name: Ruby ${{ matrix.ruby }}
COVERAGE: ${{ matrix.coverage }}
name: RSpec - Ruby ${{ matrix.ruby }}
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
- name: spec tests
run: bundle exec rake test:spec
- name: Verify gem builds
run: gem build *.gemspec
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"

gemspec

group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes'
end

def location_for(place, fake_version = nil)
if place =~ /^(git:[^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
Expand All @@ -18,11 +14,15 @@ end


group :test do
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || ['>= 4.16.0', '< 5.0.0'])
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || ['>= 4.30.0', '< 5.0.0'])
gem "beaker-abs", *location_for(ENV['ABS_VERSION'] || '~> 0.4.0')
end

group :release do
gem 'github_changelog_generator', require: false
end

if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
group :coverage, optional: ENV['COVERAGE']!='yes' do
gem 'simplecov-console', :require => false
gem 'codecov', :require => false
end
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# beaker-puppet: The Puppet-Specific Beaker Library

[![License](https://img.shields.io/github/license/voxpupuli/beaker-puppet.svg)](https://github.com/voxpupuli/beaker-puppet/blob/master/LICENSE)
[![Test](https://github.com/voxpupuli/beaker-puppet/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/beaker-puppet/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/voxpupuli/beaker-puppet/branch/master/graph/badge.svg?token=Mypkl78hvK)](https://codecov.io/gh/voxpupuli/beaker-puppet)
[![Release](https://github.com/voxpupuli/beaker-puppet/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/beaker-puppet/actions/workflows/release.yml)
[![RubyGem Version](https://img.shields.io/gem/v/beaker-puppet.svg)](https://rubygems.org/gems/beaker-puppet)
[![RubyGem Downloads](https://img.shields.io/gem/dt/beaker-puppet.svg)](https://rubygems.org/gems/beaker-puppet)
[![Donated by Puppet Inc](https://img.shields.io/badge/donated%20by-Puppet%20Inc-fb7047.svg)](#transfer-notice)

The purpose of this library is to hold all puppet-specific info & DSL methods.
This includes all helper & installer methods.

Expand Down Expand Up @@ -74,31 +82,24 @@ file, or you can provide a beaker-hostgenerator value to the `TEST_TARGET`
environment variable. You can also specify the tests that get executed with the
`TESTS` environment variable.

# Contributing

Please refer to puppetlabs/beaker's [contributing](https://github.com/puppetlabs/beaker/blob/master/CONTRIBUTING.md) guide.

# Releasing
## Transfer Notice

* Install the required gems to generate the changelog:
This plugin was originally authored by [Puppet Inc](http://puppet.com).
The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
Existing pull requests and issues were transferred over, please fork and continue to contribute here.

```
bundle install --path .vendor/ --jobs=$(nproc) --with release
```
Previously: https://github.com/puppetlabs/beaker

* Update the gem version in `lib/beaker-puppet/version.rb`
## License

* Export a GitHub access token:
This gem is licensed under the Apache-2 license.

```
export CHANGELOG_GITHUB_TOKEN=...
```

* Generate the changelog

```
bundle exec rake changelog
```
## Release information

* Create a PR with the changes
* After the merge, create a git tag and push it, GitHub Actions will do the release
To make a new release, please do:
* update the version in `lib/beaker-puppet/version.rb`
* 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
8 changes: 3 additions & 5 deletions beaker-puppet.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ require 'beaker-puppet/version'
Gem::Specification.new do |s|
s.name = "beaker-puppet"
s.version = BeakerPuppet::VERSION
s.authors = ["Puppet"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/puppetlabs/beaker-puppet"
s.authors = ["Vox Pupuli"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/voxpupuli/beaker-puppet"
s.summary = %q{Beaker's Puppet DSL Extension Helpers!}
s.description = %q{For use for the Beaker acceptance testing tool}
s.license = 'Apache2'
Expand All @@ -22,8 +22,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rspec-its'
s.add_development_dependency 'fakefs', '>= 0.6', '< 2.0'
s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'pry', '~> 0.10'

# Acceptance Testing Dependencies
s.add_development_dependency 'beaker-vmpooler'
Expand Down
15 changes: 0 additions & 15 deletions spec/beaker-puppet/install_utils/foss_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1632,19 +1632,4 @@ def test_fetch_http_file_no_ending_slash(platform)
end

end

describe '#get_latest_puppet_agent_build_from_url' do
let(:urls) {['https://downloads.puppet.com/mac/10.9/PC1/x86_64',
'https://downloads.puppet.com/mac/10.10/PC1/x86_64',
'https://downloads.puppet.com/mac/10.11/PC1/x86_64',
'https://downloads.puppet.com/mac/10.12/PC1/x86_64',
'https://downloads.puppet.com/windows']}

it "gets the right version" do
urls.each do |url|
expect(subject.get_latest_puppet_agent_build_from_url(url)).to match(/\d*.\d*.\d*/)
end
end
end

end
27 changes: 25 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
require 'simplecov'
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 'pp' statement needed before fakefs, otherwise they can collide. Ref:
# https://github.com/fakefs/fakefs#fakefs-----typeerror-superclass-mismatch-for-class-file
require 'pp'
Expand All @@ -20,4 +43,4 @@
config.include FakeFS::SpecHelpers
config.include TestFileHelpers
config.include HostHelpers
end
end

0 comments on commit 58e1432

Please sign in to comment.