Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: SonarQube analysis

on:
push:
branches: [ "main", "test" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

permissions:
pull-requests: read
contents: read

jobs:
Analysis:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Disable shallow clones for better analysis

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage pytest vcrpy

- name: Run tests with coverage
run: |
coverage run test_main.py
coverage xml

- name: Analyze with SonarQube
uses: SonarSource/sonarqube-scan-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectKey=GabrielPalmar_HiveBox-Project
-Dsonar.organization=gabrielpalmar
-Dsonar.sources=.
-Dsonar.exclusions=**/*test*/**,**/fixtures/**,**/__pycache__/**,**/venv/**,**/.git/**