libresilient/.gitlab-ci.yml

45 wiersze
1.6 KiB
YAML

libresilient-test:
image: denoland/deno:debian-1.37.0
stage: test
script:
# preparations
- apt update && apt-get install -y bsdextrautils
- deno install --allow-read --allow-write https://deno.land/x/lcov_cobertura/mod.ts
# run the tests!
- deno test --quiet --allow-read --importmap=./__tests__/importmap.json --coverage=./coverage/ --trace-ops
#
# sigh! we are loading the service-worker.js script once per each test, and Deno
# does not allow us to do it nicely - so we are adding a '?<num>' at the end of
# the filename each time.
#
# this works but causes the coverage data to be generated as if these were actually
# different files, so we need this little hack here to fix that
- sed -i -r -e 's/service-worker\.js\?[0-9]+"/service-worker.js"/' coverage/*.json
# convert coverage to cobertura XML by way of LCOV
- deno coverage --lcov ./coverage/ > ./coverage/coverage.lcov
- /usr/local/bin/lcov_cobertura coverage/coverage.lcov > coverage/coverage.xml
# pretty-print some stats directly in the job log
- deno coverage ./coverage/ | grep '^cover' | column -t -R 4,5
- egrep '^<coverage' coverage/coverage.xml | tr ' ' '\n' | egrep '(line|branch)-rate' | tr -d '>"' | tr '=' ' ' | awk '{ printf "%s %5.2f%%\n", $1, $2*100 }' - | sed -r -e 's/branch-rate/Branches/' -r -e 's/line-rate/Lines/' | column -t -R2
coverage: '/^Lines +[0-9]+\.[0-9]{2}%$/'
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: coverage/coverage.xml
tags:
- docker
- linux
stages:
- test
sast:
stage: test
tags:
- docker
- linux
include:
- template: Security/SAST.gitlab-ci.yml