Skip to content

Update the build definition #1122

Update the build definition

Update the build definition #1122

Workflow file for this run

name: continuous integration
on:
push:
branches:
- main
- support/*
create:
tags:
- '*'
pull_request:
jobs:
build:
name: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: Print environment
run: 'gci env:'
shell: pwsh
- name: Set up JDK for SonarScanner
uses: actions/setup-java@v1
with:
java-version: 17
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Setup dotnet-cover
run: dotnet tool install --global dotnet-coverage
- name: Setup SonarScanner
run: dotnet tool install --global dotnet-sonarscanner
- 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 --verbosity normal
- name: Publish Small Release
run: dotnet publish --configuration Release
working-directory: src\SimpleAccounting
- name: Publish Large Release
run: dotnet publish --configuration Release -r win-x64 --self-contained
working-directory: src\SimpleAccounting
- 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
dotnet sonarscanner begin /d:"sonar.host.url=https://sonarcloud.io" /o:lg2de /k:lg2de_SimpleAccounting $branchCommand /d:sonar.token=$env:SONAR_TOKEN /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
shell: pwsh
- name: Build Debug and Test
run: dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
- name: Complete SonarScanner
run: dotnet sonarscanner end /d:sonar.token=${{ secrets.SONAR_TOKEN }}
- name: Upload small artifact
uses: actions/upload-artifact@v4
with:
name: SimpleAccounting
path: src\SimpleAccounting\bin\Release\net8.0-windows\publish
- name: Upload large artifact
uses: actions/upload-artifact@v4
with:
name: SimpleAccounting-self-contained
path: src\SimpleAccounting\bin\Release\net8.0-windows\win-x64\publish