# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Huawei Inc.

# Please do not include this file directly. It should be included through the
# build-generic.yaml only.

# The following jobs are documented in docs/ci/machines-and-flavours.rst

.toolchain-gcc:
  stage: build-gcc
  dependencies: []
  needs: []
  variables:
    CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
    CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"

.toolchain-clang:
  stage: build-clang
  dependencies: []
  needs: []
  variables:
    CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
    CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"

.broken:
  rules:
    # Some builds fail, so allow them to fail until the situation improves
    # dramatically so that the policy can be re-visited.  Clang builds are also
    # expensive, so only present the user with an option to start the build,
    # but do not commence the build automatically.
    - when: manual
      allow_failure: true

.linux-qemu-x86:
  extends: [.build-wic-image, .check-abi]
  variables:
    MACHINE: qemux86
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests
    # Set CI_ONIRO_BUILD_CACHE to "pub", overriding the value defined in the
    # .build job. This enables sharing of download and sstate-cache created
    # during this job.
    #
    # This is done assuming that there are no non-redistributable or otherwise
    # tainted build intermediate files, downloads or published artifacts.
    CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1
    CI_ONIRO_JOB_ARTIFACTS: "*.wic.* *.bmap ovmf.qcow2"
linux-qemu-x86-gcc:
 extends: [.linux-qemu-x86, .toolchain-gcc]
linux-qemu-x86-clang:
 extends: [.linux-qemu-x86, .toolchain-clang]

.linux-qemu-x86_64:
  extends: [.build-wic-image, .check-abi]
  variables:
    MACHINE: qemux86-64
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests
    # See the note on linux-qemu-x86.
    CI_ONIRO_BUILD_CACHE: "pub"
    CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1
    CI_ONIRO_JOB_ARTIFACTS: "*.wic.* *.bmap ovmf.qcow2"
linux-qemu-x86_64-gcc:
  extends: [.linux-qemu-x86_64, .toolchain-gcc]
linux-qemu-x86_64-clang:
  extends: [.linux-qemu-x86_64, .toolchain-clang]

.linux-seco-intel-b68:
  extends: .build-wic-image
  variables:
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests
    MACHINE: seco-intel-b68
linux-seco-intel-b68-gcc:
  extends: [.linux-seco-intel-b68, .toolchain-gcc]
linux-seco-intel-b68-clang:
  extends: [.linux-seco-intel-b68, .toolchain-clang]

.linux-seco-intel-b68-extra:
  extends: .build-linux
  variables:
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_BITBAKE_TARGETS: oniro-image-extra-tests
    MACHINE: seco-intel-b68
linux-seco-intel-b68-extra-gcc:
  extends: [.linux-seco-intel-b68-extra, .toolchain-gcc]
linux-seco-intel-b68-extra-clang:
  extends: [.linux-seco-intel-b68-extra, .toolchain-clang]

.linux-seco-imx8mm-c61-2gb:
  extends: .build-wic-image
  variables:
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests
    MACHINE: seco-imx8mm-c61-2gb
    # This platform requires proprietary resources to boot.
    # See build-generic.yaml for explanation of CI_ONIRO_BB_LOCAL_CONF_ variables.
    CI_ONIRO_BB_LOCAL_CONF_ACCEPT_FSL_EULA: 1
    CI_ONIRO_JOB_ARTIFACTS: "*.wic.* *.bmap flash.bin-seco-imx8mm-c61-2gb*"
linux-seco-imx8mm-c61-2gb-gcc:
  extends: [.linux-seco-imx8mm-c61-2gb, .toolchain-gcc]
linux-seco-imx8mm-c61-2gb-clang:
  extends: [.linux-seco-imx8mm-c61-2gb, .toolchain-clang, .broken]

.linux-seco-imx8mm-c61-4gb:
  extends: .build-wic-image
  variables:
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests
    MACHINE: seco-imx8mm-c61-4gb
    # This platform requires proprietary resources to boot.
    # See build-generic.yaml for explanation of CI_ONIRO_BB_LOCAL_CONF_ variables.
    CI_ONIRO_BB_LOCAL_CONF_ACCEPT_FSL_EULA: 1
    CI_ONIRO_JOB_ARTIFACTS: "*.wic.* *.bmap flash.bin-seco-imx8mm-c61-4gb*"
linux-seco-imx8mm-c61-4gb-gcc:
  extends: [.linux-seco-imx8mm-c61-4gb, .toolchain-gcc]
linux-seco-imx8mm-c61-4gb-clang:
  extends: [.linux-seco-imx8mm-c61-4gb, .toolchain-clang, .broken]

.linux-seco-imx8mm-c61-4gb-extra:
  extends: .build-linux
  variables:
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_BITBAKE_TARGETS: oniro-image-extra-tests
    MACHINE: seco-imx8mm-c61-4gb
    # This platform requires proprietary resources to boot.
    # See build-generic.yaml for explanation of CI_ONIRO_BB_LOCAL_CONF_ variables.
    CI_ONIRO_BB_LOCAL_CONF_ACCEPT_FSL_EULA: 1
linux-seco-imx8mm-c61-4gb-extra-gcc:
  extends: [.linux-seco-imx8mm-c61-4gb-extra, .toolchain-gcc]
linux-seco-imx8mm-c61-4gb-extra-clang:
  extends: [.linux-seco-imx8mm-c61-4gb-extra, .toolchain-clang, .broken]

.linux-seco-px30-d23:
  extends: .build-wic-image
  variables:
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base
    MACHINE: seco-px30-d23
linux-seco-px30-d23-gcc:
  extends: [.linux-seco-px30-d23, .toolchain-gcc]
linux-seco-px30-d23-clang:
  extends: [.linux-seco-px30-d23, .toolchain-clang]

.linux-raspberrypi4-64:
  extends: [.build-wic-image, .check-abi]
  variables:
    MACHINE: raspberrypi4-64
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests
linux-raspberrypi4-64-gcc:
  extends: [.linux-raspberrypi4-64, .toolchain-gcc]
linux-raspberrypi4-64-clang:
  extends: [.linux-raspberrypi4-64, .toolchain-clang]

.zephyr-qemu-x86:
  extends: .build-zephyr-image
  variables:
    MACHINE: qemu-x86
    # See the note on linux-qemu-x86.
    CI_ONIRO_BUILD_CACHE: "pub"
    CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1
zephyr-qemu-x86-gcc:
  extends: [.zephyr-qemu-x86, .toolchain-gcc]
zephyr-qemu-x86-clang:
  extends: [.zephyr-qemu-x86, .toolchain-clang, .broken]

.zephyr-qemu-cortex-m3:
  extends: .build-zephyr-image
  variables:
    MACHINE: qemu-cortex-m3
    # See the note on linux-qemu-x86.
    CI_ONIRO_BUILD_CACHE: "pub"
    CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1
zephyr-qemu-cortex-m3-gcc:
  extends: [.zephyr-qemu-cortex-m3, .toolchain-gcc]
zephyr-qemu-cortex-m3-clang:
  extends: [.zephyr-qemu-cortex-m3, .toolchain-clang, .broken]

.zephyr-96b-nitrogen:
  extends: .build-zephyr-image
  variables:
    MACHINE: 96b-nitrogen
zephyr-96b-nitrogen-gcc:
  extends: [.zephyr-96b-nitrogen, .toolchain-gcc]
zephyr-96b-nitrogen-clang:
  extends: [.zephyr-96b-nitrogen, .toolchain-clang, .broken]

.zephyr-96b-nitrogen-tests:
  extends: .build-zephyr-image
  variables:
    MACHINE: 96b-nitrogen
    CI_ONIRO_RECIPE_NAME: zephyr-kernel-test-all
zephyr-96b-nitrogen-tests-gcc:
  extends: [.zephyr-96b-nitrogen-tests, .toolchain-gcc]
zephyr-96b-nitrogen-tests-clang:
  extends: [.zephyr-96b-nitrogen-tests, .toolchain-clang, .broken]

.zephyr-96b-nitrogen-twister:
  extends: .build-zephyr-image
  variables:
    MACHINE: 96b-nitrogen
    CI_ONIRO_RECIPE_NAME: zephyr-kernel-test-twister
    CI_ONIRO_JOB_ARTIFACTS: "twister*.tar.bz2"
zephyr-96b-nitrogen-twister-gcc:
  extends: [.zephyr-96b-nitrogen-twister, .toolchain-gcc]
zephyr-96b-nitrogen-twister-clang:
  extends: [.zephyr-96b-nitrogen-twister, .toolchain-clang, .broken]

.zephyr-96b-avenger:
  extends: .build-zephyr-image
  variables:
    MACHINE: 96b-avenger96
zephyr-96b-avenger-gcc:
  extends: [.zephyr-96b-avenger, .toolchain-gcc]
zephyr-96b-avenger-clang:
  extends: [.zephyr-96b-avenger, .toolchain-clang, .broken]

.zephyr-nrf52840dk-nrf52840:
  extends: .build-zephyr-image
  variables:
    MACHINE: nrf52840dk-nrf52840
zephyr-nrf52840dk-nrf52840-gcc:
  extends: [.zephyr-nrf52840dk-nrf52840, .toolchain-gcc]
zephyr-nrf52840dk-nrf52840-clang:
  extends: [.zephyr-nrf52840dk-nrf52840, .toolchain-clang, .broken]

.zephyr-arduino-nano-33-ble:
  extends: .build-zephyr-image
  variables:
    MACHINE: arduino-nano-33-ble
zephyr-arduino-nano-33-ble-gcc:
  extends: [.zephyr-arduino-nano-33-ble, .toolchain-gcc]
zephyr-arduino-nano-33-ble-clang:
  extends: [.zephyr-arduino-nano-33-ble, .toolchain-clang, .broken]

.freertos-armv5:
  extends: .build-freertos
  variables:
    MACHINE: qemuarmv5
    # See the note on linux-qemu-x86.
    CI_ONIRO_BUILD_CACHE: "pub"
    CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1
freertos-armv5-gcc:
  extends: [.freertos-armv5, .toolchain-gcc]
freertos-armv5-clang:
  extends: [.freertos-armv5, .toolchain-clang, .broken]
