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

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

stages:
    - build
    - test
    - analyze

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

# Linux

## Build and test

fedora33:build:
    extends:
        - .fedora33
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_automatically

fedora33:test:
    extends:
        - .fedora33
        - .cmake_test_linux
        - .cmake_test_artifacts
        - .linux_test_tags
        - .run_dependent
    dependencies:
        - fedora33:build
    needs:
        - fedora33:build

fedora33-vtk-python3:build:
    extends:
        - .fedora33_vtk_python3
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_automatically

fedora33-vtk-python3:test:
    extends:
        - .fedora33_vtk_python3
        - .cmake_test_linux
        - .cmake_test_artifacts
        - .linux_test_tags
        - .run_dependent
    dependencies:
        - fedora33-vtk-python3:build
    needs:
        - fedora33-vtk-python3:build

fedora33-paraview:build:
    extends:
        - .fedora33_paraview
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_automatically

fedora33-paraview:test:
    extends:
        - .fedora33_paraview
        - .cmake_test_linux
        - .cmake_test_artifacts
        - .linux_test_tags
        - .run_dependent
    dependencies:
        - fedora33-paraview:build
    needs:
        - fedora33-paraview:build

fedora33-paraview59-compat:build:
    extends:
        - .fedora33_paraview59_compat
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_automatically

fedora33-paraview59-compat:test:
    extends:
        - .fedora33_paraview59_compat
        - .cmake_test_linux
        - .cmake_test_artifacts
        - .linux_test_tags
        - .run_dependent
    dependencies:
        - fedora33-paraview59-compat:build
    needs:
        - fedora33-paraview59-compat:build

fedora33-nodata:build:
    extends:
        - .fedora33_nodata
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_automatically

fedora33-nodata:test:
    extends:
        - .fedora33_nodata
        - .cmake_test_linux
        - .cmake_test_artifacts
        - .linux_test_tags
        - .run_dependent
    dependencies:
        - fedora33-nodata:build
    needs:
        - fedora33-nodata:build

## Lint builds

fedora33-asan:build:
    extends:
        - .fedora33_asan
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_automatically

fedora33-asan:test:
    extends:
        - .fedora33_asan
        - .cmake_memcheck_linux
        - .cmake_test_artifacts
        - .linux_test_priv_tags
        - .run_dependent
    dependencies:
        - fedora33-asan:build
    needs:
        - fedora33-asan:build

fedora33-ubsan:build:
    extends:
        - .fedora33_ubsan
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_automatically

fedora33-ubsan:test:
    extends:
        - .fedora33_ubsan
        - .cmake_memcheck_linux
        - .cmake_test_artifacts
        - .linux_test_priv_tags
        - .run_dependent
    dependencies:
        - fedora33-ubsan:build
    needs:
        - fedora33-ubsan:build

fedora33-tidy:build:
    extends:
        - .fedora33_tidy
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_automatically

fedora33-coverage:build:
    extends:
        - .fedora33_coverage
        - .cmake_build_linux
        - .cmake_build_artifacts
        - .linux_builder_tags
        - .run_dependent

fedora33-coverage:test:
    extends:
        - .fedora33_coverage
        - .cmake_test_linux
        - .linux_test_tags
        - .cmake_coverage_artifacts
        - .run_dependent
    dependencies:
        - fedora33-coverage:build
    needs:
        - fedora33-coverage:build

fedora33-coverage:analyze:
    extends:
        - .fedora33_coverage
        - .cmake_coverage_linux
        - .linux_builder_tags
        - .run_dependent
    dependencies:
        - fedora33-coverage:test
    needs:
        - fedora33-coverage:test

# macOS

## Build and test

macos-arm64:build:
    extends:
        - .macos_arm64
        - .cmake_build_macos
        - .cmake_build_artifacts
        - .macos_arm64_builder_tags
        - .run_automatically

macos-arm64:test:
    extends:
        - .macos_arm64
        - .cmake_test_macos
        - .cmake_test_artifacts
        - .macos_arm64_builder_tags
        - .run_dependent
    dependencies:
        - macos-arm64:build
    needs:
        - macos-arm64:build

macos-x86_64:build:
    extends:
        - .macos_x86_64
        - .cmake_build_macos
        - .cmake_build_artifacts
        - .macos_builder_tags
        - .run_automatically

macos-x86_64:test:
    extends:
        - .macos_x86_64
        - .cmake_test_macos
        - .cmake_test_artifacts
        - .macos_builder_tags
        - .run_dependent
    dependencies:
        - macos-x86_64:build
    needs:
        - macos-x86_64:build

# Windows

## Build and test

windows-vs2022-ninja:build:
    extends:
        - .windows_vs2022_ninja
        - .cmake_build_windows
        - .cmake_build_artifacts
        - .windows_builder_tags
        - .run_automatically

windows-vs2022-ninja:test:
    extends:
        - .windows_vs2022_ninja
        - .cmake_test_windows
        - .cmake_test_artifacts
        - .windows_builder_tags
        - .run_dependent
    dependencies:
        - windows-vs2022-ninja:build
    needs:
        - windows-vs2022-ninja:build
