.dnf-openssl-backend:
  variables:
    DISTRO: cryptsetup-fedora-rawhide
    PKGS: >-
      autoconf automake device-mapper-devel gcc gettext-devel json-c-devel
      libargon2-devel libblkid-devel libpwquality-devel libselinux-devel
      libssh-devel libtool libuuid-devel make popt-devel
      libsepol-devel.x86_64 netcat openssh-clients passwd pkgconfig sharutils
      sshpass tar uuid-devel vim-common device-mapper expect gettext git jq
      keyutils openssl-devel openssl asciidoctor swtpm meson ninja-build
      python3-jinja2 gperf libcap-devel tpm2-tss-devel libmount-devel swtpm-tools
  extends:
    - .fail_if_coredump_generated
  before_script:
    - sudo dnf clean all
    - (r=3;while ! sudo dnf -y -q install $PKGS ; do ((--r))||exit;sleep 5;echo "Retrying";done)
    - sudo -E git clean -xdf
    - ./autogen.sh
    - ./configure --enable-fips --enable-pwquality --enable-libargon2 --with-crypto_backend=openssl --enable-asciidoc

test-main-commit-job-rawhide:
  extends:
    - .dnf-openssl-backend
  tags:
    - libvirt
    - cryptsetup-fedora-rawhide
  stage: test
  interruptible: true
  allow_failure: true
  variables:
    RUN_SSH_PLUGIN_TEST: "1"
    RUN_KEYRING_TRUSTED_TEST: "1"
    RUN_SYSTEMD_PLUGIN_TEST: "1"
  rules:
    - if: $CI_PROJECT_PATH != "cryptsetup/cryptsetup"
      when: never
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /v2\..\.x$/
  script:
    - make -j
    - make -j -C tests check-programs
    - sudo -E make check

test-mergerq-job-rawhide:
  extends:
    - .dnf-openssl-backend
  tags:
    - libvirt
    - cryptsetup-fedora-rawhide
  stage: test
  interruptible: true
  allow_failure: true
  variables:
    RUN_SSH_PLUGIN_TEST: "1"
    RUN_KEYRING_TRUSTED_TEST: "1"
    RUN_SYSTEMD_PLUGIN_TEST: "1"
  rules:
    - if: $CI_PROJECT_PATH != "cryptsetup/cryptsetup"
      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
  script:
    - make -j
    - make -j -C tests check-programs
    - sudo -E make check
