From 89d9e748fcc06eca9cbc3db49b3d8bc57d4b824c Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 11:29:50 +0100 Subject: [PATCH 01/10] Fix invalid ref on extra vars for dotnet quality --- .github/workflows/reusable-dotnet-quality.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-dotnet-quality.yml b/.github/workflows/reusable-dotnet-quality.yml index 5ff8b77..95174b2 100644 --- a/.github/workflows/reusable-dotnet-quality.yml +++ b/.github/workflows/reusable-dotnet-quality.yml @@ -95,10 +95,10 @@ jobs: steps: - name: Set additional variables run: | - if [[ -z "${{ secrets.extra-vars }}" ]]; then + if [[ -z "${{ inputs.extra-vars }}" ]]; then echo "No extra-vars provided - skipping" else - echo "${{ secrets.extra-vars }}" >> "$GITHUB_ENV" + echo "${{ inputs.extra-vars }}" >> "$GITHUB_ENV" fi - name: Clone repository uses: actions/checkout@v6 From db2b1ae890e6130fd6706e76419ae8e9d21179bb Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 11:29:59 +0100 Subject: [PATCH 02/10] Remove useless comment --- .github/workflows/reusable-terraform-deployment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/reusable-terraform-deployment.yml b/.github/workflows/reusable-terraform-deployment.yml index 7b6fe40..659fde0 100644 --- a/.github/workflows/reusable-terraform-deployment.yml +++ b/.github/workflows/reusable-terraform-deployment.yml @@ -98,7 +98,6 @@ jobs: ref: ${{ inputs.workflow-parts-version }} path: workflow-parts - name: Add runner ID to MongoDB Atlas - # uses: devpro/github-workflow-parts/actions/mongodb-atlas/add-runner-ip@... cannot be used with an input parameter in it (must be static) so checkout is mandatory uses: ./workflow-parts/actions/mongodb-atlas/add-runner-ip with: atlas-publickey: ${{ secrets.atlas-publickey }} From 359427548fbdfbc8af19b17d6b0a41fa20f51a37 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 11:30:11 +0100 Subject: [PATCH 03/10] Remove mongodb start from dotnet quality --- .github/workflows/reusable-dotnet-quality.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/reusable-dotnet-quality.yml b/.github/workflows/reusable-dotnet-quality.yml index 95174b2..8cb6a6d 100644 --- a/.github/workflows/reusable-dotnet-quality.yml +++ b/.github/workflows/reusable-dotnet-quality.yml @@ -32,11 +32,6 @@ on: type: string required: false default: Quality - mongodb-enabled: - description: "Start MongoDB for integration tests?" - type: boolean - required: false - default: false operating-system: description: Operating system executing the runner type: string @@ -114,9 +109,6 @@ jobs: uses: ./workflow-parts/actions/dotnet/install-lint-restore with: dotnet-version: ${{ inputs.dotnet-version }} - - name: Start MongoDB - if: ${{ inputs.mongodb-enabled }} - uses: ./workflow-parts/actions/mongodb/start - name: Run optional custom commands if: ${{ inputs.custom-commands != '' }} run: | From a4c82c6d051361a2b6e4a5cba321f3ec8dff3983 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 11:34:52 +0100 Subject: [PATCH 04/10] Explicit bash shell --- .github/workflows/reusable-dotnet-quality.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-dotnet-quality.yml b/.github/workflows/reusable-dotnet-quality.yml index 8cb6a6d..3f8deb9 100644 --- a/.github/workflows/reusable-dotnet-quality.yml +++ b/.github/workflows/reusable-dotnet-quality.yml @@ -89,10 +89,9 @@ jobs: working-directory: ${{ inputs.working-directory }} steps: - name: Set additional variables + shell: bash run: | - if [[ -z "${{ inputs.extra-vars }}" ]]; then - echo "No extra-vars provided - skipping" - else + if [[ -n "${{ inputs.extra-vars }}" ]]; then echo "${{ inputs.extra-vars }}" >> "$GITHUB_ENV" fi - name: Clone repository From 086bf84a6f5d28e4c67a0839a70ab18e9dc17755 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 11:46:22 +0100 Subject: [PATCH 05/10] Explicit disable git autocrlf --- .github/workflows/reusable-dotnet-quality.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/reusable-dotnet-quality.yml b/.github/workflows/reusable-dotnet-quality.yml index 3f8deb9..fcfab9d 100644 --- a/.github/workflows/reusable-dotnet-quality.yml +++ b/.github/workflows/reusable-dotnet-quality.yml @@ -94,6 +94,9 @@ jobs: if [[ -n "${{ inputs.extra-vars }}" ]]; then echo "${{ inputs.extra-vars }}" >> "$GITHUB_ENV" fi + - name: Disable git autocrlf + run: git config --global core.autocrlf false + shell: bash - name: Clone repository uses: actions/checkout@v6 with: From b62de6216c49b5fb20f12bebc066b527f15337a5 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 11:55:17 +0100 Subject: [PATCH 06/10] Add check on generate report --- actions/dotnet/build-test/action.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/actions/dotnet/build-test/action.yml b/actions/dotnet/build-test/action.yml index cc2e2a6..2bab2b6 100644 --- a/actions/dotnet/build-test/action.yml +++ b/actions/dotnet/build-test/action.yml @@ -13,17 +13,19 @@ runs: - name: Build .NET code run: dotnet build --no-restore --configuration Debug shell: bash - - name: Run .NET tests + - name: Run tests run: | dotnet test --no-build --verbosity normal --configuration Debug \ - --logger:"junit;LogFilePath=..\..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" \ - --collect:"XPlat Code Coverage" + --results-directory "${{ inputs.report-folder }}/TestResults" \ + --report-xunit-trx \ + --coverage --coverage-output-format cobertura shell: bash env: ASPNETCORE_ENVIRONMENT: Development - name: Generate test report + if: hashFiles(format('{0}/TestResults/**/*.cobertura.xml', inputs.report-folder)) != '' run: | - reportgenerator "-reports:./test/*/TestResults/*/coverage.cobertura.xml" \ + reportgenerator "-reports:${{ inputs.report-folder }}/TestResults/*.cobertura.xml" \ "-targetdir:${{ inputs.report-folder }}" \ - "-reporttypes:Cobertura;Html;TextSummary" + "-reporttypes:Cobertura;Html;TextSummary;SonarQube" shell: bash From 9a4de16b0eb23b5305809f4362cca5496121f674 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 12:06:45 +0100 Subject: [PATCH 07/10] Update check --- actions/dotnet/build-test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/dotnet/build-test/action.yml b/actions/dotnet/build-test/action.yml index 2bab2b6..d01c5b6 100644 --- a/actions/dotnet/build-test/action.yml +++ b/actions/dotnet/build-test/action.yml @@ -23,7 +23,7 @@ runs: env: ASPNETCORE_ENVIRONMENT: Development - name: Generate test report - if: hashFiles(format('{0}/TestResults/**/*.cobertura.xml', inputs.report-folder)) != '' + if: ${{ always() && hashFiles('report/TestResults/*.cobertura.xml') != '' }} run: | reportgenerator "-reports:${{ inputs.report-folder }}/TestResults/*.cobertura.xml" \ "-targetdir:${{ inputs.report-folder }}" \ From 69d603b2aa035cf132b2d1023e04baff48a9f800 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 12:22:02 +0100 Subject: [PATCH 08/10] Update --- .github/workflows/reusable-dotnet-quality.yml | 9 +++++++++ actions/dotnet/build-test/action.yml | 9 ++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-dotnet-quality.yml b/.github/workflows/reusable-dotnet-quality.yml index fcfab9d..e9785f0 100644 --- a/.github/workflows/reusable-dotnet-quality.yml +++ b/.github/workflows/reusable-dotnet-quality.yml @@ -8,9 +8,15 @@ on: type: string required: false default: "" + dotnet-test-args: + description: ".NET test arguments (for example \"--report-xunit-trx --coverage --coverage-output-format cobertura\")" + type: string + required: false + default: "" dotnet-version: description: .NET version type: string + required: false default: "10.0" extra-vars: description: "Additional environment variables at the start of the pipeline" @@ -95,6 +101,7 @@ jobs: echo "${{ inputs.extra-vars }}" >> "$GITHUB_ENV" fi - name: Disable git autocrlf + if: ${{ inputs.operating-system == 'windows-latest' }} run: git config --global core.autocrlf false shell: bash - name: Clone repository @@ -118,6 +125,8 @@ jobs: - name: Build & test if: ${{ ! inputs.sonar-enabled }} uses: ./workflow-parts/actions/dotnet/build-test + with: + dotnet-test-args: ${{ inputs.dotnet-test-args }} - name: Build, test & analyze if: ${{ inputs.sonar-enabled }} uses: ./workflow-parts/actions/dotnet/build-test-sonar diff --git a/actions/dotnet/build-test/action.yml b/actions/dotnet/build-test/action.yml index d01c5b6..cf25094 100644 --- a/actions/dotnet/build-test/action.yml +++ b/actions/dotnet/build-test/action.yml @@ -2,6 +2,10 @@ name: Build & Test description: Builds and runs tests on a .NET codebase inputs: + dotnet-test-args: + description: .NET test arguments + required: false + default: "" report-folder: description: Folder where report files will be generated required: false @@ -17,13 +21,12 @@ runs: run: | dotnet test --no-build --verbosity normal --configuration Debug \ --results-directory "${{ inputs.report-folder }}/TestResults" \ - --report-xunit-trx \ - --coverage --coverage-output-format cobertura + ${{ inputs.dotnet-test-args }} shell: bash env: ASPNETCORE_ENVIRONMENT: Development - name: Generate test report - if: ${{ always() && hashFiles('report/TestResults/*.cobertura.xml') != '' }} + if: ${{ always() && hashFiles(format('{0}/TestResults/*.cobertura.xml', inputs.report-folder)) != '' }} run: | reportgenerator "-reports:${{ inputs.report-folder }}/TestResults/*.cobertura.xml" \ "-targetdir:${{ inputs.report-folder }}" \ From 31454861640fdf15c1779c34fb5c857e9f31fac5 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 12:51:04 +0100 Subject: [PATCH 09/10] Improve dotnet test sonar with test args --- actions/dotnet/build-test-sonar/action.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/actions/dotnet/build-test-sonar/action.yml b/actions/dotnet/build-test-sonar/action.yml index 3d9331d..5806512 100644 --- a/actions/dotnet/build-test-sonar/action.yml +++ b/actions/dotnet/build-test-sonar/action.yml @@ -2,6 +2,10 @@ name: Build, Test & Analyze description: Builds, runs tests on a .NET codebase and run analysis with Sonar inputs: + dotnet-test-args: + description: .NET test arguments + required: false + default: "" java-version: description: Java version that will be installed (for Sonar CLI) required: false @@ -78,12 +82,12 @@ runs: run: | dotnet test --no-build --verbosity normal --configuration Debug \ --results-directory "${{ inputs.report-folder }}/TestResults" \ - --report-xunit-trx \ - --coverage --coverage-output-format cobertura + ${{ inputs.dotnet-test-args }} shell: bash env: ASPNETCORE_ENVIRONMENT: Development - name: Generate test report + if: ${{ always() && hashFiles(format('{0}/TestResults/*.cobertura.xml', inputs.report-folder)) != '' }} run: | reportgenerator "-reports:${{ inputs.report-folder }}/TestResults/*.cobertura.xml" \ "-targetdir:${{ inputs.report-folder }}" \ From 5a11ec3ddb01172bfa7a56668b7642b59b17c413 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 1 Mar 2026 12:59:40 +0100 Subject: [PATCH 10/10] Pass arguments to dotnet sonar --- .github/workflows/reusable-dotnet-quality.yml | 1 + actions/dotnet/build-test/action.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reusable-dotnet-quality.yml b/.github/workflows/reusable-dotnet-quality.yml index e9785f0..c3548f5 100644 --- a/.github/workflows/reusable-dotnet-quality.yml +++ b/.github/workflows/reusable-dotnet-quality.yml @@ -131,6 +131,7 @@ jobs: if: ${{ inputs.sonar-enabled }} uses: ./workflow-parts/actions/dotnet/build-test-sonar with: + dotnet-test-args: ${{ inputs.dotnet-test-args }} sonar-organization: ${{ inputs.sonar-organization }} sonar-host-url: ${{ inputs.sonar-host-url }} sonar-project-name: ${{ inputs.sonar-project-name }} diff --git a/actions/dotnet/build-test/action.yml b/actions/dotnet/build-test/action.yml index cf25094..e98e4ea 100644 --- a/actions/dotnet/build-test/action.yml +++ b/actions/dotnet/build-test/action.yml @@ -30,5 +30,5 @@ runs: run: | reportgenerator "-reports:${{ inputs.report-folder }}/TestResults/*.cobertura.xml" \ "-targetdir:${{ inputs.report-folder }}" \ - "-reporttypes:Cobertura;Html;TextSummary;SonarQube" + "-reporttypes:Cobertura;Html;TextSummary" shell: bash