Skip to content

Commit

Permalink
Merge pull request #42 from ekohl/set-in-env-var
Browse files Browse the repository at this point in the history
Support BEAKER_FACTER matrix generation
  • Loading branch information
bastelfreak authored Oct 11, 2023
2 parents d5c0131 + c6ee8e9 commit 7176c2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/beaker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ on:
default: docker
required: false
type: string
beaker_facter:
description: Expand the Beaker matrix based on a fact
default: 'false'
required: false
type: string
domain:
description: The domain that will be used for the beaker instances
default: "example.com"
Expand All @@ -55,6 +60,9 @@ on:
required: false
type: string

env:
BEAKER_HYPERVISOR: ${{ inputs.beaker_hypervisor }}

jobs:
setup_matrix:
defaults:
Expand All @@ -65,7 +73,7 @@ jobs:
timeout-minutes: ${{ inputs.timeout_minutes }}
outputs:
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }}
puppet_beaker_test_matrix: ${{ steps.get-outputs.outputs.puppet_beaker_test_matrix }}
env:
BUNDLE_WITHOUT: development:system_tests:release
PUPPET_GEM_VERSION: "~> 7.0"
Expand All @@ -88,7 +96,7 @@ jobs:
if: ${{ inputs.rubocop }}
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --domain ${{ inputs.domain }} --pidfile-workaround ${{ inputs.pidfile_workaround }}
run: bundle exec metadata2gha --domain ${{ inputs.domain }} --pidfile-workaround ${{ inputs.pidfile_workaround }} --beaker-facter "${{ inputs.beaker_facter }}"

unit:
defaults:
Expand Down Expand Up @@ -131,8 +139,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
# TODO: beaker_fact_matrix input
include: ${{fromJson(needs.setup_matrix.outputs.puppet_beaker_test_matrix)}}
name: "${{ matrix.name }}"
steps:
- uses: actions/checkout@v4
Expand All @@ -148,10 +155,7 @@ jobs:
working-directory: ${{ inputs.working-directory }}
- name: Run tests
run: bundle exec rake beaker
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_SETFILE: ${{ matrix.setfile.value }}
BEAKER_HYPERVISOR: ${{ inputs.beaker_hypervisor }}
env: ${{ matrix.env }}

tests:
needs:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ group :test do
# CI will typically set it to '~> 7.0' to get 7.x
gem 'puppet', ENV.fetch('PUPPET_GEM_VERSION', '>= 0'), require: false
# Needed to build the test matrix based on metadata
gem 'puppet_metadata', '~> 3.3', require: false
gem 'puppet_metadata', '~> 3.4', require: false
# Needed for the rake tasks
gem 'puppetlabs_spec_helper', '>= 2.16.0', '< 7', require: false
# Rubocop versions are also specific so it's recommended
Expand Down

0 comments on commit 7176c2f

Please sign in to comment.