# 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

linux-qemu-x86:
  extends: .build-wic-image
  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"
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"

linux-qemu-x86_64:
  extends: .build-wic-image
  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"
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"

linux-seco-intel-b68:
  extends: .build-wic-image
  variables:
    MACHINE: seco-intel-b68
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests

linux-seco-intel-b68:
  extends: .build-wic-image
  variables:
    MACHINE: seco-intel-b68
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests
    CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
    CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
  when: manual
  allow_failure: true

    
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-imx8mm-c61-2gb:
  extends: .build-linux-matrix
  variables:
    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

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*"
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"
  rules:
    - if: '$CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN == "clang"'
      allow_failure: true
      when: manual
    - when: on_success

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-raspberrypi4-64:
  extends: .build-wic-image
  variables:
    MACHINE: raspberrypi4-64
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests

## We don't use matrix job here because clang build has to be fixed
## setting rules in matrix job causes broken dependencies
## see: https://gitlab.eclipse.org/eclipse/oniro-core/oniro/-/issues/574
linux-raspberrypi4-64-clang:
  extends: .build-wic-image
  variables:
    MACHINE: raspberrypi4-64
    CI_ONIRO_BUILD_FLAVOUR: linux
    CI_ONIRO_RECIPE_NAME: oniro-image-base-tests
    CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
    CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
  when: manual
  allow_failure: true

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
    CI_ONIRO_RECIPE_NAME: zephyr-philosophers
    CI_ONIRO_BUILD_FLAVOUR: zephyr
    CI_ONIRO_INSTANCE_SIZE: s3.large.2
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"
  rules:
    - if: '$CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN == "clang"'
      allow_failure: true
      when: manual
    - when: on_success

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
    CI_ONIRO_RECIPE_NAME: zephyr-philosophers
    CI_ONIRO_BUILD_FLAVOUR: zephyr
    CI_ONIRO_INSTANCE_SIZE: s3.large.2
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"
  rules:
    - if: '$CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN == "clang"'
      allow_failure: true
      when: manual
    - when: on_success

zephyr-96b-nitrogen:
  extends: .build-zephyr-image
  variables:
    MACHINE: 96b-nitrogen
    CI_ONIRO_RECIPE_NAME: zephyr-philosophers
    CI_ONIRO_BUILD_FLAVOUR: zephyr
    CI_ONIRO_INSTANCE_SIZE: s3.large.2
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"
  rules:
    - if: '$CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN == "clang"'
      allow_failure: true
      when: manual
    - when: on_success

zephyr-96b-nitrogen-tests:
  extends: .build-zephyr-image
  variables:
    MACHINE: 96b-nitrogen
    CI_ONIRO_RECIPE_NAME: zephyr-kernel-test-all
    CI_ONIRO_BUILD_FLAVOUR: zephyr
    CI_ONIRO_INSTANCE_SIZE: s3.large.2

zephyr-96b-nitrogen-twister:
  extends: .build-image
  variables:
    MACHINE: 96b-nitrogen
    CI_ONIRO_RECIPE_NAME: zephyr-kernel-test-twister
    CI_ONIRO_BUILD_FLAVOUR: zephyr
    CI_ONIRO_INSTANCE_SIZE: s3.large.2
    CI_ONIRO_JOB_ARTIFACTS: "twister*.tar.bz2"

zephyr-96b-avenger:
  extends: .build-zephyr
  variables:
    MACHINE: 96b-avenger96

zephyr-nrf52840dk-nrf52840:
  extends: .build-zephyr
  variables:
    MACHINE: nrf52840dk-nrf52840
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"
  rules:
    - if: '$CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN == "clang"'
      allow_failure: true
      when: manual
    - when: on_success


zephyr-arduino-nano-33-ble:
  extends: .build-zephyr
  variables:
    MACHINE: arduino-nano-33-ble
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"
  rules:
    - if: '$CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN == "clang"'
      allow_failure: true
      when: manual
    - when: on_success


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
  parallel:
    matrix:
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "clang"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "llvm"
      - CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN: "gcc"
        CI_ONIRO_BB_LOCAL_CONF_RUNTIME: "gnu"
  rules:
    - if: '$CI_ONIRO_BB_LOCAL_CONF_TOOLCHAIN == "clang"'
      allow_failure: true
      when: manual
    - when: on_success
