continuous integration #831
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: | |
- main | |
create: | |
tags: | |
- '*' | |
pull_request: | |
pull_request_target: | |
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 | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
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=$env: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: Publish Release | |
run: dotnet publish --configuration Release --no-restore | |
- name: Complete SonarScanner | |
run: SonarScanner.MSBuild.exe end /d:sonar.login=${{ secrets.SONAR_TOKEN }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: SimpleAccounting | |
path: src\SimpleAccounting\bin\Release\netcoreapp3.1\publish |