-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 1.44 KB
/
build-sonar.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Lib - Build, Test and Report Sonar
on:
workflow_call:
secrets:
github-token:
description: 'The GitHub PAT token to perform checkout and publish.'
required: true
cache-version:
description: 'The Cache version.'
required: true
inputs:
sln-file:
description: 'The name of the project to build. Must match the directory name.'
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: nuget-${{ secrets.cache-version }}-${{ hashFiles('**/*.csproj') }}
restore-keys: |
nuget-${{ secrets.cache-version }}-
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.x
9.x
- name: ➕ Add nugets source
uses: unosquare/add-nuget-source@master
with:
access-token: ${{ secrets.github-token }}
- name: Install dotnet coverage
run: |
apt-get update && apt-get install libxml2
dotnet tool install --global dotnet-coverage
- name: Build and analyze
run: |
dotnet build -c Release ${{ inputs.sln-file }}
- name: Run tests
run: |
dotnet-coverage collect "dotnet test ${{ inputs.sln-file }}" -f xml -o "coverage.xml"