workflow:
  auto_cancel:
    on_new_commit: interruptible


include:
  - project: Infrastructure/freedesktop-ci-templates
    file: templates/fedora.yml

.fedora:
  extends: .fdo.distribution-image@fedora
  interruptible: true
  needs: ["docker-image"]
  variables:
    ###
    # IMPORTANT
    # These are the version tags for the docker images the CI runs against.
    # If you are hacking on them or need a them to rebuild, its enough
    # to change any part of the string of the image you want.
    ###
    FDO_DISTRIBUTION_TAG: '2025-03-26.2'
    FDO_DISTRIBUTION_VERSION: '41'
    FDO_DISTRIBUTION_PACKAGES: >
      meson lcms2-devel git diffutils shellcheck devscripts
    FDO_UPSTREAM_REPO: $CI_PROJECT_PATH
    # Enable colorful output when supported (e.g. ninja)
    CLICOLOR_FORCE: "1"
    # Disable timestamps on CI logs
    FF_TIMESTAMPS: false


stages:
  - dependencies
  - build
  - analysis


docker-image:
  extends:
    - .fedora
    - .fdo.container-build@fedora
  needs: []
  stage: dependencies
  variables:
    GIT_STRATEGY: none

fedora-x86_64:
  extends: .fedora
  stage: build
  script:
    - meson --buildtype debug
            --fatal-meson-warnings
            --default-library=both
            _build
    - ninja -C _build
  artifacts:
    name: "babl-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
    when: always
    paths:
      - "_build/meson-logs"
    expire_in: 8 days

meson-health:
  extends: .fedora
  stage: analysis
  script:
    - sh .gitlab/run_meson_health_diff.sh
  allow_failure: true

branches-check:
  extends: .fedora
  rules:
    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS == null && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
  stage: analysis
  variables:
    GIT_DEPTH: "0"
  script:
    - sh .gitlab/check_dead_branches.sh
  allow_failure: true
