# This workflow puts together all known "flaky" and experimental targets
name: "[flaky, see #3988]"

on:
  push:
    branches:
      - main
      - 'release/**'
  pull_request:
    paths-ignore:
      - '**.md'

jobs:
  test-integration-el:
    name: "EL${{ inputs.hack }}"
    uses: ./.github/workflows/job-test-in-lima.yml
    strategy:
      fail-fast: false
      # EL8 is used for testing compatibility with cgroup v1.
      # Unfortunately, EL8 is hard to debug for M1 users (as Lima+M1+EL8 is not runnable because of page size),
      # and it currently shows numerous issues.
      # Thus, EL9 is also added as target (for a limited time?) so that we can figure out which issues are EL8 specific,
      # and which issues could be reproduced on EL9 as well (which would be easier to debug).
      matrix:
        guest: ["almalinux-8", "almalinux-9"]
        target: ["rootful", "rootless"]
    with:
      timeout: 60
      runner: ubuntu-24.04
      guest: ${{ matrix.guest }}
      target: ${{ matrix.target }}

  test-integration-freebsd:
    name: "FreeBSD"
    uses: ./.github/workflows/job-test-in-vagrant.yml
    with:
      timeout: 15
      runner: ubuntu-24.04

  kube:
    name: "kubernetes"
    runs-on: ubuntu-24.04
    timeout-minutes: 15
    env:
      ROOTFUL: true
    steps:
      - name: "Init: checkout"
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2
        with:
          fetch-depth: 1
      - name: "Run"
        run: |
          # FIXME: this should be a bit more elegant to use.
          ./hack/provisioning/kube/kind.sh
          # See https://github.com/containerd/nerdctl/blob/main/docs/testing/README.md#about-parallelization
          sudo ./_output/nerdctl exec nerdctl-test-control-plane bash -c -- 'export TMPDIR="$HOME"/tmp; mkdir -p "$TMPDIR"; cd /nerdctl-source; /usr/local/go/bin/go test -p 1 ./cmd/nerdctl/... -test.only-kubernetes'
