From 19e88d4312459cd5cbce697ea207006ba1c3aff9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stevan=20Radakovi=C4=87?= <stevan.radakovic@linaro.org>
Date: Sun, 13 Jun 2021 23:21:01 +0200
Subject: [PATCH] ci: Test nitrogen boot in CI pipeline.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add a test LAVA job and a report job to collect results back
from LAVA. This job will use a job definition from lava-config
repository.

Signed-off-by: Stevan Radaković <stevan.radakovic@linaro.org>
---
 .ostc-ci/gitlab-ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/.ostc-ci/gitlab-ci.yml b/.ostc-ci/gitlab-ci.yml
index bb34dd2..b5720f9 100644
--- a/.ostc-ci/gitlab-ci.yml
+++ b/.ostc-ci/gitlab-ci.yml
@@ -5,6 +5,7 @@ stages:
   - compliance
   - build
   - test
+  - report
 
 include:
  - project: 'OSTC/infrastructure/pipelines'
@@ -13,6 +14,8 @@ include:
     - 'reuse.yaml'
  - project: 'OSTC/OHOS/manifest'
    file: '.ostc-ci/build-generic.yaml'
+ - project: 'OSTC/OHOS/manifest'
+   file: '.ostc-ci/test-generic.yaml'
 
 dco:
   extends: .dco
@@ -38,3 +41,44 @@ reuse:
 .build-freertos:
   rules:
     - when: never
+
+zephyr-96b-nitrogen:
+  extends: .build-image
+  variables:
+    MACHINE: 96b-nitrogen
+    OHOS_RECIPE_NAME: zephyr-philosophers
+    OHOS_BUILD_FLAVOUR: zephyr
+
+lava-zephyr-96b-nitrogen:
+  stage: test
+  extends: .lava-test
+  variables:
+    CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/nitrogen-boot.yaml"
+    CI_BUILD_JOB_NAME: zephyr-96b-nitrogen
+    CI_REPORT_JOB_NAME: report
+  rules:
+    # Run the build when a merge request is created.
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+    # Run the build when a tag is placed.
+    - if: '$CI_COMMIT_TAG'
+    # Run the build for scheduled pipelines.
+    - if: '$CI_PIPELINE_SOURCE == "schedule"'
+
+##
+## Get the results back from LAVA.
+##
+report:
+  extends: .lava-report
+  rules:
+    # This job will never run automatically until it is triggered by LAVA via
+    # gitlab API. We create the callback url in the manifest CI and pass it
+    # to LAVA via job definition.
+    # Run the build when a merge request is created.
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+      when: manual
+    # Run the build when a tag is placed.
+    - if: '$CI_COMMIT_TAG'
+      when: manual
+    # Run the build for scheduled pipelines.
+    - if: '$CI_PIPELINE_SOURCE == "schedule"'
+      when: manual
-- 
GitLab