# SPDX-FileCopyrightText: 2021 Felipe Lema <felipelema@mortemale.org>
# SPDX-FileCopyrightText: 2022 Nicolás Alvarez <nicolas.alvarez@gmail.com>
# SPDX-License-Identifier: CC0-1.0

variables:
  DEBIAN_FRONTEND: "noninteractive"

clang_format:
  stage: build
  image: debian:testing
  before_script:
    - apt-get update
    - apt-get install --yes --no-install-recommends wget ca-certificates git clang-format-11
    - update-ca-certificates
  script:
    - ./.gitlab-ci.script
  rules:
    - when: manual
      allow_failure: true

workflow:
  rules:
    # Prevent branch pipelines if an MR is open on the branch.
    - if: $CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS
      when: never
    # Allow merge request pipelines.
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    # Build tags and branches too
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_COMMIT_BRANCH =~ /^krita\//

include:
  - local: /build-tools/ci-scripts/cppcheck.yml
  - local: /build-tools/ci-scripts/linux.yml
  - local: /build-tools/ci-scripts/windows.yml