These are reusable workflows to run Puppet tests within Github Actions.
They are heavily focused on the workflow that Vox Pupuli uses, which rely on rake tasks from puppetlabs_spec_helper. The tasks executed are:
validate
lint
check
rubocop
if enabled (default)parallel_spec
in a matrix for every supported Puppet version
For more information, see GitHub's workflow reuse documentation.
It is recommended to create a single workflow for all Puppet tests and name it .github/workflows/puppet.yml
.
There is a workflow defined that runs the basic tests. It does not run acceptance tests.
name: CI
on: pull_request
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v1
To disable Rubocop, modify the job:
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v1
with:
rubocop: false
For modules using beaker for acceptance testing there is a workflow which also includes the basic tests. Like basic tests, it accepts a rubocop
parameter.
name: CI
on: pull_request
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
The release workflow relies on puppet-blacksmith and in particular the module:push
rake task.
There is one input:
allowed_owner
- The workflow only runs if the owner matches. This prevents forks from attempting to release.
There are multiple secrets (GitHub's secrets documentation):
username
- The Puppet Forge usernameapi_key
- The Puppet Forge API key
It is recommended to create a workflow .github/workflows/release.yml
.
name: Release
on:
push:
tags:
- '*'
jobs:
deploy:
name: Deploy
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
with:
allowed_owner: MY_GITHUB_USERNAME
secrets:
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}