Skip to content

Commit

Permalink
manually update github actions from current moduleysnc template
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMeier committed Dec 30, 2024
1 parent b2650aa commit c42d506
Showing 1 changed file with 48 additions and 9 deletions.
57 changes: 48 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ concurrency:

jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
timeout-minutes: 40
defaults:
run:
working-directory: ${{ inputs.working-directory }}
name: Static validations
runs-on: ubuntu-24.04
timeout-minutes: ${{ inputs.timeout_minutes }}
outputs:
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
puppet_beaker_test_matrix: ${{ steps.get-outputs.outputs.puppet_beaker_test_matrix }}
Expand All @@ -20,18 +23,26 @@ jobs:
PUPPET_GEM_VERSION: ">= 7.0"
steps:
- uses: actions/checkout@v4
- name: install additional packages
if: ${{ inputs.additional_packages != '' }}
run: |
sudo apt-get update
sudo apt-get install -y ${{ inputs.additional_packages }}
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
ruby-version: '3.2'
bundler-cache: true
cache-version: ${{ inputs.cache-version }}
working-directory: ${{ inputs.working-directory }}
- name: Run static validations
run: bundle exec rake validate lint check
- name: Run rake rubocop
run: bundle exec rake rubocop
if: ${{ inputs.rubocop }}
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --pidfile-workaround false --domain example.com
run: bundle exec metadata2gha --domain ${{ inputs.domain }} --pidfile-workaround ${{ inputs.pidfile_workaround }} --beaker-facter "${{ inputs.beaker_facter }}" --beaker-hosts "${{ inputs.beaker_hosts }}"

unit:
needs: setup_matrix
Expand All @@ -56,22 +67,46 @@ jobs:
run: bundle exec rake parallel_spec

acceptance:
defaults:
run:
working-directory: ${{ inputs.working-directory }}
needs: setup_matrix
runs-on: ubuntu-20.04
runs-on: ${{ inputs.acceptance_runs_on }}
env:
BUNDLE_WITHOUT: development:test:release
BEAKER_HCLOUD_TOKEN: '${{ secrets.beaker_hcloud_token }}'
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.puppet_beaker_test_matrix)}}
name: "${{ matrix.name }}"
steps:
- uses: actions/checkout@v4
- name: install additional packages
if: ${{ inputs.additional_packages != '' }}
run: |
sudo apt-get update
sudo apt-get install -y ${{ inputs.additional_packages }}
- name: Setup podman
if: ${{ inputs.beaker_hypervisor == 'container_podman' }}
run: |
systemctl start --user podman.socket
echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV"
- name: Setup libvirt for Vagrant
if: ${{ inputs.beaker_hypervisor == 'vagrant_libvirt' && inputs.install_vagrant_dependencies == true }}
run: |
sudo add-apt-repository ppa:evgeni/vagrant
sudo apt-get update
sudo apt-get install -y --no-install-recommends vagrant vagrant-libvirt libvirt-daemon-system libvirt-daemon qemu-system-x86 qemu-utils dnsmasq
sudo chmod 666 /var/run/libvirt/libvirt-sock
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
ruby-version: '3.2'
bundler-cache: true
cache-version: ${{ inputs.cache-version }}
working-directory: ${{ inputs.working-directory }}
self-hosted: ${{ ! startsWith(inputs.acceptance_runs_on, 'ubuntu-') }}
- name: Start squid
run: ./scripts/start-squid.sh
- name: Run tests
Expand All @@ -82,10 +117,14 @@ jobs:
if: always()

tests:
if: always()
needs:
- unit
- acceptance
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Test suite
steps:
- run: echo Test suite completed
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

0 comments on commit c42d506

Please sign in to comment.