Skip to content

Commit

Permalink
feat: Add Puppet workflows (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
coreone authored Sep 23, 2023
1 parent 084107e commit b49d972
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/puppet-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
'on':
workflow_call:
inputs:
jobs_run_on:
default: ubuntu-latest
description: The runner group on which jobs will run.
required: false
type: string
puppet_version:
default: '7'
description: The version of Puppet to use in PDK
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
required: false
type: number
working_directory:
description: The working directory where all jobs should be executed.
default: '.'
required: false
type: string

jobs:
linting:
defaults:
run:
working-directory: ${{ inputs.working_directory }}
runs-on: ${{ inputs.jobs_run_on }}
steps:
- name: 'Checkout repo'
uses: 'actions/checkout@v4'
- name: 'Set up Ruby'
uses: 'ruby/[email protected]'
env:
BUNDLE_SILENCE_ROOT_WARNING: '1'
BUNDLE_WITH: 'development'
PUPPET_GEM_VERSION: "~> ${{ inputs.puppet_version }}"
with:
bundler-cache: true
ruby-version: '3.2'
rubygems: 'latest'
- name: 'Run static analysis'
run: bundle exec pdk validate --puppet-version=${{ inputs.puppet_version }}
timeout-minutes: ${{ inputs.timeout_minutes }}
49 changes: 49 additions & 0 deletions .github/workflows/puppet-test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
'on':
workflow_call:
inputs:
jobs_run_on:
default: ubuntu-latest
description: The runner group on which jobs will run.
required: false
type: string
puppet_package_name:
default: ''
description: The name of the PyPi package the repo will create.
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
required: false
type: number
working_directory:
description: The working directory where all jobs should be executed.
default: '.'
required: false
type: string

jobs:
linting:
defaults:
run:
working-directory: ${{ inputs.working_directory }}
runs-on: ${{ inputs.jobs_run_on }}
steps:
- name: 'Checkout repo'
uses: 'actions/checkout@v4'
- name: 'Set up Ruby'
uses: 'ruby/[email protected]'
env:
BUNDLE_SILENCE_ROOT_WARNING: '1'
BUNDLE_WITH: 'development'
PUPPET_GEM_VERSION: "~> ${{ inputs.puppet_version }}"
with:
bundler-cache: true
ruby-version: '3.2'
rubygems: 'latest'
- name: 'Module build'
run: 'bundle exec pdk build --puppet-version=${{ inputs.puppet_version }} --force'
- name: 'Test module install'
run: 'bundle exec puppet module install pkg/${{ inputs.puppet_package_name }}-*.tar.gz'
timeout-minutes: ${{ inputs.timeout_minutes }}
50 changes: 50 additions & 0 deletions .github/workflows/puppet-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
'on':
workflow_call:
inputs:
jobs_run_on:
default: ubuntu-latest
description: The runner group on which jobs will run.
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
required: false
type: number
working_directory:
description: The working directory where all jobs should be executed.
default: '.'
required: false
type: string

jobs:
unit-tests:
defaults:
run:
working-directory: ${{ inputs.working_directory }}
runs-on: ${{ inputs.jobs_run_on }}
strategy:
matrix:
puppet:
- '7'
- '8'
ruby:
- '3.1'
- '3.2'
steps:
- name: 'Checkout repo'
uses: 'actions/checkout@v4'
- name: 'Set up Ruby'
uses: 'ruby/[email protected]'
env:
BUNDLE_SILENCE_ROOT_WARNING: '1'
BUNDLE_WITH: 'development'
PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}"
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
rubygems: 'latest'
- name: 'Run unit tests'
run: 'bundle exec pdk test unit --puppet-version=${{ matrix.puppet }} -v'
timeout-minutes: ${{ inputs.timeout_minutes }}

0 comments on commit b49d972

Please sign in to comment.