3 def
runInsideNixShell(String command
, String tool_flavor
= 'build') {
5 nix-shell -I nixpkgs="\$
(pwd
)/tools
/utils
/nix
/pinned
-nixpkgs
.nix
" "\$
(pwd
)/tools
/utils
/nix
/$
{tool_flavor
}-tools
/" --run "$
{command
}"
9 def
prepareSources(String prepare_flavor
) {
10 runInsideNixShell("tools/utils/scripts/generated-files-builder.sh ${prepare_flavor}")
13 def
runFilesStatusChangesDetection(String repository_to_inspect
, String name_of_verified_files
, String verified_files
) {
15 sh
"tests/files_status_checker/verify.sh '${repository_to_inspect}' '${name_of_verified_files}' ${verified_files}"
19 def
runPHPUnitTests(String version
, Boolean with_coverage
= false) {
20 def coverage_enabled
='0'
24 sh
"make -C $WORKSPACE/sources phpunit-ci PHP_VERSION=${version} COVERAGE_ENABLED=${coverage_enabled}"
27 def
runJSUnitTests(Boolean with_coverage
= false) {
30 coverage_env
='COLLECT_COVERAGE=true'
32 sh("mkdir -p ${WORKSPACE}/results/")
34 runInsideNixShell("${coverage_env} lib/frontend/build-system-configurator/bin/run-js-units-ci.sh")
38 def
runRESTTests(String db
, String php
) {
40 mkdir -p \$WORKSPACE/results/api-rest/php${php}-${db}
41 TESTS_RESULT=\$WORKSPACE/results/api-rest/php${php}-${db} sources/tests/rest/bin/run-compose.sh "$
{php
}" "$
{db
}"
45 def
runDBTests(String db
, String php
) {
47 mkdir -p \$WORKSPACE/results/db/php${php}-${db}
48 TESTS_RESULT=\$WORKSPACE/results/db/php${php}-${db} sources/tests/integration/bin/run-compose.sh "$
{php
}" "$
{db
}"
52 def
runEndToEndTests(String flavor
, String db
) {
54 sh
"tests/e2e/${flavor}/wrap.sh '${db}' '$WORKSPACE/results/e2e/${flavor}/'"
58 def
runBuildAndRun(String os
) {
60 sh
"OS='${os}' tests/build_and_run/test.sh"
65 sh("mkdir -p ${WORKSPACE}/results/eslint/")
67 runInsideNixShell("pnpm run eslint --quiet --format=checkstyle --output-file=${WORKSPACE}/results/eslint/checkstyle.xml .")
73 runInsideNixShell('pnpm run stylelint **/*.scss **/*.vue')
77 def
runTabFilesCheck() {
79 runInsideNixShell('src/utils/analyse_language_files.pl ./')
83 def
runPsalm(String configPath
, String root
='.') {
84 withEnv(['XDG_CACHE_HOME=/tmp/psalm_cache/']) {
87 mkdir -p ../results/psalm/
88 scl enable php82 "src
/vendor
/bin
/psalm
--find
-unused
-code
--show
-info
=false --report
-show
-info
=false --config
='${configPath}' --no
-cache
--root
='${root}' --report
=../results
/psalm
/checkstyle
.xml
"
94 def
runPsalmTaintAnalysis(String configPath
, String root
='.') {
95 withEnv(['XDG_CACHE_HOME=/tmp/psalm_cache/']) {
98 mkdir -p ../results/psalm/
99 scl enable php82 "src
/vendor
/bin
/psalm
--taint
-analysis
--memory
-limit
=4096M
--threads
=1 --config
='${configPath}' --no
-cache
--root
='${root}' --report
=../results
/psalm
/checkstyle
.xml
"
105 def
runPHPCodingStandards(String phpcsPath
, String rulesetPath
, String filesToAnalyze
) {
106 if (filesToAnalyze
== '') {
110 docker run --rm -v $WORKSPACE/sources:/sources:ro -w /sources --network none \${DOCKER_REGISTRY:-ghcr.io}/enalean/tuleap-test-phpunit:el9-php82 \
111 scl enable php82 "php
-d memory_limit
=2536M $
{phpcsPath
} --extensions
=php
,phpstub
--encoding
=utf
-8 --standard
="${rulesetPath}" -p $
{filesToAnalyze
}"
118 export CI_REPORT_OUTPUT_PATH="\$WORKSPACE
/results
/deptrac
/"
119 mkdir -p "\$CI_REPORT_OUTPUT_PATH
"
120 scl enable php82 "./tests
/deptrac
/run
.sh
"