Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
abf1447
Add sonar to project for quality checks
ArBridgeman May 28, 2025
ae27485
Move pysonar to direct dependencies
ArBridgeman Jun 3, 2025
53fb0a7
Add changelog entry
ArBridgeman Jun 3, 2025
d8f9a6f
Switch to nox task
ArBridgeman Jun 4, 2025
619f1ec
Merge branch 'main' into feature/451_add_pysonar
ArBridgeman Jun 4, 2025
741118d
Continue nox task, add to templates, & update documentation
ArBridgeman Jun 4, 2025
e975873
Fix template .gitignore & inherit secrets for report
ArBridgeman Jun 4, 2025
71a5ff4
Add new nox tasks to main tasks.py
ArBridgeman Jun 4, 2025
80e0736
Fix to relative path from . for coverage.xml & session
ArBridgeman Jun 4, 2025
cb43c0e
Add organization as required for pysonar
ArBridgeman Jun 4, 2025
fca58bb
Add statement to docs about adding to branch protections
ArBridgeman Jun 4, 2025
8395c69
Rename variable to avoid code smell, as built-in
ArBridgeman Jun 4, 2025
aeb6925
Remove f from non-f-string
ArBridgeman Jun 4, 2025
153adcb
Fix typo in documentation
ArBridgeman Jun 4, 2025
373c631
Move and rename to correct test folder
ArBridgeman Jun 4, 2025
d04be09
fixup! Rename variable to avoid code smell, as built-in
ArBridgeman Jun 4, 2025
dd250b6
Fix class name to fit convention
ArBridgeman Jun 4, 2025
c8ebdbc
Group copy_artifact tests together
ArBridgeman Jun 4, 2025
3f85359
Use variables to ensure names consistent throughout usually subsequen…
ArBridgeman Jun 4, 2025
3bb7f69
Simplify test and move into correct file
ArBridgeman Jun 4, 2025
cfc64e7
Remove file check as already done before validating them
ArBridgeman Jun 4, 2025
083c8ae
Switch validations to booleans and simplify to all or fail
ArBridgeman Jun 4, 2025
6d7d94f
Move over and simplify test for is_valid_lint_txt
ArBridgeman Jun 4, 2025
140875d
Move over and simplify test for is_valid_lint_json and mirror to is_v…
ArBridgeman Jun 4, 2025
64fa5d2
Move over and simplify test for is_valid_security_json
ArBridgeman Jun 4, 2025
48c8cee
Convert to handle validation error
ArBridgeman Jun 4, 2025
d66e5f0
Move over and simplify test for is_valid_coverage
ArBridgeman Jun 4, 2025
71f4070
Switch to simple assert
ArBridgeman Jun 4, 2025
02d7c4f
Add test for check_artifacts and switch prints to all bey stderr
ArBridgeman Jun 4, 2025
2fd5bf4
Fix warnings in sonar upload output
ArBridgeman Jun 4, 2025
0afc3fb
Remove code smells where non-f-strings
ArBridgeman Jun 4, 2025
7401da3
Switch python_files to be Iterable[str] as only used that way & restr…
ArBridgeman Jun 4, 2025
85ac99d
Add type ignore for unpacked list into session
ArBridgeman Jun 4, 2025
369705b
Project fix
ArBridgeman Jun 4, 2025
389c1e5
Fix comment
ArBridgeman Jun 5, 2025
ec5bf33
Add inherit secrets for sonar to pr-merge.ymls
ArBridgeman Jun 5, 2025
e19abd6
Merge branch 'main' into feature/451_add_pysonar
ArBridgeman Jun 10, 2025
5a35f66
Reduce scope of pylint to that of package
ArBridgeman Jun 10, 2025
254f905
Update documentation with summary and make clearer private vs public …
ArBridgeman Jun 10, 2025
e7fae9b
Re-lock dependencies
ArBridgeman Jun 10, 2025
95e97b8
Modify documentation per review
ArBridgeman Jun 12, 2025
12dca74
Rename to sonar:check
ArBridgeman Jun 12, 2025
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
13 changes: 4 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
name: CI

on:
push:
branches-ignore:
- "github-pages/*"
- "gh-pages/*"
- "main"
- "master"
pull_request:
types: [opened, synchronize, reopened]
schedule:
# At 00:00 on every 7th day-of-month from 1 through 31. (https://crontab.guru)
# At 00:00 on every 7th day-of-month from 1 through 31. (https://crontab.guru)
- cron: "0 0 1/7 * *"

jobs:

CI:
uses: ./.github/workflows/merge-gate.yml
secrets: inherit
permissions:
contents: read

Metrics:
needs: [ CI ]
uses: ./.github/workflows/report.yml
secrets: inherit
permissions:
contents: read
1 change: 1 addition & 0 deletions .github/workflows/pr-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
metrics:
needs: [ ci-job ]
uses: ./.github/workflows/report.yml
secrets: inherit
permissions:
contents: read
3 changes: 3 additions & 0 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Generate Report
run: poetry run -- nox -s project:report -- --format json | tee metrics.json

- name: Upload to sonar
run: poetry run -- nox -s sonar:check -- ${{ secrets.SONAR_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4.6.2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ odbcconfig/odbcinst.ini
.html-documentation

.coverage
.sonar

_build/

Expand Down
28 changes: 28 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
# Unreleased

## Summary
This version of the PTB adds nox task `sonar:check`, see #451. This allows us to
use SonarQube Cloud to analyze, visualize, & track linting, security, & coverage. In
order to properly set it up, you'll need to do the following instruction for each **public** project.
At this time, PTB currently does not support setting up SonarQube for a **private** project.

1. Specify in the `noxconfig.py` the relative path to the project's source code in `Config.source`
```python
source: Path = Path("exasol/toolbox")
```
2. Add the 'SONAR_TOKEN' to the 'Organization secrets' in GitHub (this requires a person being a GitHub organization owner).
3. Activate the SonarQubeCloud App
4. Create a project on SonarCloud
5. Add the following information to the project's file `pyproject.toml`
```toml
[tool.sonar]
projectKey = "com.exasol:<project-key>"
hostUrl = "https://sonarcloud.io"
organization = "exasol"
```
6. Post-merge, update the branch protections to include SonarQube analysis

## ✨ Features
* #451: Added nox task to execute pysonar & added Sonar to the CI

## ⚒️ Refactorings
* #451: Reduced scope of nox tasks `lint:code` (pylint) and `lint:security` (bandit) to analyze only the package code
30 changes: 27 additions & 3 deletions doc/user_guide/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ forward, and you just can use the example *noxfile.py* below.

.. _toolbox tasks:

7. Setup for deploying documentation (optional)
+++++++++++++++++++++++++++++++++++++++++++++++
7. Set up for deploying documentation (optional)
++++++++++++++++++++++++++++++++++++++++++++++++
Within the `gh-pages.yml`, we use the GitHub `upload-pages-artifact` and `deploy-pages`
actions. In order to properly deploy your pages, you'll need to reconfigure the GitHub
Pages settings for the repo:
Expand All @@ -199,8 +199,32 @@ We also need to configure settings for github-pages environment:
5. In the 'Deployment branches and tags', click 'Add deployment branch or tag rule'
6. Select 'Ref type' to be 'Tag' and set the 'Name pattern' to `[0-9]*.[0-9]*.[0-9]*` (or whatever matches that repo's tags)

8. Set up for Sonar
+++++++++++++++++++
PTB supports using SonarQube Cloud to analyze, visualize, & track linting, security, &
coverage. In order to properly set it up, you'll need to do the following instructions
for each **public** project. At this time, PTB currently does not support setting up
SonarQube for a **private** project.

8. Go 🥜
1. Specify in the `noxconfig.py` the relative path to the project's source code in `Config.source`
.. code-block:: python

source: Path = Path("exasol/toolbox")
2. Add the 'SONAR_TOKEN' to the 'Organization secrets' in GitHub (this requires a person being a GitHub organization owner).
3. Activate the SonarQubeCloud App
4. Create a project on SonarCloud
5. Add the following information to the project's file `pyproject.toml`
.. code-block:: toml

[tool.sonar]
projectKey = "com.exasol:<project-key>"
hostUrl = "https://sonarcloud.io"
organization = "exasol"
6. Post-merge, update the branch protections to include SonarQube analysis



9. Go 🥜
+++++++++++++
You are ready to use the toolbox. With *nox -l* you can list all available tasks.

Expand Down
Loading