From fe9bcd81179876fc59d025e015a09dce43ff64af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stevan=20Radakovi=C4=87?= <stevan.radakovic@linaro.org>
Date: Thu, 24 Jun 2021 23:09:11 +0200
Subject: [PATCH] ci: Add lava tests for QEMU Zephyr on cortex m3 and x86
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Also clean up some reduntant rules, update report job name, and
use zephyr nitrogen build job from machines-and-flovours in meta-ohos.
Fixes https://git.ostc-eu.org/OSTC/OHOS/manifest/-/issues/57

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

diff --git a/.ostc-ci/gitlab-ci.yml b/.ostc-ci/gitlab-ci.yml
index b5720f9..a93a7f3 100644
--- a/.ostc-ci/gitlab-ci.yml
+++ b/.ostc-ci/gitlab-ci.yml
@@ -33,7 +33,7 @@ reuse:
     OHOS_CI_GIT_REPO_PATH: sources/meta-zephyr
 
 # Disable Linux and FreeRTOS builds that are unlikely to be affected by Zephyr
-# changes and certainly save some time. 
+# changes and certainly save some time.
 .build-linux:
   rules:
     - when: never
@@ -42,43 +42,39 @@ reuse:
   rules:
     - when: never
 
-zephyr-96b-nitrogen:
-  extends: .build-image
-  variables:
-    MACHINE: 96b-nitrogen
-    OHOS_RECIPE_NAME: zephyr-philosophers
-    OHOS_BUILD_FLAVOUR: zephyr
-
+##
+## Submit jobs to LAVA
+##
 lava-zephyr-96b-nitrogen:
+  needs: [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"'
+    CI_REPORT_JOB_NAME: lava-report
+
+lava-zephyr-qemu-cortex-m3:
+  needs: [zephyr-qemu-cortex-m3]
+  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/qemu-zephyr-cortex-m3.yaml"
+    CI_BUILD_JOB_NAME: zephyr-qemu-cortex-m3
+    CI_REPORT_JOB_NAME: lava-report
+
+lava-zephyr-qemu-x86:
+  needs: [zephyr-qemu-x86]
+  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/qemu-zephyr-x86.yaml"
+    CI_BUILD_JOB_NAME: zephyr-qemu-x86
+    CI_REPORT_JOB_NAME: lava-report
 
 ##
 ## Get the results back from LAVA.
 ##
-report:
+lava-report:
+  needs: [lava-zephyr-96b-nitrogen, lava-zephyr-qemu-cortex-m3, lava-zephyr-qemu-x86]
   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