include:
    # Metadata shared my many jobs
    - local: .gitlab/rules.yml
    - local: .gitlab/artifacts.yml
    - local: .gitlab/warning-policy.yml

    # OS builds.
    - local: .gitlab/os-linux.yml
    - local: .gitlab/os-macos.yml
    - local: .gitlab/os-windows.yml

stages:
    - build
    - test

################################################################################
# Job declarations
#
# Each job must pull in each of the following keys:
#
#   - a "base image"
#   - a build script
#   - tags for the jobs
#     - already provided for upload and CI update jobs
#   - rules for when to run the job
#
# Additionally, jobs may also contain:
#
#   - artifacts
#   - needs jobs for required jobs
################################################################################

# Linux

## Spack

# spack-centos7:build:
#     extends:
#         - .centos7
#         - .spack_build_linux
#         - .linux_builder_tags
#         - .run_scheduled

## Linux

el7-mindeps-shared-mpi-python:build:
    extends:
        - .el7_mindeps_shared_mpi_python
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_build_artifacts
        - .run_manually

# Disable testing for now. Even with a modern Mesa and the llvmpipe backend,
# modern enough OpenGL is just not working in CI. Rather than disabling just
# about everything in the test suite, just skip testing altogether.
# el7-mindeps-shared-mpi-python:test:
#     extends:
#         - .el7_mindeps_shared_mpi_python
#         - .cmake_test_linux
#         - .linux_tester_tags
#         - .cmake_test_artifacts
#         - .run_automatically
#     needs:
#         - el7-mindeps-shared-mpi-python:build

fedora35-static-mpi-offscreen-osmesa-python:build:
    extends:
        - .fedora35_static_mpi_offscreen_osmesa_python
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_build_artifacts
        - .run_manually

fedora35-static-mpi-offscreen-osmesa-python:test:
    extends:
        - .fedora35_static_mpi_offscreen_osmesa_python
        - .cmake_test_linux
        - .linux_builder_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - fedora35-static-mpi-offscreen-osmesa-python:build

el8-shared-icc-mpi-python:build:
    extends:
        - .el8_shared_icc_mpi_python
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_build_artifacts
        - .run_manually

el8-shared-icc-mpi-python:test:
    extends:
        - .el8_shared_icc_mpi_python
        - .cmake_test_linux
        - .linux_tester_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - el8-shared-icc-mpi-python:build

fedora35-shared-debug-mpi-python-qt:build:
    extends:
        - .fedora35_shared_debug_mpi_python_qt
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_build_artifacts
        - .run_manually

fedora35-shared-debug-mpi-python-qt:test:
    extends:
        - .fedora35_shared_debug_mpi_python_qt
        - .cmake_test_linux
        - .linux_tester_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - fedora35-shared-debug-mpi-python-qt:build
    timeout: 180 minutes

fedora35-shared-mpi-python-qt-vtkmoverride:build:
    extends:
        - .fedora35_shared_mpi_python_qt_vtkmoverride
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_build_artifacts
        - .run_manually

fedora35-shared-mpi-python-qt-vtkmoverride:test:
    extends:
        - .fedora35_shared_mpi_python_qt_vtkmoverride
        - .cmake_test_linux
        - .linux_tester_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - fedora35-shared-mpi-python-qt-vtkmoverride:build
    timeout: 120 minutes

# Translations

translations:test:
    extends:
        - .fedora35_shared_debug_mpi_python_qt
        - .cmake_translations_linux
        - .linux_tester_tags
        - .cmake_translations_artifacts
        - .merged_only
    needs:
        - fedora35-shared-debug-mpi-python-qt:build
    timeout: 15 minutes

## Catalyst editions

fedora35-shared-mpi-core:build:
    extends:
        - .fedora35_shared_mpi_core
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_build_artifacts
        - .run_manually

fedora35-shared-mpi-core:test:
    extends:
        - .fedora35_shared_mpi_core
        - .cmake_test_linux
        - .linux_tester_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - fedora35-shared-mpi-core:build

fedora35-shared-mpi-python-core:build:
    extends:
        - .fedora35_shared_mpi_python_core
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_build_artifacts
        - .run_manually

fedora35-shared-mpi-python-core:test:
    extends:
        - .fedora35_shared_mpi_python_core
        - .cmake_test_linux
        - .linux_tester_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - fedora35-shared-mpi-python-core:build

## Static analysis

fedora35-tidy:build:
    extends:
        - .fedora35_tidy
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_tidy_artifacts
        - .run_manually
    # clang-tidy is *really* slow because it isn't cached.
    timeout: 3 hours

# macOS

macos-arm64-python-qt:build:
    extends:
        - .macos_arm64_python_qt
        - .cmake_build_macos
        - .macos_arm64_builder_tags
        - .cmake_build_artifacts
        - .run_manually

macos-arm64-python-qt:test:
    extends:
        - .macos_arm64_python_qt
        - .cmake_test_macos
        - .macos_arm64_builder_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - macos-arm64-python-qt:build

macos-x86_64-python-qt:build:
    extends:
        - .macos_x86_64_python_qt
        - .cmake_build_macos
        - .macos_x86_64_builder_tags
        - .cmake_build_artifacts
        - .run_manually

macos-x86_64-python-qt:test:
    extends:
        - .macos_x86_64_python_qt
        - .cmake_test_macos
        - .macos_x86_64_builder_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - macos-x86_64-python-qt:build

# Windows

windows-vs2022-kits-mpi-python-qt:build:
    extends:
        - .windows_vs2022_kits_mpi_python_qt
        - .cmake_build_windows
        - .windows_builder_tags
        - .cmake_build_artifacts
        - .run_manually
    timeout: 90 minutes

windows-vs2022-kits-mpi-python-qt:test:
    extends:
        - .windows_vs2022_kits_mpi_python_qt
        - .cmake_test_windows
        - .windows_test_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - windows-vs2022-kits-mpi-python-qt:build
    timeout: 90 minutes

windows-vs2022-qt:build:
    extends:
        - .windows_vs2022_qt
        - .cmake_build_windows
        - .windows_builder_tags
        - .cmake_build_artifacts
        - .run_manually
    timeout: 90 minutes

windows-vs2022-qt:test:
    extends:
        - .windows_vs2022_qt
        - .cmake_test_windows
        - .windows_test_tags
        - .cmake_test_artifacts
        - .run_automatically
    needs:
        - windows-vs2022-qt:build
    timeout: 90 minutes

# Deployment

## Documentation

documentation:build:
    extends:
        - .fedora35
        - .doxygen_build_linux
        - .linux_builder_tags
        - .doxygen_log_artifacts
        - .doxygen_only

fedora35-doxygen:build:
    extends:
        - .fedora35
        - .cmake_build_linux
        - .linux_builder_tags
        - .cmake_doxygen_artifacts
        - .run_manually

    variables:
        CMAKE_CONFIGURATION: fedora35_doxygen

# Triggers

## Superbuild

superbuild:build:
    extends:
        - .run_superbuild_trigger
    stage: build
    variables:
        PARAVIEW_BRANCH: $CI_COMMIT_REF_NAME
        RSYNC_UPLOAD_ENABLE: "true"
    trigger:
        project: paraview/paraview-superbuild
        branch: $CI_COMMIT_REF_NAME
        strategy: depend
