Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip ci #382

Closed
wants to merge 16 commits into from
Closed
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
22 changes: 18 additions & 4 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,26 @@ fixtures:
inifile: 'https://github.com/puppetlabs/puppetlabs-inifile.git'
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
postgresql: 'https://github.com/puppetlabs/puppet-postgresql.git'
firewall: 'https://github.com/puppetlabs/puppetlabs-firewall.git'
apt: 'https://github.com/puppetlabs/puppetlabs-apt.git'
concat: 'https://github.com/puppetlabs/puppetlabs-concat.git'
file_concat: 'https://github.com/electrical/puppet-lib-file_concat.git'
systemd: 'https://github.com/camptocamp/puppet-systemd.git'
cron: 'https://github.com/voxpupuli/puppet-cron.git'
cron_core: 'https://github.com/puppetlabs/puppetlabs-cron_core.git'
yumrepo_core: 'https://github.com/puppetlabs/puppetlabs-yumrepo_core.git'
augeas_core: 'https://github.com/puppetlabs/puppetlabs-augeas_core.git'
provision: 'https://github.com/puppetlabs/provision.git'
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
facts: 'https://github.com/puppetlabs/puppetlabs-facts.git'
cron_core:
repo: https://github.com/puppetlabs/puppetlabs-cron_core.git
puppet_version: ">= 6.0.0"
yumrepo_core:
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
puppet_version: ">= 6.0.0"
augeas_core:
repo: https://github.com/puppetlabs/puppetlabs-augeas_core.git
puppet_version: ">= 6.0.0"
forge_modules:
firewall:
repo: 'puppetlabs/firewall'
ref: "6.0.0"
symlinks:
puppetdb: '#{source_dir}'
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "ci"

on:
pull_request:
branches:
- "main"
paths-ignore:
- '**.md'
- 'examples/**'
- 'LICENSE'
- 'CODEOWNERS'
- 'AUTHORS'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Spec:
uses: "./.github/workflows/module_ci.yml"
secrets: "inherit"

Acceptance:
needs: Spec
uses: "./.github/workflows/module_acceptance.yml"
secrets: "inherit"
with:
runs_on: ubuntu-20.04
flags: "--exclude-platforms '[\"ubuntu-18.04\",\"redhat-8\",\"redhat-7\",\"Scientific-7\",\"CentOS-7\",\"OracleLinux-7\"]'" # EL7 is failing on GHA, ubuntu 18 module updates
27 changes: 27 additions & 0 deletions .github/workflows/labeller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Labeller

on:
issues:
types:
- opened
- labeled
- unlabeled
pull_request_target:
types:
- opened
- labeled
- unlabeled

jobs:
label:
runs-on: ubuntu-latest
steps:

- uses: puppetlabs/[email protected]
name: Label issues or pull requests
with:
label_name: community
label_color: '5319e7'
org_membership: puppetlabs
fail_if_member: 'true'
token: ${{ secrets.IAC_COMMUNITY_LABELER }}
109 changes: 109 additions & 0 deletions .github/workflows/module_acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# This is a generic workflow for Puppet module acceptance operations.
name: "Module Acceptance"

on:
workflow_call:
inputs:
runs_on:
description: "The operating system used for the runner."
required: false
default: "ubuntu-latest"
type: "string"
flags:
description: "Additional flags to pass to matrix_from_metadata_v2."
required: false
default: ''
type: "string"

jobs:

setup_matrix:
name: "Setup Test Matrix"
runs-on: ${{ inputs.runs_on }}
outputs:
acceptance_matrix: ${{ steps.get-matrix.outputs.matrix }}

steps:

- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "2.7"
bundler-cache: true

- name: "Bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::

- name: Setup Test Matrix
id: get-matrix
run: |
bundle exec matrix_from_metadata_v2 ${{ inputs.flags }}

acceptance:
name: "Acceptance tests (${{matrix.platforms.label}}, ${{matrix.collection}})"
needs: "setup_matrix"
runs-on: ${{ inputs.runs_on }}
timeout-minutes: 30
strategy:
max-parallel: 6
fail-fast: false
matrix: ${{ fromJson( needs.setup_matrix.outputs.acceptance_matrix ) }}

env:
PUPPET_GEM_VERSION: '~> 7.24'
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?

steps:

- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "2.7"
bundler-cache: true

- name: "Bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::

- name: "Provision environment"
run: |
if [[ "${{matrix.platforms.provider}}" == "docker" ]]; then
DOCKER_RUN_OPTS="docker_run_opts: {'--volume': '/lib/modules/$(uname -r):/lib/modules/$(uname -r)'}"
else
DOCKER_RUN_OPTS=''
fi
bundle exec rake "litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }},$DOCKER_RUN_OPTS]"
# Redact password
FILE='spec/fixtures/litmus_inventory.yaml'
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true

- name: "Install Puppet agent"
run: |
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'

- name: "Install module"
run: |
bundle exec rake 'litmus:install_module'

- name: "Run acceptance tests"
run: |
bundle exec rake 'litmus:acceptance'

- name: "Remove test environment"
if: ${{ always() }}
continue-on-error: true
run: |
if [[ -f spec/fixtures/litmus_inventory.yaml ]]; then
bundle exec rake 'litmus:tear_down'
fi
86 changes: 86 additions & 0 deletions .github/workflows/module_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# This is a generic workflow for Puppet module CI operations.
name: "Module CI"

on:
workflow_call:
inputs:
runs_on:
description: "The operating system used for the runner."
required: false
default: "ubuntu-latest"
type: "string"
flags:
description: "Additional flags to pass to matrix_from_metadata_v2."
required: false
default: ''
type: "string"

jobs:
setup_matrix:
name: "Setup Test Matrix"
runs-on: ${{ inputs.runs_on }}
outputs:
spec_matrix: ${{ steps.get-matrix.outputs.spec_matrix }}

steps:

- name: "Checkout"
uses: "actions/checkout@v4"
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: "Setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "2.7"
bundler-cache: true

- name: "Bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::

- name: Setup Spec Test Matrix
id: get-matrix
run: |
bundle exec matrix_from_metadata_v2 ${{ inputs.flags }}

spec:
name: "Spec tests (Puppet: ${{matrix.puppet_version}}, Ruby Ver: ${{matrix.ruby_version}})"
needs: "setup_matrix"
runs-on: ${{ inputs.runs_on }}
strategy:
fail-fast: false
matrix: ${{ fromJson( needs.setup_matrix.outputs.spec_matrix ) }}

env:
PUPPET_GEM_VERSION: ${{ matrix.puppet_version }}
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: "Setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: ${{matrix.ruby_version}}
bundler-cache: true

- name: "Bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::

- name: "Run Static & Syntax Tests"
run: |
bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
bundle exec dependency-checker metadata.json || true # temporarily allow to fail

- name: "Run tests"
run: |
bundle exec rake parallel_spec
18 changes: 18 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "nightly"

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
Spec:
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
secrets: "inherit"

Acceptance:
needs: Spec
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
secrets: "inherit"
with:
runs_on: "ubuntu-20.04"
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: "Publish module"

on:
workflow_dispatch:

jobs:
release:
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release.yml@main"
secrets: "inherit"
15 changes: 15 additions & 0 deletions .github/workflows/release_prep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Release Prep"

on:
workflow_dispatch:
inputs:
version:
description: "Module version to be released. Must be a valid semver string. (1.2.3)"
required: true

jobs:
release_prep:
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release_prep.yml@main"
with:
version: "${{ github.event.inputs.version }}"
secrets: "inherit"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/spec/fixtures/modules/*
/tmp/
/vendor/
/convert_report.txt
Expand All @@ -25,3 +25,4 @@
.project
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
45 changes: 0 additions & 45 deletions .nodeset.yml

This file was deleted.

Loading