From c42d506d564acdd3511ec81457ee4dc1f1876fb3 Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Mon, 30 Dec 2024 09:59:01 +0100 Subject: [PATCH] manually update github actions from current moduleysnc template --- .github/workflows/ci.yml | 57 +++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b29b925a5..5c092d55a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} @@ -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 @@ -56,10 +67,14 @@ 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: @@ -67,11 +82,31 @@ jobs: 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 @@ -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) }}