diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c61fc2a..bdbfa64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,11 +22,22 @@ jobs: registry-user: ${{ secrets.REGISTRY_USER }} registry-token: ${{ secrets.REGISTRY_TOKEN }} + sonar: + needs: tests + uses: PANiXiDA-Infrastructure/ci-cd/.github/workflows/dotnet-sonar.yml@main + with: + project-key: ${{ vars.SONAR_PROJECT_KEY }} + secrets: + sonar-token: ${{ secrets.SONAR_TOKEN }} + registry-user: ${{ secrets.REGISTRY_USER }} + registry-token: ${{ secrets.REGISTRY_TOKEN }} + publish: if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} needs: - format - tests + - sonar uses: PANiXiDA-Infrastructure/ci-cd/.github/workflows/dotnet-publish-global-nuget.yml@main secrets: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} diff --git a/AGENTS.md b/AGENTS.md index 722d98f..7776dd9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -72,6 +72,13 @@ Before considering work complete, run: - `dotnet build --configuration Release` - `dotnet test --configuration Release` +## Continuous integration + +- SonarQube analysis is mandatory for every pull request and push to `main`. +- The `sonar` job must run after tests, and `publish` must depend on the + successful SonarQube Quality Gate. +- Do not make SonarQube conditional or allow its failures to be ignored. + ## Packaging and versioning - Package metadata must stay complete and consistent. diff --git a/README.md b/README.md index 6dc66cc..65f94f9 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,12 @@ dotnet test --configuration Release dotnet pack --configuration Release ``` +### Continuous integration + +Every pull request and push to `main` runs formatting, tests, and mandatory +SonarQube analysis. Publishing from `main` starts only after the SonarQube +Quality Gate succeeds. + ## Tooling This repository uses: