name: vm

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  # Cancel stale PR runs without interrupting push, tag, scheduled, or
  # manually dispatched validation.
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
  contents: read

on:
  workflow_dispatch:
  push:
    branches:
      - 'master'
      - '[0-9]+.[0-9]+'
      - '[0-9]+.x'
  pull_request:

jobs:
  validate-dco:
    uses: ./.github/workflows/.dco.yml

  vm:
    needs:
      - validate-dco
    uses: ./.github/workflows/.vm.yml
    strategy:
      fail-fast: false
      matrix:
        include:
          # EL 8 is used for running the tests with cgroup v1.
          # Do not upgrade this to EL 9 until formally deprecating the cgroup v1 support.
          #
          # To minimize CI time the whole test suite takes, only run
          # integration packages that currently contain cgroup-v1/v2 specific
          # coverage (cgroup namespaces, cgroup driver/systemd, and resource
          # update verification via /sys/fs/cgroup paths).
          #
          # FIXME: use almalinux-8, then probably no need to keep oraclelinux-8 here.
          # On almalinux-8, port forwarding tests are failing:
          # https://github.com/moby/moby/pull/49819#issuecomment-2815676000
          - template: template:oraclelinux-8  # Oracle's kernel 5.15
            integration_dir: ./integration/container ./integration/build ./integration/system
    with:
      template: ${{ matrix.template }}
      integration_dir: ${{ matrix.integration_dir }}