Yocto Project Discussions
 help / color / mirror / Atom feed
From: Peter Hoyes <peter.hoyes@arm.com>
To: yocto@lists.yoctoproject.org
Cc: diego.sueiro@arm.com, Peter Hoyes <Peter.Hoyes@arm.com>
Subject: [meta-zephyr][PATCH 2/5] CI: Use the matrix to ovleray additional Kas files
Date: Tue,  6 Sep 2022 14:16:59 +0100	[thread overview]
Message-ID: <20220906131702.310027-2-peter.hoyes@arm.com> (raw)
In-Reply-To: <20220906131702.310027-1-peter.hoyes@arm.com>

From: Peter Hoyes <Peter.Hoyes@arm.com>

Adopt the jobs-to-kas helper script from meta-arm, which uses Gitlab's
parellel matrix to overlay additional Kas files on top of the base Kas
file (based on $CI_JOB_NAME).

This allows multiple combinations of Kas file overlays to be easily
tested with minimal boilerplate.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
---
 .gitlab-ci.yml | 15 ++++++++++++---
 ci/jobs-to-kas | 31 +++++++++++++++++++------------
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index addd04c..22a8ef9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -80,11 +80,17 @@ nrf52840dk-nrf52840:
 qemu-cortex-a53:
   extends: .build
 
-qemu-cortex-m0/testimage:
+qemu-cortex-m0:
   extends: .build
+  parallel:
+    matrix:
+      - TESTING: testimage
 
-qemu-cortex-m3/testimage:
+qemu-cortex-m3:
   extends: .build
+  parallel:
+    matrix:
+      - TESTING: testimage
 
 qemu-cortex-r5:
   extends: .build
@@ -92,8 +98,11 @@ qemu-cortex-r5:
 qemu-nios2:
   extends: .build
 
-qemu-x86/testimage:
+qemu-x86:
   extends: .build
+  parallel:
+    matrix:
+      - TESTING: testimage
 
 stm32mp157c-dk2:
   extends: .build
diff --git a/ci/jobs-to-kas b/ci/jobs-to-kas
index 7057970..296bb0d 100755
--- a/ci/jobs-to-kas
+++ b/ci/jobs-to-kas
@@ -1,19 +1,26 @@
 #! /bin/bash
 
-# Read a GitLab CI job name on $1 and transform it to a
-# list of Kas yaml files
+# This script is expecting an input of machine name, optionally followed by a
+# colon and a list of one or more parameters separated by commas between
+# brackets.  For example, the following are acceptable:
+# qemu-x86
+# qemu-cortex-m3: [testimage]
+# qemu-cortex-a53: [zephyr-toolchain, testimage]
+#
+# Turn this list into a series of yml files separated by colons to pass to kas
 
 set -e -u
 
-# Read Job namne from $1 and split on /
-IFS=/ read -r -a PARTS<<<$1
+FILES="ci/$(echo $1 | cut -d ':' -f 1).yml"
 
-# Prefix each part with ci/
-PARTS=("${PARTS[@]/#/ci/}")
+for i in $(echo $1 | cut -s -d ':' -f 2 | sed 's/[][,]//g'); do
+	# Given that there is no yml file for default, we can simply ignore those
+	# parameters.  They are necessary to pass in so that matrix can correctly
+	# setup all of the permutations of each individual run.
+	if [[ $i == 'default' ]]; then
+		continue
+	fi
+	FILES+=":ci/$i.yml"
+done
 
-# Suffix each part with .yml
-PARTS=("${PARTS[@]/%/.yml}")
-
-# Print colon-separated
-IFS=":"
-echo "${PARTS[*]}"
+echo $FILES
-- 
2.25.1



  reply	other threads:[~2022-09-06 13:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 13:16 [meta-zephyr][PATCH 1/5] Cleanup README.txt files Peter Hoyes
2022-09-06 13:16 ` Peter Hoyes [this message]
2022-09-06 13:17 ` [meta-zephyr][PATCH 3/5] zephyr-kernel: Factor out Yocto toolchain specific variables Peter Hoyes
2022-09-06 13:17 ` [meta-zephyr][PATCH 4/5] zephyr-sdk: Add recipe to download and build the Zephyr SDK Peter Hoyes
2022-09-06 13:17 ` [meta-zephyr][PATCH 5/5] zephyr-kernel: Add 'zephyr' toolchain variant Peter Hoyes
2022-09-07 20:08 ` [meta-zephyr][PATCH 1/5] Cleanup README.txt files Jon Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220906131702.310027-2-peter.hoyes@arm.com \
    --to=peter.hoyes@arm.com \
    --cc=diego.sueiro@arm.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox