-
Notifications
You must be signed in to change notification settings - Fork 7
58 lines (54 loc) · 1.71 KB
/
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: test
permissions:
statuses: write
checks: write
contents: write
pull-requests: write
actions: write
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore PowerThreadPool/PowerThreadPool.csproj
- name: Build
run: dotnet build PowerThreadPool/PowerThreadPool.csproj --no-restore
tests-and-reports:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Run Tests and Generate TRX Report
run: dotnet test UnitTest/UnitTest.csproj --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage"
- name: Publish Unit Test Results
uses: dorny/test-reporter@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: 'Unit Test Results'
reporter: 'dotnet-trx'
path: '**/test-results.trx'
fail_on_error: false
- name: Install ReportGenerator tool
run: dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Create reports
run: reportgenerator "-reports:**/coverage.cobertura.xml" "-targetdir:coverage" -reporttypes:"HtmlInline_AzurePipelines;Cobertura"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: '**/coverage.cobertura.xml'