Skip to content

pipeline syntax

pipeline syntax #617

Workflow file for this run

name: Build
on:
push:
branches:
- master
- test
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1 # Shallow clones should be disabled for a better relevancy of analysis
- name: Test Solution
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
$ErrorActionPreference = 'Stop';
dotnet build-server shutdown;
dotnet test .\clio.tests\clio.tests.csproj --collect:"XPlat Code Coverage";
$report = Get-ChildItem -Path .\clio.tests\TestResults -Recurse -Filter coverage.cobertura.xml;
Copy-Item $report.FullName -Destination .\TestResults\coverage.opencover.xml -Force;
- name: Publish UnitTest Results
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
$ErrorActionPreference = 'Stop';
C:\Tools\reportgenerator.exe -reports:TestResults\coverage.opencover.xml `
-targetdir:"D:\Projects\inetpub\wwwroot\Docs\clio\UnitTests\Html" `
-historydir:"D:\Projects\inetpub\wwwroot\Docs\clio\UnitTests\History" `
-assemblyfilters:"+Clio;-Terrasoft.*" `
-title:"Clio Unit Tests" `
-reporttypes:"Html;SonarQube;MarkdownSummaryGithub;Badges";
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_URL: ${{ secrets.SONAR_URL }}
shell: powershell
run: |
C:\Tools\dotnet-coverage.exe collect "dotnet test .\clio.tests\clio.tests.csproj" -f xml -o "coverage.xml";
dotnet sonarscanner begin /k:"clio" `
/d:sonar.host.url="${{ secrets.SONAR_URL }}" `
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" `
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml;
dotnet build .\clio\clio.csproj -c Release --no-incremental;
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}";
dotnet build-server shutdown;