Skip to content

Update quality tools. #16207

Update quality tools.

Update quality tools. #16207

Workflow file for this run

name: SonarCloud
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
runs-on: ubuntu-latest
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/[email protected]
if: env.SONAR_TOKEN != null
with:
fetch-depth: 0 # Disabling shallow clone is recommended for improving relevancy of reporting
- name: Set up Python
uses: actions/setup-python@v5
if: env.SONAR_TOKEN != null
with:
python-version: '3.12'
- name: Set up Node
uses: actions/[email protected]
if: env.SONAR_TOKEN != null
with:
node-version: '20'
- name: Collector
if: env.SONAR_TOKEN != null
working-directory: components/collector
run: |
python -m venv venv
. venv/bin/activate
ci/pip-install.sh
ci/unittest.sh
export PYTHONPATH=`python -c 'import sys;print(":".join(sys.argv[1:]))' src $PYTHONPATH`
python -m xmlrunner --output-file build/unittests.xml
- name: Notifier
if: env.SONAR_TOKEN != null
working-directory: components/notifier
run: |
python -m venv venv
. venv/bin/activate
ci/pip-install.sh
ci/unittest.sh
export PYTHONPATH=`python -c 'import sys;print(":".join(sys.argv[1:]))' src $PYTHONPATH`
python -m xmlrunner --output-file build/unittests.xml
- name: API-server
if: env.SONAR_TOKEN != null
working-directory: components/api_server
run: |
python -m venv venv
. venv/bin/activate
ci/pip-install.sh
ci/unittest.sh
export PYTHONPATH=`python -c 'import sys;print(":".join(sys.argv[1:]))' src $PYTHONPATH`
python -m xmlrunner --output-file build/unittests.xml
- name: Shared Code
if: env.SONAR_TOKEN != null
working-directory: components/shared_code
run: |
python -m venv venv
. venv/bin/activate
ci/pip-install.sh
ci/unittest.sh
export PYTHONPATH=`python -c 'import sys;print(":".join(sys.argv[1:]))' src $PYTHONPATH`
python -m xmlrunner --output-file build/unittests.xml
- name: Frontend
if: env.SONAR_TOKEN != null
working-directory: components/frontend
run: |
npm install --ignore-scripts
npm run --ignore-scripts build --if-present
npm test -- --coverage
env:
CI: true
- name: Create packages
if: env.SONAR_TOKEN != null
run: |
touch components/__init__.py
touch components/api_server/__init__.py
touch components/api_server/src/__init__.py
touch components/collector/__init__.py
touch components/collector/src/__init__.py
touch components/notifier/__init__.py
touch components/notifier/src/__init__.py
touch components/shared_code/__init__.py
touch components/shared_code/src/__init__.py
- name: Fix code coverage paths # Needed because the Sonar scanner runs in a container with different file paths
if: env.SONAR_TOKEN != null
run: |
sed -i 's/\/home\/runner\/work\/quality-time\/quality-time\//\/github\/workspace\//g' components/collector/build/unittest-coverage.xml
sed -i 's/\/home\/runner\/work\/quality-time\/quality-time\//\/github\/workspace\//g' components/notifier/build/unittest-coverage.xml
sed -i 's/\/home\/runner\/work\/quality-time\/quality-time\//\/github\/workspace\//g' components/api_server/build/unittest-coverage.xml
sed -i 's/\/home\/runner\/work\/quality-time\/quality-time\//\/github\/workspace\//g' components/shared_code/build/unittest-coverage.xml
- name: Sonarcloud scan
if: env.SONAR_TOKEN != null
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}