[PATCH] gitlab-ci: publish test report as an artifact

Paolo Bonzini pbonzini at redhat.com
Thu Nov 26 10:39:35 UTC 2020


"meson test" produces JUnit XML in the meson-logs directory.  The
XML can be parsed by GitLab and showed as part of the CI report.

However, if the build and tests are performed by "meson dist",
the tests are performed in "meson dist"'s own build directory
and the logs are not accessible.  So switch from "ninja dist"
to "meson dist --no-tests" after a separate build step that
is shared by the normal and the DIST=skip cases.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
	For an example see
	https://gitlab.com/bonzini/libvirt/-/pipelines/221545357/test_report.
	Test durations however are not yet available in upstream Meson.
---
 .gitlab-ci.yml | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6792accf8f..ce7b60dc6b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -51,17 +51,23 @@ stages:
     - *script_variables
   script:
     - meson build --werror || (cat build/meson-logs/meson-log.txt && exit 1)
+    - ninja -C build
+    - ninja -C build test
+    - DESTDIR=$PWD/install/ ninja -C build install
     - if test "$DIST" != "skip";
       then
-        ninja -C build dist;
-      else
-        ninja -C build;
-        ninja -C build test;
+        meson dist -C build --no-tests;
       fi
     - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
       then
         rpmbuild --nodeps -ta build/meson-dist/libvirt-*.tar.xz;
       fi
+  artifacts:
+    when: always
+    paths:
+      - build/meson-logs/
+    reports:
+      junit: build/meson-logs/testlog.junit.xml
 
 # Jobs that we delegate to Cirrus CI because they require an operating
 # system other than Linux. These jobs will only run if the required
-- 
2.28.0




More information about the libvir-list mailing list