Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

skip-changelog:
- head-branch: ['^rel*']
41 changes: 41 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

changelog:
exclude:
labels:
- duplicate
- invalid
- modulesync
- question
- skip-changelog
- wont-fix
- wontfix
- github_actions

categories:
- title: Breaking Changes 🛠
labels:
- backwards-incompatible

- title: New Features 🎉
labels:
- enhancement

- title: Bug Fixes 🐛
labels:
- bug
- bugfix

- title: Documentation Updates 📚
labels:
- documentation
- docs

- title: Dependency Updates ⬆️
labels:
- dependencies

- title: Other Changes
labels:
- "*"
109 changes: 91 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,106 @@
name: Release
---
name: Gem Release

on:
push:
tags:
- '*'

permissions: {}

jobs:
release:
runs-on: ubuntu-latest
build-release:
# Prevent releases from forked repositories
if: github.repository_owner == 'voxpupuli'
name: Build the gem
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install Ruby 3.0
- uses: actions/checkout@v5
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler: 'none'
env:
BUNDLE_WITHOUT: release:development:rubocop
ruby-version: 'ruby'
- name: Build gem
run: gem build --strict --verbose *.gemspec
shell: bash
run: gem build --verbose *.gemspec
- name: Upload gem to GitHub cache
uses: actions/upload-artifact@v4
with:
name: gem-artifact
path: '*.gem'
retention-days: 1
compression-level: 0

create-github-release:
needs: build-release
name: Create GitHub release
runs-on: ubuntu-24.04
permissions:
contents: write # clone repo and create release
steps:
- name: Download gem from GitHub cache
uses: actions/download-artifact@v5
with:
name: gem-artifact
- name: Create Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: gh release create --repo ${{ github.repository }} ${{ github.ref_name }} --generate-notes *.gem

release-to-github:
needs: build-release
name: Release to GitHub
runs-on: ubuntu-24.04
permissions:
packages: write # publish to rubygems.pkg.github.com
steps:
- name: Download gem from GitHub cache
uses: actions/download-artifact@v5
with:
name: gem-artifact
- name: Publish gem to GitHub packages
run: gem push --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem
env:
GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }}

release-to-rubygems:
needs: build-release
name: Release gem to rubygems.org
runs-on: ubuntu-24.04
environment: release # recommended by rubygems.org
permissions:
id-token: write # rubygems.org authentication
steps:
- name: Download gem from GitHub cache
uses: actions/download-artifact@v5
with:
name: gem-artifact
- uses: rubygems/configure-rubygems-credentials@v1.0.0
- name: Publish gem to rubygems.org
shell: bash
run: gem push *.gem
env:
GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
- name: Setup GitHub packages access

release-verification:
name: Check that all releases are done
runs-on: ubuntu-24.04
permissions:
contents: read # minimal permissions that we have to grant
needs:
- create-github-release
- release-to-github
- release-to-rubygems
steps:
- name: Download gem from GitHub cache
uses: actions/download-artifact@v5
with:
name: gem-artifact
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 'ruby'
- name: Wait for release to propagate
shell: bash
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/${{ github.repository_owner }} *.gem
gem install rubygems-await
gem await *.gem
43 changes: 24 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Test

on:
Expand All @@ -7,37 +8,36 @@ on:
- master
- main

env:
BUNDLE_WITHOUT: release
permissions:
contents: read

jobs:
rubocop:
runs-on: ubuntu-latest
rubocop_and_matrix:
runs-on: ubuntu-24.04
outputs:
ruby: ${{ steps.ruby.outputs.versions }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
ruby-version: '3.3'
bundler-cache: true
- name: Run rake rubocop
run: bundle exec rake rubocop
- id: ruby
uses: voxpupuli/ruby-version@v1

test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: rubocop_and_matrix
strategy:
fail-fast: false
matrix:
include:
- ruby: "2.7"
- ruby: "3.0"
- ruby: "3.1"
coverage: "yes"
- ruby: "3.2"
env:
COVERAGE: ${{ matrix.coverage }}
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
name: Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
Expand All @@ -47,11 +47,16 @@ jobs:
run: bundle exec rake spec
- name: Verify gem builds
run: gem build --strict --verbose *.gemspec

tests:
if: always()
needs:
- rubocop
- rubocop_and_matrix
- test
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Test suite
steps:
- run: echo Test suite completed
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
6 changes: 6 additions & 0 deletions .msync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# Managed by modulesync - DO NOT EDIT
# https://github.com/voxpupuli/puppet-lint_modulesync_configs
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '2.0.0'
9 changes: 3 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# frozen_string_literal: true

source ENV['GEM_SOURCE'] || 'https://rubygems.org'

gemspec

group :release do
group :release, optional: true do
gem 'faraday-retry', '~> 2.1', require: false
gem 'github_changelog_generator', '~> 1.16.4', require: false
end

group :coverage, optional: ENV['COVERAGE'] != 'yes' do
gem 'codecov', require: false
gem 'simplecov-console', require: false
end

group :development do
gem 'rake', '~> 13.0', '>= 13.0.6'
gem 'rspec', '~> 3.12'
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)
Expand Down
25 changes: 1 addition & 24 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
# frozen_string_literal: true

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 'puppet-lint'
require 'rspec/collection_matchers'

PuppetLint::Plugins.load_spec_helper
Loading