Skip to content
Merged
Show file tree
Hide file tree
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
60 changes: 60 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: SonarQube

on:
push:
branches: [ main, develop ]
pull_request:

jobs:
sonar:
runs-on: ubuntu-latest

steps:
- name: Check SONAR_TOKEN presence
run: |
if [ -z "$SONAR_TOKEN" ]; then
echo "SONAR_TOKEN missing"
exit 1
else
echo "SONAR_TOKEN present"
fi
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

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

- 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 requests
pip install pytest pytest-cov pytest-check coverage
pip install -e .

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6
with:
args: >
-Dsonar.scanner.skipJreProvisioning=true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_SCANNER_SKIP_JRE_PROVISIONING: "true"

- name: Run tests with coverage
run: |
coverage run -m pytest
coverage xml -o coverage.xml

8 changes: 2 additions & 6 deletions .github/workflows/test-sysmlv2-python-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'

- name: Cache pip dependencies
uses: actions/cache@v3
Expand All @@ -37,11 +37,7 @@ jobs:
- name: Run tests with coverage
run: |
mkdir -p test-results
pytest -v --tb=short \
--junitxml=test-results/results.xml \
--cov=src/sysmlv2_client \
--cov-report=xml:test-results/coverage.xml \
--cov-report=html:test-results/htmlcov
pytest -v --tb=short --junitxml=test-results/results.xml --cov=src/sysmlv2_client --cov-report=xml:test-results/coverage.xml --cov-report=html:test-results/htmlcov

- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ env/
flexo-setup/docker-compose/env/*.env
/build
/src/sysmlv2_python_client.egg-info
/test-results
8 changes: 8 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sonar.projectKey=sysmlv2-python-client
sonar.organization=openmbee
sonar.host.url=https://sonarcloud.io

sonar.sources=src
sonar.tests=tests
sonar.python.version=3.12
sonar.python.coverage.reportPaths=coverage.xml
Loading