# Beware: git branch names need the 'refs/heads/' prefix, while tags need 'refs/tags/'
- project:
    name: #{RR}
    type_of_test: ""
    timeout_build: 1000
    timeout_precommit: 1000
#if PRECOMMIT_PW_TRIGGER_yes || CRON_6H_yes
    # Trigger configuration that have precommit testing every 6 hours
    # to test incoming patches in a timely manner.
    cron_master: 'H H/6 * * *'
#elif RR_tcwg_gnu_embed
    # We have 9 ci_configs for tcwg_gnu_embed_* projects, so trigger these
    # once in 3 days.
    cron_master: 'H H H/3 * *'
#else
    # By default, run each CI loop daily.
    cron_master: 'H H * * *'
#endif
    docker_security: ''
#if RR_tcwg_gcc
    ci_project:
      - tcwg_gcc_build
      - tcwg_gcc_check
#elif RR_tcwg_simplebootstrap
# We put tcwg_bootstrap_* jobs separately from tcwg_gcc_* jobs to avoid
# slowing down [quick] tcwg_gcc_* when bisecting bootstrap regressions.
# If a bootstrap job catches a regression first, it will block bisects
# of all configurations in the same ci_project.  This would prevent
# tcwg_gcc_* jobs from bisecting same regression much quicker.
    ci_project:
      - tcwg_simplebootstrap_build:
          type_of_test: -bootstrap
#elif RR_tcwg_bootstrap
# We put tcwg_bootstrap_* jobs separately from tcwg_gcc_* jobs to avoid
# slowing down [quick] tcwg_gcc_* when bisecting bootstrap regressions.
# If a bootstrap job catches a regression first, it will block bisects
# of all configurations in the same ci_project.  This would prevent
# tcwg_gcc_* jobs from bisecting same regression much quicker.
    ci_project:
      - tcwg_bootstrap_build:
          type_of_test: -bootstrap_lto
      - tcwg_bootstrap_build:
          type_of_test: -bootstrap_O1
      - tcwg_bootstrap_build:
          type_of_test: -bootstrap_O3
      - tcwg_bootstrap_build:
          type_of_test: -bootstrap_debug
      - tcwg_bootstrap_build:
          type_of_test: -bootstrap_profiled
      - tcwg_bootstrap_build:
          type_of_test: -bootstrap_profiled_lto
      - tcwg_bootstrap_build:
          type_of_test: -bootstrap_profiled_lto_lean
      - tcwg_bootstrap_build:
          type_of_test: -bootstrap_ubsan
      - tcwg_bootstrap_check:
          type_of_test: -check_bootstrap
      - tcwg_bootstrap_check:
          type_of_test: -check_bootstrap_lto
#elif RR_tcwg_binutils
    ci_project:
      - tcwg_binutils_build
      - tcwg_binutils_check
#elif RR_tcwg_glibc
    ci_project:
      - tcwg_glibc_build
      - tcwg_glibc_check:
          # The SYS_ADMIN is required to allow the glibc container tests use mount, chroot, and ptrace syscalls.
          # Also, docker default apprmor filter disables the mount sycall, so disable it as well.
          # See https://linaro.atlassian.net/browse/GNU-836 for more details.
          docker_security: '--cap-add=SYS_ADMIN --security-opt apparmor=unconfined'
#elif RR_tcwg_gdb
    ci_project:
      - tcwg_gdb_build
      - tcwg_gdb_check:
          timeout_build: 2000
#elif RR_tcwg_gnu_cross
    ci_project:
      - tcwg_gnu_cross_build
      - tcwg_gnu_cross_check_binutils
      - tcwg_gnu_cross_check_gcc
#elif RR_tcwg_gnu_embed
    ci_project:
      - tcwg_gnu_embed_build
      - tcwg_gnu_embed_check_binutils
      - tcwg_gnu_embed_check_gcc
#elif RR_tcwg_gnu_mingw
    ci_project:
      - tcwg_gnu_mingw_build
      - tcwg_gnu_mingw_check_binutils
      - tcwg_gnu_mingw_check_gcc
#elif RR_tcwg_gnu_native
    ci_project:
      - tcwg_gnu_native_build
      - tcwg_gnu_native_check_binutils
      - tcwg_gnu_native_check_gcc
      - tcwg_gnu_native_check_glibc:
          # See tcwg_glibc_check above.
          docker_security: '--cap-add=SYS_ADMIN --security-opt apparmor=unconfined'
      - tcwg_gnu_native_check_gdb:
          timeout_build: 2000
      - tcwg_gnu_native_fast_check_gcc
      - tcwg_gnu_native_fast_check_gdb
#endif
#if COMPONENTS_binutils
    binutils_url: git://sourceware.org/git/binutils-gdb.git
#endif
#if COMPONENTS_gcc
# if RR_tcwg_gnu_mingw
    gcc_url: https://github.com/Windows-on-ARM-Experiments/gcc-woarm64.git
# else
    gcc_url: git+ssh://linaroci@gcc.gnu.org/git/gcc.git
# endif
#endif
#if COMPONENTS_glibc
    glibc_url: git://sourceware.org/git/glibc.git
#endif
#if COMPONENTS_gdb
    gdb_url: git://sourceware.org/git/binutils-gdb.git
#endif
#if COMPONENTS_mingw
    mingw_url: https://git.code.sf.net/p/mingw-w64/mingw-w64.git
#endif
#if COMPONENTS_newlib
    newlib_url: git://sourceware.org/git/newlib-cygwin.git
#endif
#if COMPONENTS_qemu
    qemu_url: https://gitlab.com/qemu-project/qemu.git
#endif
    target:
#if RR_tcwg_gnu_cross || RR_tcwg_gnu_embed
# if RR_tcwg_gnu_cross
      - aarch64
      - arm
# elif RR_tcwg_gnu_embed
      - arm_eabi
      - arm_v7a_softfp_eabi
      - thumb_v8a_hard_eabi
      - thumb_m0_soft_eabi
      - thumb_m3_softfp_eabi
      - thumb_m7_hard_eabi
      - thumb_m23_soft_eabi
      - thumb_m33_hard_eabi
      - thumb_m55_hard_eabi
# endif
    node: tcwg-build && tcwg-x86_64
#elif RR_tcwg_gnu_mingw
      - woa64:
          node: tcwg-wsl
#else
      - aarch64:
          node: tcwg-build && tcwg-armv8_64
          docker_arch: arm64
      - arm:
          node: tcwg-build && tcwg-armv8_32
          docker_arch: armhf
#endif
    jobs:
      - #{RR}-master

- job-group:
    name: #{RR}-master
    toolchain_ver: master
    cron: '{cron_master}'
#if COMPONENTS_binutils
    binutils_branch: master
#endif
#if COMPONENTS_gcc
# if RR_tcwg_gnu_mingw
    gcc_branch: aarch64-mingw32-baseline
# else
    gcc_branch: master
# endif
#endif
#if COMPONENTS_linux
    linux_url: https://gitlab.com/Linaro/lkft/mirrors/torvalds/linux-mainline.git
    linux_branch: master
#endif
#if COMPONENTS_glibc
    glibc_branch: master
#endif
#if COMPONENTS_gdb
    gdb_branch: master
#endif
#if COMPONENTS_mingw
    mingw_branch: master
#endif
#if COMPONENTS_newlib
    newlib_branch: master
#endif
#if COMPONENTS_qemu
    qemu_branch: master
#endif
    distro: default
    jobs:
      - '{ci_project}--{toolchain_ver}-{target}{type_of_test}-build'
#if PRECOMMIT_ENABLE_yes
      - '{ci_project}--{toolchain_ver}-{target}{type_of_test}-precommit'
#endif
      - '{ci_project}--{toolchain_ver}-{target}{type_of_test}-bisect'
    ci_config: '{toolchain_ver}-{target}{type_of_test}'

#include tcwg/round-robin.yaml.inc

- job-template:
    name: '{ci_project}--{toolchain_ver}-{target}{type_of_test}-build'
    project-type: freestyle
    defaults: global
    properties:
      - build-properties:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
    parameters:
      - build-parameters:
          default_git: 'default'
          distro: '{distro}'
    disabled: false
    node: '{node}'
    concurrent: false
    display-name: 'TCWG Build {ci_project}/{ci_config}'
    workspace: workspace/tcwg_gnu_$EXECUTOR_NUMBER
    scm:
      - build-scms:
#if COMPONENTS_binutils
          binutils_url: '{binutils_url}'
          binutils_branch: '{binutils_branch}'
#endif
#if COMPONENTS_gcc
          gcc_url: '{gcc_url}'
          gcc_branch: '{gcc_branch}'
#endif
#if COMPONENTS_linux
          linux_url: '{linux_url}'
          linux_branch: '{linux_branch}'
#endif
#if COMPONENTS_glibc
          glibc_url: '{glibc_url}'
          glibc_branch: '{glibc_branch}'
#endif
#if COMPONENTS_gdb
          gdb_url: '{gdb_url}'
          gdb_branch: '{gdb_branch}'
#endif
#if COMPONENTS_mingw
          mingw_url: '{mingw_url}'
          mingw_branch: '{mingw_branch}'
#endif
#if COMPONENTS_newlib
          newlib_url: '{newlib_url}'
          newlib_branch: '{newlib_branch}'
#endif
#if COMPONENTS_qemu
          qemu_url: '{qemu_url}'
          qemu_branch: '{qemu_branch}'
#endif
    triggers:
      - timed: '{cron}'
    wrappers:
      - build-wrappers:
          timeout: '{timeout_build}'
    builders:
      - run-build:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
          build_script: 'tcwg_gnu-build.sh'
#if RR_tcwg_gnu_native || RR_tcwg_gcc || RR_tcwg_bootstrap || RR_tcwg_simplebootstrap || RR_tcwg_binutils || RR_tcwg_glibc || RR_tcwg_gdb
          docker_arch: '{docker_arch}'
#endif
          docker_security: '{docker_security}'
    publishers:
      - build-publishers:
          email_on_failure: false
          email_on_success: true

#if PRECOMMIT_ENABLE_yes
- job-template:
    name: '{ci_project}--{toolchain_ver}-{target}{type_of_test}-precommit'
    project-type: freestyle
    defaults: global
    properties:
      - precommit-properties:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
    parameters:
      - precommit-parameters:
          default_git: 'baseline'
          distro: '{distro}'
    disabled: false
    node: '{node}'
    concurrent: true
    display-name: 'TCWG Precommit {ci_project}/{ci_config}'
    workspace: workspace/tcwg_gnu_$EXECUTOR_NUMBER
    scm:
      - jenkins-scripts
    wrappers:
      - build-wrappers:
          timeout: '{timeout_precommit}'
    builders:
      - run-precommit:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
          build_script: 'tcwg_gnu-build.sh'
#if RR_tcwg_gnu_native || RR_tcwg_gcc || RR_tcwg_bootstrap || RR_tcwg_simplebootstrap || RR_tcwg_binutils || RR_tcwg_glibc || RR_tcwg_gdb
          docker_arch: '{docker_arch}'
#endif
          docker_security: '{docker_security}'
    publishers:
      - build-publishers:
          email_on_failure: true
          email_on_success: false
#endif

- job-template:
    name: '{ci_project}--{toolchain_ver}-{target}{type_of_test}-bisect'
    project-type: freestyle
    defaults: global
    properties:
      - bisect-properties:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
    parameters:
      - bisect-parameters:
          distro: '{distro}'
    disabled: false
    node: '{node}'
    concurrent: false
    display-name: 'TCWG Bisect {ci_project}/{ci_config}'
    workspace: workspace/tcwg_gnu_$EXECUTOR_NUMBER
    scm:
      - jenkins-scripts
    wrappers:
      - bisect-wrappers:
          timeout: 6000
    builders:
      - run-bisect:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
          build_script: 'tcwg_gnu-build.sh'
#if RR_tcwg_gnu_native || RR_tcwg_gcc || RR_tcwg_bootstrap || RR_tcwg_simplebootstrap || RR_tcwg_binutils || RR_tcwg_glibc || RR_tcwg_gdb
          docker_arch: '{docker_arch}'
#endif
          docker_security: '{docker_security}'
    publishers:
      - bisect-publishers
