mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2025-12-16 02:56:30 +00:00
* EN-17254 - added "TODO" comment to "Dockerfile". * EN-17254 - updated dockerfile: added code that install yarn package manager. * EN-17254 - added "yarn test ..." command before sonar scanner execution to "entrypoint.sh" in order to generate coverage report. * INF-2546 Add step to upgrade Node.js to latest LTS release * INF-2546 Add step to upgrade Node.js to latest LTS release * INF-2546 Add step to upgrade nodejs; add step to execute yarn; bug fix for converting line endings to linux style * INF-2546 Remove debug command * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Fix conditional for running yarn * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Bug fix for https://github.com/nodejs/node/issues/41058 * INF-2546 Add jest dependency * INF-2546 Add jest dependency * INF-2546 Reorganized commands * INF-2546 Bug fix * INF-2546 Bug fix * INF-2546 Add jest dependency * INF-2546 Move all yarn/jest-related functions to entrypoint.sh to improve image build time * INF-2546 Add jest-sonar-reporter dependency * INF-2546 Move yarn back to Dockerfile; rename RUN_YARN to RUN_JEST Co-authored-by: Dmitry Moiseenko <dmoiseenko@ingenio.com> Co-authored-by: Brett Anspach <banspach@ingenio.com>
39 lines
1.2 KiB
Bash
Executable file
39 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
if [[ -z "${SONAR_TOKEN}" ]]; then
|
|
echo "============================ WARNING ============================"
|
|
echo "Running this GitHub Action without SONAR_TOKEN is not recommended"
|
|
echo "============================ WARNING ============================"
|
|
fi
|
|
|
|
if [[ -z "${SONAR_HOST_URL}" ]]; then
|
|
echo "This GitHub Action requires the SONAR_HOST_URL env variable."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -f "${INPUT_PROJECTBASEDIR%/}pom.xml" ]]; then
|
|
echo "Maven project detected. You should run the goal 'org.sonarsource.scanner.maven:sonar' during build rather than using this GitHub Action."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -f "${INPUT_PROJECTBASEDIR%/}build.gradle" ]]; then
|
|
echo "Gradle project detected. You should use the SonarQube plugin for Gradle during build rather than using this GitHub Action."
|
|
exit 1
|
|
fi
|
|
|
|
unset JAVA_HOME
|
|
|
|
if [[ "${RUN_JEST}" == "true" ]]; then
|
|
npm install -g jest-cli jest-sonar-reporter
|
|
yarn add jest jest-environment-jsdom
|
|
yarn test --coverage --coverageDirectory='coverage'
|
|
fi
|
|
|
|
sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} ${INPUT_ARGS}
|
|
|
|
_tmp_file=$(ls "${INPUT_PROJECTBASEDIR}/" | head -1)
|
|
PERM=$(stat -c "%u:%g" "${INPUT_PROJECTBASEDIR}/$_tmp_file")
|
|
|
|
chown -R $PERM "${INPUT_PROJECTBASEDIR}/"
|