Build improvements #201
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------------------ | |
# <auto-generated> | |
# | |
# This code was generated. | |
# | |
# - To turn off auto-generation set: | |
# | |
# [SonarCloudGitHubActions (AutoGenerate = false)] | |
# | |
# - To trigger manual generation invoke: | |
# | |
# nuke --generate-configuration GitHubActions_pr --host GitHubActions | |
# | |
# </auto-generated> | |
# ------------------------------------------------------------------------------ | |
name: pr | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
ubuntu-latest: | |
name: ubuntu-latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .Net 6.0.* | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.* | |
- name: Setup .Net 7.0.* | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.* | |
- name: Setup .Net 8.0.* | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.* | |
- name: Setup JDK (for SonarCloud) | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- name: Install/Update SonarCloud scanner | |
run: | |
dotnet tool update dotnet-sonarscanner --global | |
- name: Install/Update Coverlet Report Generator (for SonarCloud) | |
run: | |
dotnet tool update dotnet-reportgenerator-globaltool --global | |
- name: Begin SonarCloud scan | |
run: | |
dotnet-sonarscanner begin /k:"ebjornset_DryGen" /o:"ebjornset" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths="./.sonarqubecoverage/SonarQube.xml" | |
- name: 'Cache: .nuke/temp, ~/.nuget/packages' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.nuke/temp | |
~/.nuget/packages | |
key: ${{ runner.os }}-${{ hashFiles('global.json', 'src/**/*.csproj') }} | |
- name: 'Run: ' | |
run: ./build.cmd | |
- name: Check if there are any git changes | |
id: get_changes | |
run: echo "::set-output name=changed::$(git status --porcelain | wc -l)" | |
- name: List any git changes | |
if: steps.get_changes.outputs.changed != 0 | |
run: git status --porcelain | |
- name: Display any git diffs | |
if: steps.get_changes.outputs.changed != 0 | |
run: git diff HEAD | |
- name: Fail if there are any git changes | |
if: steps.get_changes.outputs.changed != 0 | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('Git modifications found after <nuke>. Maybe <nuke [docs]> was omitted before commit? Check the output from the step "Display any git diffs" and/or "List any git changes" for details about the detected git changes.') | |
- name: Run Coverlet Report Generator (for SonarCloud) | |
run: | |
reportgenerator "-reports:**/TestResults/**/coverage.cobertura.xml" "-targetdir:.sonarqubecoverage" "-reporttypes:SonarQube" | |
- name: End SonarCloud scan | |
run: | |
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload test results artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: TestResults | |
retention-days: 30 | |
path: '**/TestResults/**/*' |