-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (95 loc) · 3.25 KB
/
dotnet.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "develop", "main" ]
pull_request:
branches: [ "develop", "main" ]
jobs:
build:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
tst: ${{ steps.filter.outputs.tst }}
steps:
- uses: actions/checkout@v4
# https://github.com/dorny/paths-filter
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'src/**'
tst:
- 'src/**'
- 'tests/**'
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Debug --no-restore
- name: Start containers
if: steps.filter.outputs.tst == 'true'
run: ./kafka-start.cmd
working-directory: ./tests
- name: Test
if: steps.filter.outputs.tst == 'true'
run: dotnet test -c Debug -f net8.0 --no-build --verbosity normal --settings .runsettings
- name: Stop containers
if: always()
run: ./kafka-stop.cmd
working-directory: ./tests
- name: Report
if: github.event_name == 'pull_request' && steps.filter.outputs.tst == 'true'
run: |
dotnet tool restore
dotnet reportgenerator -reports:./artifacts/cob/*/coverage.cobertura.xml -targetdir:artifacts -reporttypes:"Cobertura;HtmlSummary"
- name: Code Coverage Report
if: github.event_name == 'pull_request' && steps.filter.outputs.tst == 'true'
uses: irongut/[email protected]
with:
filename: ./artifacts/Cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '75 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && steps.filter.outputs.tst == 'true'
with:
recreate: true
path: code-coverage-results.md
publish:
runs-on: ubuntu-latest
needs: "build"
if: github.event_name != 'pull_request' && needs.build.outputs.src == 'true' # publish only if src folder changed and if not pull request
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
- name: Restore
run: dotnet restore
if: steps.changes.outputs.src == 'true'
- name: Pack Rc
run: dotnet pack -c Release -p:VersionPrefix=${{ github.run_number }}-rc --output ./artifacts/nuget
if: github.ref == 'refs/heads/develop'
- name: Pack
run: dotnet pack -c Release -p:VersionPrefix=${{ github.run_number }} --output ./artifacts/nuget
if: github.ref == 'refs/heads/main'
- name: Push
run: |
ls ./artifacts/nuget
dotnet nuget push ./artifacts/nuget/* -k ${{secrets.NUGET_TOKEN}} --skip-duplicate