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
28 changes: 16 additions & 12 deletions .github/workflows/reusable-dotnet-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -32,11 +38,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
Expand Down Expand Up @@ -94,12 +95,15 @@ jobs:
working-directory: ${{ inputs.working-directory }}
steps:
- name: Set additional variables
shell: bash
run: |
if [[ -z "${{ secrets.extra-vars }}" ]]; then
echo "No extra-vars provided - skipping"
else
echo "${{ secrets.extra-vars }}" >> "$GITHUB_ENV"
if [[ -n "${{ inputs.extra-vars }}" ]]; then
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
uses: actions/checkout@v6
with:
Expand All @@ -114,20 +118,20 @@ 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: |
${{ inputs.custom-commands }}
- 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
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 }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/reusable-terraform-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 6 additions & 2 deletions actions/dotnet/build-test-sonar/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}" \
Expand Down
13 changes: 9 additions & 4 deletions actions/dotnet/build-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,17 +17,18 @@ 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" \
${{ 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:./test/*/TestResults/*/coverage.cobertura.xml" \
reportgenerator "-reports:${{ inputs.report-folder }}/TestResults/*.cobertura.xml" \
"-targetdir:${{ inputs.report-folder }}" \
"-reporttypes:Cobertura;Html;TextSummary"
shell: bash
Loading