extract coverage value in CI - issue 1776

This commit is contained in:
Laurent GAY
2025-07-01 17:04:33 +02:00
parent 9edf44beb9
commit db728fa913
2 changed files with 6 additions and 4 deletions

View File

@@ -106,11 +106,10 @@ deps:
- install - install
i18n-frontend: i18n-frontend:
image: node:20 image: python:alpine
stage: check stage: check
script: script:
- ./check_i18n.py - python3 check_i18n.py
- diff src/i18n/en_US.json src/i18n/missing_en_US.json
allow_failure: true allow_failure: true
needs: needs:
- install - install
@@ -130,6 +129,7 @@ exunit:
- mix ecto.migrate - mix ecto.migrate
script: script:
- mix coveralls - mix coveralls
coverage: '/\[TOTAL\]\s+([0-9\.]{1,5}%)/'
artifacts: artifacts:
when: always when: always
reports: reports:
@@ -149,7 +149,7 @@ vitest:
- npm install --frozen-lockfile - npm install --frozen-lockfile
script: script:
- npm run coverage - npm run coverage
- ls -la . coverage: '/All files\s+\|\s+([0-9\.]{1,5})\s+\|.*/'
artifacts: artifacts:
when: always when: always
paths: paths:

View File

@@ -3,6 +3,7 @@ from os.path import isfile, isdir, join
import glob import glob
import re import re
import json import json
import sys
def get_i18n_en_US(): def get_i18n_en_US():
with open(join("src", "i18n", "en_US.json"), 'r') as script_hdl: 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("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 translated = %d" % (len(set(expected_i18n_keys) - set(keys_translated))))
print("I18n not used = %d" % (len(set(keys_translated) - set(expected_i18n_keys)))) 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)