-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (55 loc) · 2.02 KB
/
build-and-test.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
name: Build And Test
on: [push]
env:
BuildVersion: '8.0.${{github.run_number}}'
SolutionFile: 'src/EcsR3.sln'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: 9.0.x
- name: .Net Restore
run: dotnet restore ${{ env.SolutionFile }}
- name: .Net Build
run: dotnet build --configuration Release ${{ env.SolutionFile }}
- name: .Net Test
run: dotnet test --configuration Release --no-build ${{ env.SolutionFile }} --logger trx --collect:"XPlat Code Coverage"
- name: Test Report
uses: dorny/test-reporter@v1
with:
name: Unit Test Summary
path: "**/*.trx"
reporter: dotnet-trx
- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: '**/coverage.cobertura.xml'
badge: true
format: 'markdown'
output: 'both'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Add Coverage Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
package-and-release:
runs-on: windows-latest
if: startsWith(github.event.ref, 'refs/tags/')
needs: [build-and-test]
steps:
- uses: actions/checkout@v3
- name: .Net Restore
run: dotnet restore ${{ env.SolutionFile }}
- name: .Net Build
run: dotnet build --configuration Release /p:Version=${{ env.BuildVersion }} ${{ env.SolutionFile }}
- name: .Net Pack
run: dotnet pack --configuration Release /p:Version=${{ env.BuildVersion }} --no-build ${{ env.SolutionFile }}
- name: Publish To Nuget
run: dotnet nuget push "**/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json