From db728fa9132c745aa50ddf1dcce330f48d197e43 Mon Sep 17 00:00:00 2001 From: Laurent GAY Date: Tue, 1 Jul 2025 17:04:33 +0200 Subject: [PATCH] extract coverage value in CI - issue 1776 --- .gitlab-ci.yml | 8 ++++---- check_i18n.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 558ecb527..2f6dbd740 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -106,11 +106,10 @@ deps: - install i18n-frontend: - image: node:20 + image: python:alpine stage: check script: - - ./check_i18n.py - - diff src/i18n/en_US.json src/i18n/missing_en_US.json + - python3 check_i18n.py allow_failure: true needs: - install @@ -130,6 +129,7 @@ exunit: - mix ecto.migrate script: - mix coveralls + coverage: '/\[TOTAL\]\s+([0-9\.]{1,5}%)/' artifacts: when: always reports: @@ -149,7 +149,7 @@ vitest: - npm install --frozen-lockfile script: - npm run coverage - - ls -la . + coverage: '/All files\s+\|\s+([0-9\.]{1,5})\s+\|.*/' artifacts: when: always paths: diff --git a/check_i18n.py b/check_i18n.py index 669b778ff..c67328dda 100755 --- a/check_i18n.py +++ b/check_i18n.py @@ -3,6 +3,7 @@ from os.path import isfile, isdir, join import glob import re import json +import sys def get_i18n_en_US(): with open(join("src", "i18n", "en_US.json"), 'r') as script_hdl: @@ -61,3 +62,4 @@ write_expected_i18n_en_US(i18n_us_content, expected_i18n_keys) print("Size of expected %d / in real US file %s" % (len(expected_i18n_keys), len(keys_translated))) print("I18n not translated = %d" % (len(set(expected_i18n_keys) - set(keys_translated)))) print("I18n not used = %d" % (len(set(keys_translated) - set(expected_i18n_keys)))) +sys.exit(0 if len(set(expected_i18n_keys) - set(keys_translated)) == 0 else 1) \ No newline at end of file