continuous integration #1076
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
name: continous integration | |
on: | |
push: | |
branches: | |
- master | |
create: | |
tags: | |
- '*' | |
pull_request: | |
types: [opened, edited, reopened, synchronize] | |
jobs: | |
build: | |
name: build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
git fetch --prune --unshallow | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.103 | |
- name: Setup SonarScanner | |
run: choco install "sonarscanner-msbuild-net46" -y | |
- name: Patch version info | |
run: .\PatchVersion.ps1 | |
shell: pwsh | |
env: | |
GITHUB_PR_REF: ${{ github.head_ref }} | |
- name: Restore packages | |
run: dotnet restore --configfile nuget.config | |
- name: Prepare SonarScanner | |
run: | | |
$prNo=${{ github.event.number }} | |
if ($prNo -gt 0) { | |
$branch="${{ github.HEAD_REF }}" | |
Write-Host analyzing Pull Request $prNo on branch $branch | |
$branchCommand="/d:sonar.pullrequest.key=$prNo" | |
} else { | |
$branch=$env:GITHUB_REF -replace "(\w+/)*","" | |
Write-Host analyzing branch $branch | |
$branchCommand="/d:sonar.branch.name=$branch" | |
} | |
Write-Host CMDs=$branchCommand | |
SonarScanner.MSBuild.exe begin /d:"sonar.host.url=https://sonarcloud.io" /o:lg2de /k:lg2de_SimpleAccounting $branchCommand /d:sonar.login=${{ secrets.SONAR_TOKEN }} /d:sonar.cs.opencover.reportsPaths=CoverOutput\coverage.xml | |
shell: pwsh | |
- name: Build Debug | |
run: dotnet build --configuration Debug --no-restore | |
- name: Test with OpenCover | |
run: | | |
.\CreateCoverReport.ps1 | |
# Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh | |
# bash codecov.sh -f "CoverOutput/coverage.xml" -t ${{ secrets.CODECOV_TOKEN }} | |
shell: pwsh | |
- name: Build Release | |
run: dotnet build --configuration Release --no-restore | |
- name: Complete SonarScanner | |
run: SonarScanner.MSBuild.exe end /d:sonar.login=${{ secrets.SONAR_TOKEN }} | |
- name: Prepare artifact | |
run: Get-ChildItem .\src\SimpleAccounting\bin\Release\netcoreapp3.1 -Filter *.json | % { if ($_.FullName.EndsWith("runtimeconfig.json") -eq $false) { Remove-Item $_.FullName } } | |
shell: pwsh | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: SimpleAccounting | |
path: src\SimpleAccounting\bin\Release\netcoreapp3.1 |