-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.57 KB
/
reusable_run_tests.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
# see
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
# https://rakesh-suryawanshi.medium.com/unit-testing-report-with-github-actions-7216f340044e
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net#building-and-testing-your-code
on:
workflow_call:
name: reusable test runner
jobs:
run_tests:
name: run tests
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [
{ tfm: net8.0, version: '8.0.x' },
]
env:
BUILD_CONFIG: Release
SOLUTION: MagicxorAnalyzer.CSharp.sln
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet.version }}
- name: Display dotnet version
run: |
echo "matrix dotnet version: ${{ matrix.dotnet.version }}"
dotnet --version
- name: Run tests
run: dotnet test $SOLUTION --configuration $BUILD_CONFIG --framework ${{ matrix.dotnet.tfm }} --logger trx --results-directory "TestResults-${{ matrix.dotnet.version }}" /p:CollectCoverage=true
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: dotnet-test-results-${{ matrix.dotnet.version }}
path: TestResults-${{ matrix.dotnet.version }}
- name: Publish test report
uses: dorny/test-reporter@v1
if: always()
with:
name: dotnet-test-results-${{ matrix.dotnet.version }}
path: "**/*.trx"
reporter: dotnet-trx
fail-on-error: true