|
36 | 36 | run: dotnet restore "${{ env.solution-path }}" |
37 | 37 | - name: Build |
38 | 38 | run: dotnet build "${{ env.solution-path }}" --no-restore --configuration Release -p:version=${{ steps.gitversion.outputs.majorMinorPatch }} |
| 39 | + - name: Test |
| 40 | + run: dotnet test "${{ env.solution-path }}" --no-build --configuration Release |
| 41 | + |
| 42 | + |
| 43 | + code-quality: |
| 44 | + runs-on: windows-latest |
| 45 | + name: Analyze Code Quality |
| 46 | + env: |
| 47 | + solution-path: './src/NetCore.Utilities.Email.SendGrid.sln' |
| 48 | + steps: |
| 49 | + - name: Set up JDK 11 |
| 50 | + uses: actions/setup-java@v1 |
| 51 | + with: |
| 52 | + java-version: 1.11 |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + with: |
| 55 | + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
| 56 | + - name: Cache SonarCloud packages |
| 57 | + uses: actions/cache@v1 |
| 58 | + with: |
| 59 | + path: ~\sonar\cache |
| 60 | + key: ${{ runner.os }}-sonar |
| 61 | + restore-keys: ${{ runner.os }}-sonar |
| 62 | + - name: Cache SonarCloud scanner |
| 63 | + id: cache-sonar-scanner |
| 64 | + uses: actions/cache@v1 |
| 65 | + with: |
| 66 | + path: .\.sonar\scanner |
| 67 | + key: ${{ runner.os }}-sonar-scanner |
| 68 | + restore-keys: ${{ runner.os }}-sonar-scanner |
| 69 | + - name: Install SonarCloud scanner |
| 70 | + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' |
| 71 | + shell: powershell |
| 72 | + run: | |
| 73 | + New-Item -Path .\.sonar\scanner -ItemType Directory |
| 74 | + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner |
| 75 | + |
| 76 | + - name: Install GitVersion |
| 77 | + run: dotnet tool install --global GitVersion.Tool |
| 78 | + |
| 79 | + - name: Determine Version |
| 80 | + id: gitversion |
| 81 | + uses: gittools/actions/gitversion/[email protected] |
| 82 | + with: |
| 83 | + useConfigFile: true |
39 | 84 |
|
| 85 | + - name: Build and analyze |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
| 88 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 89 | + shell: powershell |
| 90 | + run: | |
| 91 | + .\.sonar\scanner\dotnet-sonarscanner begin /k:"IowaComputerGurus_netcore.utilities.email.sendgrid" /o:"iowacomputergurus-github" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" |
| 92 | + dotnet restore "${{ env.solution-path }}" |
| 93 | + dotnet build "${{ env.solution-path }}" --no-restore --configuration Release -p:version=${{ steps.gitversion.outputs.majorMinorPatch }} |
| 94 | + dotnet test "${{ env.solution-path }}" --no-build --configuration Release --collect "XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover --logger "trx;LogFileName=unittests.trx" |
| 95 | + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" |
0 commit comments