All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ci: add yocto-check-layers step
@ 2021-06-17 13:17 Ross Burton
  0 siblings, 0 replies; only message in thread
From: Ross Burton @ 2021-06-17 13:17 UTC (permalink / raw)
  To: meta-arm

Add a job to run yocto-check-layers to validate a selection of layers
are Yocto Project Compatible.

Right now we validate:
- meta-arm
- meta-arm-bsp
- meta-arm-toolchain
- meta-gem5

meta-atp and meta-arm-autonomy are currently skipped: meta-atp fails and
meta-arm-autonomy has a larger set of dependant layers and will be added
later.

Change-Id: Ia0c8c16e4228eeb461bd213b30703e950ede656f
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .gitlab-ci.yml      |  8 ++++++++
 ci/check-layers.py  | 43 +++++++++++++++++++++++++++++++++++++++++++
 ci/check-layers.yml |  7 +++++++
 3 files changed, 58 insertions(+)
 create mode 100755 ci/check-layers.py
 create mode 100644 ci/check-layers.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b18373e..6f39844 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -72,6 +72,14 @@ machine-coverage:
 # Build stage, the actual build jobs
 #
 
+# Validate layers are Yocto Project Compatible
+check-layers:
+  extends: .setup
+  coverage: '/Coverage: \d+/'
+  script:
+  - kas shell --update --force-checkout ci/base.yml:ci/meta-python.yml --command \
+    "$CI_PROJECT_DIR/ci/check-layers.py $CI_PROJECT_DIR/ci/check-layers.yml $CI_PROJECT_DIR $KAS_WORK_DIR"
+
 corstone500:
   extends: .build
 
diff --git a/ci/check-layers.py b/ci/check-layers.py
new file mode 100755
index 0000000..7b607ae
--- /dev/null
+++ b/ci/check-layers.py
@@ -0,0 +1,43 @@
+#! /usr/bin/env python3
+
+import argparse
+import pathlib
+import re
+import subprocess
+import sys
+
+import yaml
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser()
+    parser.add_argument("config", type=argparse.FileType())
+    parser.add_argument("metaarm", type=pathlib.Path, help="Path to meta-arm")
+    parser.add_argument("others", type=pathlib.Path, help="Path to parent of dependencies")
+    args = parser.parse_args()
+
+    config = yaml.safe_load(args.config)
+    layers = config["layers"]
+    dependencies = config["dependencies"]
+
+    found_layers = [p for p in args.metaarm.glob("meta-*") if p.is_dir()]
+    print(f"Testing {len(layers)} layers: {', '.join(layers)}.")
+    print(f"Found {len(found_layers)} layers in meta-arm.")
+    print()
+
+    cli = ["yocto-check-layer-wrapper",]
+    cli.extend([args.metaarm / layer for layer in layers])
+    cli.append("--dependency")
+    cli.extend([args.others / layer for layer in dependencies])
+
+    passed = 0
+    process = subprocess.Popen(cli, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
+    while True:
+        line = process.stdout.readline()
+        if process.poll() is not None:
+            break
+        print(line.strip())
+        if re.search(r"meta-.+ PASS", line):
+            passed += 1
+
+    print(f"Coverage: {int(passed / len(found_layers) * 100)}%")
+    sys.exit(process.returncode)
diff --git a/ci/check-layers.yml b/ci/check-layers.yml
new file mode 100644
index 0000000..7d2820c
--- /dev/null
+++ b/ci/check-layers.yml
@@ -0,0 +1,7 @@
+layers:
+  - meta-arm
+  - meta-arm-bsp
+  - meta-arm-toolchain
+  - meta-gem5
+dependencies:
+  - meta-openembedded/meta-oe
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-17 13:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 13:17 [PATCH] ci: add yocto-check-layers step Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.