# Copyright 2020-2024, Collabora, Ltd
# SPDX-License-Identifier: BSL-1.0
#
# Author: Rylie Pavlik <rylie.pavlik@collabora.com>
# Author: Simon Zeni <simon.zeni@collabora.com>

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
    - if: $CI_PIPELINE_SOURCE == 'push'

include:
  - project: "freedesktop/ci-templates"
    ref: 185ede0e9b9b1924b92306ab8b882a6294e92613
    file: "/templates/debian.yml"

stages:
  - container_prep
  - test

variables:
  FDO_UPSTREAM_REPO: "monado/utilities/xr-hardware"

.xrhardware.debian:bookworm:
  variables:
    FDO_DISTRIBUTION_VERSION: "bookworm"
    FDO_DISTRIBUTION_TAG: "2024-02-28"

debian:bookworm:container_prep:
  stage: container_prep
  extends:
    - .fdo.container-build@debian
    - .xrhardware.debian:bookworm
  variables:
    FDO_DISTRIBUTION_PACKAGES: "python3 python3-attr python3-flake8 git make black"

test-db-and-generated:
  stage: test
  extends:
    - .fdo.distribution-image@debian
    - .xrhardware.debian:bookworm
  script:
    - make test
    - make lint
    - make clean
    - make all
    # Fail the build if files are out of date.
    - git diff --quiet

reuse:
  stage: test
  variables:
    GIT_STRATEGY: clone
  image:
    name: fsfe/reuse:latest
    entrypoint: [""]
  script:
    - reuse lint
