-
Notifications
You must be signed in to change notification settings - Fork 242
64 lines (57 loc) · 2.06 KB
/
Copy pathunit-test.yaml
File metadata and controls
64 lines (57 loc) · 2.06 KB
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
name: unit test
run-name: unit tests ${{ github.event_name == 'schedule' && 'nightly' || github.head_ref || github.ref_name }}
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
unit-test:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
- name: Run unit tests
run: dotnet test src/Stryker.vstest.slnf --configuration Debug --results-directory TestResults --logger trx
- name: Run Microsoft.Testing.Platform unit tests
# global.json in this project's directory opts it into the MTP dotnet test runner;
# working-directory ensures that global.json is discovered (resolved relative to cwd).
run: dotnet test --configuration Debug --report-trx --results-directory ${{ github.workspace }}/TestResults
working-directory: src/Stryker.TestRunner.MicrosoftTestPlatform.UnitTest
- name: Upload unit test results
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: unit-test-results-${{ matrix.os }}
path: TestResults/**/*.trx
if-no-files-found: error
# Fan-in job that depends on all matrix combinations
# This job can be used as a single required check in PR rules
unit-test-complete:
name: Unit Tests Complete
runs-on: ubuntu-latest
needs: unit-test
if: always()
steps:
- name: Check unit test results
run: |
if [ "${{ needs.unit-test.result }}" != "success" ]; then
echo "Unit tests failed or were cancelled"
exit 1
fi
echo "All unit tests passed successfully"