Skip to content

Fix SonarQube scanning #39

Fix SonarQube scanning

Fix SonarQube scanning #39

Workflow file for this run

name: ci
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.9.13'
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install -y libkrb5-dev
pip install -U setuptools pip wheel
pip install -e .[cpphash,redis,uwsgi]
pip install pytest --quiet
pip install mock
pip install pytest-asyncio
pip install -r requirements.txt
- name: Run tests
working-directory: tests
run: pytest -v
- name: Set VERSION env
run: echo "VERSION=$(cat setup.py | grep "version=" | cut -d'"' -f2)" >> $GITHUB_ENV
- name: SonarQube Scan (Push)
if: github.event_name == 'push'
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.host.url=${{ vars.SONARQUBE_HOST }}
-Dsonar.projectVersion=${{ env.VERSION }}
- name: SonarQube Scan (Pull Request)
if: github.event_name == 'pull_request'
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.host.url=${{ vars.SONARQUBE_HOST }}
-Dsonar.projectVersion=${{ env.VERSION }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}