89
89
uses : github/codeql-action/analyze@v1
90
90
91
91
unit-test :
92
- runs-on : windows -latest
92
+ runs-on : ubuntu -latest
93
93
steps :
94
94
- name : Set up JDK 11
95
95
uses : actions/setup-java@v1
@@ -111,43 +111,40 @@ jobs:
111
111
- uses : actions/checkout@v2
112
112
with :
113
113
fetch-depth : 0
114
-
115
- - name : Cache SonarCloud packages
116
- uses : actions/cache@v1
117
- with :
118
- path : ~\sonar\cache
119
- key : ${{ runner.os }}-sonar
120
- restore-keys : ${{ runner.os }}-sonar
121
-
122
- - name : Cache SonarCloud scanner
123
- id : cache-sonar-scanner
124
- uses : actions/cache@v1
125
- with :
126
- path : .\.sonar\scanner
127
- key : ${{ runner.os }}-sonar-scanner
128
- restore-keys : ${{ runner.os }}-sonar-scanner
129
-
114
+
130
115
- name : Install SonarCloud scanner
131
116
if : steps.cache-sonar-scanner.outputs.cache-hit != 'true'
132
- shell : powershell
133
- run : |
134
- New-Item -Path .\.sonar\scanner -ItemType Directory
135
- dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
117
+ run : dotnet tool install --global dotnet-sonarscanner
136
118
137
119
- name : Restore dependencies
138
120
run : dotnet restore
139
121
working-directory : ./src
140
122
123
+ - name : Begin SonarScanner
124
+ env :
125
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
126
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
127
+ run : dotnet sonarscanner begin /k:"Project-MONAI_monai-deploy-informatics-gateway" /o:"project-monai" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="${{ env.TEST_RESULTS }}/**/*.xml"
128
+ working-directory : ./src
129
+
141
130
- name : Build & Test
142
131
env :
143
132
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
144
133
SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
145
- shell : powershell
146
- run : |
147
- ..\.sonar\scanner\dotnet-sonarscanner begin /k:"Project-MONAI_monai-deploy-informatics-gateway" /o:"project-monai" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="src\${{ env.TEST_RESULTS }}\**\*.xml"
148
- dotnet build -c ${{ env.BUILD_CONFIG }} --nologo "${{ env.SOLUTION }}"
149
- Get-ChildItem -Recurse | Where-Object { $_.Name -like "*Test.csproj" } | ForEach-Object { dotnet test -c ${{ env.BUILD_CONFIG }} -v=minimal -r "${{ env.TEST_RESULTS }}" --collect:"XPlat Code Coverage" --settings coverlet.runsettings $_.FullName }
150
- ..\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
134
+ run : dotnet build -c ${{ env.BUILD_CONFIG }} --nologo "${{ env.SOLUTION }}"
135
+
136
+ - name : Build & Test
137
+ env :
138
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
139
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
140
+ run : find ~+ -type f -name "*.Test.csproj" | xargs -L1 dotnet test -c ${{ env.BUILD_CONFIG }} -v=minimal -r "${{ env.TEST_RESULTS }}" --collect:"XPlat Code Coverage" --settings coverlet.runsettings
141
+ working-directory : ./src
142
+
143
+ - name : End SonarScanner
144
+ env :
145
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
146
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
147
+ run : dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
151
148
working-directory : ./src
152
149
153
150
- uses : codecov/codecov-action@v2
0 commit comments