@@ -5,49 +5,57 @@ inputs:
55 dotnet_version :
66 description : .NET SDK version to be used
77 required : false
8- default : ' 10.0.x'
8+ default : " 10.0.x"
99 sonar_enabled :
1010 description : Enable code scan by Sonar
1111 required : false
12- default : ' false'
12+ default : " false"
1313 sonar_organization :
1414 description : Sonar organization
1515 required : false
16- default : ' '
16+ default : " "
1717 sonar_host_url :
1818 description : Sonar host URL
1919 required : false
20- default : ' '
20+ default : " "
2121 sonar_project_name :
2222 description : Sonar project name
2323 required : false
24- default : ' '
24+ default : " "
2525 sonar_project_key :
2626 description : Sonar project key
2727 required : false
28- default : ' '
28+ default : " "
2929 sonar_token :
3030 description : Sonar token for login
3131 required : false
32- default : ' '
32+ default : " "
3333 report_folder :
3434 description : Folder where report files will be generated
3535 required : false
3636 default : report
37+ fossa_enabled :
38+ description : Enable license compliance with FOSSA
39+ required : false
40+ default : " false"
41+ fossa_api_key :
42+ description : FOSSA API KEY
43+ required : false
44+ default : " "
3745
3846runs :
3947 using : " composite"
4048 steps :
4149 - name : Install .NET
4250 uses : actions/setup-dotnet@v4
4351 with :
44- dotnet-version : ${{inputs.dotnet_version}}
52+ dotnet-version : ${{ inputs.dotnet_version }}
4553 - name : Set up JDK for Sonar
4654 if : ${{ inputs.sonar_enabled == 'true' }}
4755 uses : actions/setup-java@v4
4856 with :
4957 java-version : 21
50- distribution : ' zulu'
58+ distribution : " zulu"
5159 - name : Install .NET linters
5260 if : ${{ inputs.dotnet_version == '7.0.x' }}
5361 run : dotnet tool install -g dotnet-format --version "7.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json
@@ -86,24 +94,50 @@ runs:
8694 shell : bash
8795 - name : Start code analysis
8896 if : ${{ inputs.sonar_enabled == 'true' }}
89- run : ./.sonar/scanner/dotnet-sonarscanner begin /k:"${{inputs.sonar_project_key}}" /o:"${{inputs.sonar_organization}}" /n:"${{inputs.sonar_project_name}}" /d:sonar.token="${{inputs.sonar_token}}" /d:sonar.host.url="${{inputs.sonar_host_url}}" /d:sonar.cpd.exclusions="**/*Generated*.cs,${{inputs.report_folder}}/**" /d:sonar.exclusions="${{inputs.report_folder}}/**/*" /d:sonar.coverageReportPaths="${{inputs.report_folder}}/SonarQube.xml"
97+ run : |
98+ ./.sonar/scanner/dotnet-sonarscanner begin /k:"${{ inputs.sonar_project_key }}" /o:"${{ inputs.sonar_organization }}" \
99+ /n:"${{ inputs.sonar_project_name }}" /d:sonar.token="${{ inputs.sonar_token}}" /d:sonar.host.url="${{inputs.sonar_host_url}}" \
100+ /d:sonar.cpd.exclusions="**/*Generated*.cs,${{ inputs.report_folder }}/**" /d:sonar.exclusions="${{ inputs.report_folder }}/**/*" \
101+ /d:sonar.coverageReportPaths="${{ inputs.report_folder }}/SonarQube.xml"
90102 shell : bash
91103 - name : Build .NET solution
92104 run : dotnet build --no-restore
93105 shell : bash
94106 - name : Run tests
95- 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"
107+ run : |
108+ dotnet test --no-build --verbosity normal --configuration Debug \
109+ --logger:"junit;LogFilePath=..\..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" \
110+ --collect:"XPlat Code Coverage"
96111 shell : bash
97112 env :
98113 ASPNETCORE_ENVIRONMENT : Development
99114 Application__IsHttpsRedirectionEnabled : " false"
100115 - name : Generate test report
101- run : reportgenerator "-reports:./test/*/TestResults/*/coverage.cobertura.xml" "-targetdir:${{inputs.report_folder}}" "-reporttypes:Cobertura;Html;TextSummary;SonarQube"
116+ run : |
117+ reportgenerator "-reports:./test/*/TestResults/*/coverage.cobertura.xml" \
118+ "-targetdir:${{inputs.report_folder}}" \
119+ "-reporttypes:Cobertura;Html;TextSummary;SonarQube"
102120 shell : bash
103121 - name : Complete code analysis
104122 if : ${{ inputs.sonar_enabled == 'true' }}
105123 run : ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{inputs.sonar_token}}"
106124 shell : bash
125+
126+ - name : License Compliance with FOSSA
127+ if : ${{ inputs.fossa_enabled == 'true' }}
128+ uses : fossas/fossa-action@v1
129+ with :
130+ api-key : " ${{ inputs.fossa_api_key }}"
131+ run-tests : false
132+
133+ - name : Generate SBOM with Syft
134+ uses : anchore/sbom-action@v0
135+ # with:
136+ # path: . # Or Dockerfile path
137+ # format: spdx-json # Or cyclonedx-json
138+ # output-file: sbom.json
139+ # upload-artifact: true # Auto-upload to workflow artifacts
140+
107141 - name : Archive test results
108142 uses : actions/upload-artifact@v4
109143 with :
0 commit comments