Skip to content
Closed
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
26 changes: 15 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
name: Build
on:
push:
branches:
- master
branches: [ master ]
pull_request:
types: [opened, synchronize, reopened]

jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # needed for PR decoration/comments
env:
DB_CONNECTION_STRING: "mysql+mysqlconnector://user:password@localhost/dbname"
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # <-- required for the new action
# No SONAR_HOST_URL for SonarCloud

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install Dependencies
run: |
pip install -r requirements.txt
run: pip install -r requirements.txt

- name: Run Tests with Coverage
run: |
mkdir -p reports
pytest --junitxml=reports/results.xml --cov=app --cov-report=xml
coverage xml -i # Regenerate the XML report with corrected paths
mv coverage.xml reports/coverage.xml # Move the report to the correct directory
# Ensure coverage XML paths are correct & in expected location
coverage xml -i || true
if [ -f coverage.xml ]; then mv -f coverage.xml reports/coverage.xml; fi

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
uses: SonarSource/sonarqube-scan-action@v5.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for PR decoration
with:
args: >
-Dsonar.projectKey=ManassehV2_aptarapi
Expand Down
Loading