Nuget updates (#88) #53
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
name: Verification Build | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
solution: 'MinoriEditorShell.sln' | |
buildPlatform: Any CPU | |
buildConfiguration: Release | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
# if trying to build locally, make sure you have dotnet 3.1, 5.0 installed | |
# this container should have them pre-installed | |
# Needed for sonar analysis, even though java is installed | |
# sonar will not pick up version 11, so state specifically | |
# adopt is in tool cache so install should be quidker with it. | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt-hotspot' # Cached java | |
java-version: '11' | |
# Install GitVersion | |
# Requires .NET Core 3.1 | |
# https://github.com/marketplace/actions/gittools | |
- name: 'Install GitVersion' | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
with: | |
useConfigFile: true | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v1 | |
- name: Use NuGet > 5.0.0 | |
uses: nuget/setup-nuget@v1 | |
- name: Restore dependencies | |
run: dotnet restore ${{env.solution}} | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
with: | |
path: ~\sonar\cache | |
key: ${{runner.os}}-sonar | |
restore-keys: ${{runner.os}}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v1 | |
with: | |
path: .\.sonar\scanner | |
key: ${{runner.os}}-sonar-scanner | |
restore-keys: ${{runner.os}}-sonar-scanner | |
- name: Install SonarCloud scanner | |
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
shell: powershell | |
run: | | |
New-Item -Path .\.sonar\scanner -ItemType Directory | |
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner | |
- name: Prepare Scanner | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} | |
shell: powershell | |
run: > | |
.\.sonar\scanner\dotnet-sonarscanner | |
begin /k:"TorisanKitsune_MinoriEditorShell" /o:"torisankitsune" | |
/d:sonar.login="${{secrets.SONAR_TOKEN}}" /d:sonar.host.url="https://sonarcloud.io" | |
/d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml | |
/v:${{steps.gitversion.outputs.semVer}} | |
# projects uses GitVersion.MsBuild, so don't neeed to pass version | |
- name: Build | |
run: > | |
dotnet build ${{env.solution}} | |
--configuration ${{env.buildConfiguration}} --no-restore | |
-p:Version=${{steps.gitversion.outputs.FullSemVer}} | |
-p:FileVersion=${{steps.gitversion.outputs.AssemblySemFileVer}} | |
-p:InformationalVersion=${{steps.gitversion.outputs.InformationalVersion}} | |
- name: Create Artifacts | |
run: pwsh -command ".\CreateArtifacts.ps1" | |
- name: Test | |
run: dotnet test ${{env.solution}} --collect:"XPlat Code Coverage" --settings coverlet.runsettings | |
- name: Analyze build | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} | |
shell: powershell | |
run: .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{secrets.SONAR_TOKEN}}" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: MinoriEditorShell | |
path: Artifacts/*.7z | |
if-no-files-found: error |