forked from syncromatics/JUnitTestLogger
-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (113 loc) · 5.55 KB
/
BuildAndTest.yml
File metadata and controls
135 lines (113 loc) · 5.55 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Build and Test
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
pull_request:
branches: [master]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
# Configuration type to build
BUILD_CONFIGURATION: Debug
jobs:
test:
#needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
env:
COMMAND_DIR: 'ls -la'
COMMAND_COPY: 'cp'
COMMAND_MOVE: 'mv -f'
- os: macos-latest
runNetExe: mono
env:
COMMAND_DIR: 'ls -la'
COMMAND_COPY: 'cp'
COMMAND_MOVE: 'mv -f'
- os: windows-latest
env:
COMMAND_DIR: 'dir'
COMMAND_COPY: 'copy /y'
COMMAND_MOVE: 'move-item -force'
steps:
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJSON(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Dir Listing
run: "${{matrix.env.COMMAND_DIR}}"
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration=${{env.BUILD_CONFIGURATION}} --no-restore
- name: Run NUnit3 tests
run: dotnet test NUnit3Test -v n --framework net8.0 --results-directory test-results --logger junit --configuration=${{env.BUILD_CONFIGURATION}} --no-restore
continue-on-error: true
- name: Collect NUnit3 test results
run: '${{matrix.env.COMMAND_MOVE}} "test-results/TestResults.xml" "FinalUnitTestOutputVerifyTests/previous-test-results/testresults.nunit3.xml"'
- name: Run xUnit tests
run: dotnet test xUnitTest -v n --framework net8.0 --results-directory test-results --logger junit --configuration=${{env.BUILD_CONFIGURATION}} --no-restore
continue-on-error: true
- name: Collect xUnit test results
run: '${{matrix.env.COMMAND_MOVE}} "test-results/TestResults.xml" "FinalUnitTestOutputVerifyTests/previous-test-results/testresults.xunit.xml"'
- name: Run final unit tests on output of previous unit tests
run: 'dotnet test FinalUnitTestOutputVerifyTests -v n --framework net8.0 --results-directory test-results --logger junit --configuration=${{env.BUILD_CONFIGURATION}} --no-restore'
- name: 'Dir Listing test-results'
if: always()
run: '${{matrix.env.COMMAND_DIR}} test-results'
#Following lines maybe required again after test&dev?!
# # the action is useless on pull_request events
# # (it can not create check runs or pull request comments)
# if: always() #&& startsWith(matrix.os, 'ubuntu') #&& github.event_name != 'pull_request'
- name: Unit Test Results (Linux)
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: always() && startsWith(matrix.os, 'ubuntu')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "test-results/TestResults.xml"
check_run_annotations: all tests
comment_title: Unit Test Statistics (${{matrix.os}})
check_name: Unit Test Results (${{matrix.os}})
report_individual_runs: true
- name: Unit Test Results (Mac)
uses: EnricoMi/publish-unit-test-result-action/macos@v2
if: always() && startsWith(matrix.os, 'macos')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "test-results/TestResults.xml"
check_run_annotations: all tests
comment_title: Unit Test Statistics (${{matrix.os}})
check_name: Unit Test Results (${{matrix.os}})
report_individual_runs: true
- name: Unit Test Results (Win)
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always() && startsWith(matrix.os, 'windows')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "test-results/TestResults.xml"
check_run_annotations: all tests
comment_title: Unit Test Statistics (${{matrix.os}})
check_name: Unit Test Results (${{matrix.os}})
report_individual_runs: true
- name: Publish Unit Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: NUnit Test Results ${{ matrix.os }}
path: |
test-results/TestResults.xml
FinalUnitTestOutputVerifyTests/previous-test-results/testresults.nunit3.xml
FinalUnitTestOutputVerifyTests/previous-test-results/testresults.xunit.xml