Skip to content

Commit

Permalink
Merge pull request #1 from ekohl/add-ci
Browse files Browse the repository at this point in the history
Add CI and release workflow
  • Loading branch information
bastelfreak authored Jan 14, 2022
2 parents 5cc9e2e + ac094fa commit 422c1ec
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
if: github.repository_owner == 'voxpupuli'
steps:
- uses: actions/checkout@v2
- name: Install Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler: 'none'
- name: Build gem
run: gem build *.gemspec
- 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/${{ github.repository_owner }} *.gem
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on: pull_request

env:
BEAKER_HYPERVISOR: docker
BUNDLE_WITHOUT: release

jobs:
rubocop:
runs-on: ubuntu-latest
name: Rubocop
steps:
- uses: actions/checkout@v2
- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
bundler-cache: true
- name: Rubocop
run: bundle exec rubocop --format github

build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- "2.5"
- "2.6"
- "2.7"
- "3.0"
name: 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: Verify gem builds
run: bundle exec gem build *.gemspec
- name: Run unit tests
run: bundle exec rake spec
- name: Run acceptance tests
run: bundle exec rake acceptance
13 changes: 9 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'

gemspec

gem 'rubocop'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'rubocop', require: false
gem 'rubocop-rake', require: false
gem 'rubocop-rspec', require: false

gem 'beaker-vagrant'
case ENV['BEAKER_HYPERVISOR']
when 'docker'
gem 'beaker-docker'
when 'vagrant', 'vagrant_libvirt'
gem 'beaker-vagrant'
end

group :release do
gem 'github_changelog_generator', require: false
Expand Down
2 changes: 1 addition & 1 deletion spec/module_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def logger
expect(builder).to receive(:build).and_return('/path/to/tarball')

expect(host).to receive(:tmpfile).with('puppet_module').and_return('temp')
expect(host).to receive(:do_scp_to).with('/path/to/tarball', 'temp')
expect(host).to receive(:do_scp_to).with('/path/to/tarball', 'temp', {})
expect(subject).to receive(:install_puppet_module_via_pmt_on).with(host, 'temp')
expect(host).to receive(:rm_rf).with('temp')

Expand Down

0 comments on commit 422c1ec

Please sign in to comment.