Fix SonarQube warning about missing reference for analysis (#796)

This commit is contained in:
Marco Antognini 2022-03-08 11:31:27 +01:00 committed by GitHub
parent 08d650ab42
commit 02cae0ceb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,8 @@ env:
CIRRUS_CLONE_DEPTH: 0 CIRRUS_CLONE_DEPTH: 0
# Use bash (instead of sh on linux or cmd.exe on windows) # Use bash (instead of sh on linux or cmd.exe on windows)
CIRRUS_SHELL: bash CIRRUS_SHELL: bash
BASE_BRANCH: ${CIRRUS_BASE_BRANCH}
DEFAULT_BRANCH: ${CIRRUS_DEFAULT_BRANCH}
container_definition: &CONTAINER_DEFINITION container_definition: &CONTAINER_DEFINITION
@ -40,6 +42,7 @@ tooling_tests_task:
- pipenv install - pipenv install
- pipenv run pip install pytest pytest-cov - pipenv run pip install pytest pytest-cov
tests_script: tests_script:
- bash ci/fetch_branches.sh
- cd rspec-tools - cd rspec-tools
- pipenv run pytest --cov=rspec_tools --cov-report=xml - pipenv run pytest --cov=rspec_tools --cov-report=xml
<<: *SETUP_SONAR_SCANNER <<: *SETUP_SONAR_SCANNER
@ -65,6 +68,7 @@ frontend_tests_task:
- cd frontend - cd frontend
- npm install - npm install
tests_script: tests_script:
- bash ci/fetch_branches.sh
- cd frontend - cd frontend
- npm run build - npm run build
- npm test -- --detectOpenHandles --coverage . - npm test -- --detectOpenHandles --coverage .

7
ci/fetch_branches.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
# When neither BASE_BRANCH nor DEFAULT_BRANCH are defined, fall back to "master".
BRANCH="${BASE_BRANCH:-${DEFAULT_BRANCH:-master}}"
git fetch --force origin "refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH}"