diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30d3080..9fa44bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,90 @@ jobs: 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@4dee504a6623266617ce7b47ae3ecbc1939788ad" - secrets: "inherit" + setup_matrix: + name: "Setup Test Matrix" + runs-on: ubuntu-latest + outputs: + acceptance_matrix: ${{ steps.get-matrix.outputs.matrix }} + + env: + BUNDLE_WITHOUT: release_prep + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Setup ruby" + uses: "ruby/setup-ruby@v1" + with: + ruby-version: "3.1" + 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_v3 --puppet-exclude 7 + + acceptance: + name: "Acceptance tests (${{matrix.platforms.label}}, ${{matrix.collection}})" + needs: "setup_matrix" + runs-on: ${{ inputs.runs_on || matrix.platforms.runner }} + timeout-minutes: 180 + strategy: + fail-fast: false + matrix: ${{ fromJson( needs.setup_matrix.outputs.acceptance_matrix ) }} + + env: + BUNDLE_WITHOUT: release_prep + PUPPET_GEM_VERSION: '~> 8.9' + 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: "3.1" + bundler-cache: true + + - name: "Bundle environment" + run: | + echo ::group::bundler environment + bundle env + echo ::endgroup:: + + - name: "Provision environment" + run: | + DOCKER_RUN_OPTS='' + 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' + + - name: "Install module" + run: | + bundle exec rake 'litmus:install_module' + + - name: "Run acceptance tests" + run: | + bundle exec rake 'litmus:acceptance:parallel' + + - 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 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e52a636..b7d4f23 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -9,7 +9,91 @@ 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@4dee504a6623266617ce7b47ae3ecbc1939788ad" - secrets: "inherit" + + setup_matrix: + name: "Setup Test Matrix" + runs-on: ubuntu-latest + outputs: + acceptance_matrix: ${{ steps.get-matrix.outputs.matrix }} + + env: + BUNDLE_WITHOUT: release_prep + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Setup ruby" + uses: "ruby/setup-ruby@v1" + with: + ruby-version: "3.1" + 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_v3 --puppet-exclude 7 + + acceptance: + name: "Acceptance tests (${{matrix.platforms.label}}, ${{matrix.collection}})" + needs: "setup_matrix" + runs-on: ${{ inputs.runs_on || matrix.platforms.runner }} + timeout-minutes: 180 + strategy: + fail-fast: false + matrix: ${{ fromJson( needs.setup_matrix.outputs.acceptance_matrix ) }} + + env: + BUNDLE_WITHOUT: release_prep + PUPPET_GEM_VERSION: '~> 8.9' + 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: "3.1" + bundler-cache: true + + - name: "Bundle environment" + run: | + echo ::group::bundler environment + bundle env + echo ::endgroup:: + + - name: "Provision environment" + run: | + DOCKER_RUN_OPTS='' + 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' + + - name: "Install module" + run: | + bundle exec rake 'litmus:install_module' + + - name: "Run acceptance tests" + run: | + bundle exec rake 'litmus:acceptance:parallel' + + - 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