Update nuget depends #70
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 18 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt-hotspot' # Cached java | |
java-version: '18' | |
# 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:"mkromis_MinoriEditorShell" /o:"mkromis" | |
/d:sonar.token="${{ 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: | | |
# Get list of all nupkgs | |
$nupkgs = Get-ChildItem -Path .\Modules -Filter *.nupkg -Recurse | |
$basedir = 'MinoriEditorSystem-' + $env:GitVersion_NuGetVersion | |
# Move each item into artifacts | |
# rm Artifacts -Recurse -Force | |
mkdir Artifacts\$basedir\Nugets | |
# Copy nugets to nuget folder | |
foreach ($nupkg in $nupkgs) { | |
$leaf = Split-Path $nupkg -Leaf | |
$outFile = "Artifacts\$basedir\Nugets\$leaf" | |
echo $nupkg.FullName ' -> ' $outFile | |
Copy-Item $nupkg.FullName $outFile | |
} | |
# Copy Demo Folder | |
#mkdir Artifacts\$basedir\Demos | |
cp Demos\SimpleDemo\SimpleDemo.WPF\bin\Release\net7.0-windows Artifacts\$basedir\Demos\SimpleDemo.WPF -Recurse | |
cp Demos\SimpleDemo\SimpleDemo.RibbonWPF\bin\Release\net7.0-windows Artifacts\$basedir\Demos\SimpleDemo.RibbonWPF -Recurse | |
cp Demos\MinoriDemo\MinoriDemo.WPF\bin\Release\net7.0-windows Artifacts\$basedir\Demos\MinoriDemo.WPF -Recurse | |
cp Demos\MinoriDemo\MinoriDemo.RibbonWPF\bin\Release\net7.0-windows Artifacts\$basedir\Demos\MinoriDemo.RibbonWPF -Recurse | |
# Compress folder into 7z file | |
cd Artifacts | |
7z a "$basedir.7z" $basedir | |
cd .. | |
- 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 |