[vlc-commits] [Git][videolan/vlc][master] 4 commits: extras: ci: fix typos in get-contrib-sha

Thomas Guillem (@tguillem) gitlab at videolan.org
Tue Feb 27 10:03:44 UTC 2024



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
bccd0513 by Alexandre Janniaux at 2024-02-27T08:55:42+00:00
extras: ci: fix typos in get-contrib-sha

Missing quote `"` from 0dffba0ebaf05d236e02f0b24ec9ca19786eb842.

- - - - -
2cbc35cf by Alexandre Janniaux at 2024-02-27T08:55:42+00:00
extras: ci: export coverage artifacts

The files are reported to gitlab but not made public. Being able to
download it enables running gcovr locally and makes it easier to debug
coverage issues.

- - - - -
a80d692b by Alexandre Janniaux at 2024-02-27T08:55:42+00:00
extras: ci: change source path for cobertura output

Gitlab has some constraints[^1] regarding the cobertura output to have
the coverage results displayed on the merge request:

 - Files in the diff view must appear in the cobertura file to have the
   coverage enabled for them.

 - <filename> must be absolute or <source> must typically have an
   absolute path to the project directory.

 - Pipeline must have completed to show the results.

  - The coverage report must not exceed the limits (10MiB and 100
    sources node).

The second point on absolute filename was not valid given that meson
gcovr setup the <source> with `.`, leading to the only <source> element
referencing `.` instead of ${CI_PROJECT_DIR}.

This commit patches the generated coverage to ensure it's relative to
the root directory, enabling diff coverage.

[^1]: https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html#test-coverage-visualization-not-displayed

- - - - -
7f19145d by Alexandre Janniaux at 2024-02-27T08:55:42+00:00
extras: ci: enable coverage reports in MR

To enable coverage report in MRs (and not just in artifacts), we need to
indicate the regex for gitlab to parse the total percentage. See general
documentation[^1] highlighting that uploading doesn't enable, as well as
how to enable history [^2] and in merge requests[^3] for more details.

The || true is needed on the script line extracting the coverage
percentage, because the job is failing otherwise, but I'm still not sure
what is causing the failure.

[^1]: https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html
[^2]: https://docs.gitlab.com/ee/ci/testing/code_coverage.html#view-history-of-project-code-coverage
[^3]: https://docs.gitlab.com/ee/ci/testing/code_coverage.html#view-code-coverage-results-in-the-mr

Co-authored-by: Alaric Senat <dev.asenat at posteo.net>

- - - - -


2 changed files:

- extras/ci/get-contrib-sha.sh
- extras/ci/gitlab-ci.yml


Changes:

=====================================
extras/ci/get-contrib-sha.sh
=====================================
@@ -54,7 +54,7 @@ case $1 in
 esac
 
 VLC_LAST_CONTRIB_SHA=$(
-    cd "${VLC_SRC_ROOT_DIR} && git rev-list -1 "${VLC_START_REVISION}" -- "${VLC_CONTRIB_REBUILD_PATHS[@]}"
+    cd "${VLC_SRC_ROOT_DIR}" && git rev-list -1 "${VLC_START_REVISION}" -- "${VLC_CONTRIB_REBUILD_PATHS[@]}"
 )
 
 [ -n "${VLC_LAST_CONTRIB_SHA}" ] || abort_err "Failed to determine last contrib SHA using Git!"


=====================================
extras/ci/gitlab-ci.yml
=====================================
@@ -327,6 +327,7 @@ nightly-debian:
 #
 debian-meson:
     extends: .base-template
+    coverage: '/^coverage result: (\d+.\d+)$/'
     image:
         name: $VLC_DEBIAN_IMAGE
     script:
@@ -373,7 +374,15 @@ debian-meson:
             --xml="cobertura.xml"
             --html="html-coverage/vlc.html"
             --html-details -s -j$NCPU
-
+        - |
+            # Ensure that sources are reported from CI_PROJECT_DIR directory so
+            # that gitlab can associate the files correctly.
+            sed -i 's,<source>.*</source>,<source>'"${CI_PROJECT_DIR}"'</source>,' cobertura.xml
+        # Expose the line coverage percentage to gitlab from the cobertura XML.
+        - >
+            grep -Eo 'line-rate="[^"]+"' cobertura.xml | head -n 1 |
+            grep -Eo '[0-9.]+' | awk '{ print "coverage result:", $1 * 100 } ' ||
+            true
     allow_failure: true
     variables: *variables-debian
     artifacts:
@@ -383,6 +392,8 @@ debian-meson:
                 coverage_format: cobertura
                 path: cobertura.xml
         paths:
+            - ${CI_PROJECT_DIR}/${CI_JOB_NAME}.cov.json
+            - cobertura.xml
             - html-coverage/
             - ${CI_PROJECT_DIR}/build-meson/meson-logs/testlog.junit.xml
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5f0a9649aa73747ea41f94a77fe32954dd892804...7f19145d9335546c5af0ad6ccf8c2227ecb9f093

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5f0a9649aa73747ea41f94a77fe32954dd892804...7f19145d9335546c5af0ad6ccf8c2227ecb9f093
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list