-
Notifications
You must be signed in to change notification settings - Fork 76
104 lines (90 loc) · 2.75 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
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
name: Run tests
on:
push:
branches: ['develop', 'release']
pull_request:
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
build:
uses: ./.github/workflows/build.yml
with:
msbuild_args: /p:ContinuousIntegrationBuild=true
test:
runs-on: windows-2022
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Set configuration env
shell: pwsh
run: |
if ($env:GITHUB_REF -eq 'refs/heads/release') {
echo 'CONFIGURATION=Release' >> $env:GITHUB_ENV
} else {
echo 'CONFIGURATION=Debug' >> $env:GITHUB_ENV
}
- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: nuget-${{ hashFiles('*/*.csproj') }}
restore-keys: |
nuget-
- name: Restore build result
uses: actions/download-artifact@v4
with:
name: build
- name: Run tests
shell: pwsh
run: |
$altCoverVersion = '8.6.95'
$xunitVersion = '2.6.2'
$targetFramework = 'net48'
$altCoverPath = "$($env:NUGET_PACKAGES)\altcover\$($altCoverVersion)\tools\net472\AltCover.exe"
$xunitPath = "$($env:NUGET_PACKAGES)\xunit.runner.console\$($xunitVersion)\tools\net481\xunit.console.exe"
$p = Start-Process `
-FilePath $altCoverPath `
-ArgumentList (
'--inputDirectory',
".\OpenTween.Tests\bin\$($env:CONFIGURATION)\$($targetFramework)",
'--outputDirectory',
'.\__Instrumented\',
'--assemblyFilter',
'?^OpenTween(?!\.Tests)',
'--typeFilter',
'?^OpenTween\.',
'--fileFilter',
'\.Designer\.cs',
'--visibleBranches'
) `
-NoNewWindow `
-PassThru `
-Wait
if ($p.ExitCode -ne 0) {
exit $p.ExitCode
}
$p = Start-Process `
-FilePath $altCoverPath `
-ArgumentList (
'runner',
'--recorderDirectory',
'.\__Instrumented\',
'--executable',
$xunitPath,
'--',
'.\__Instrumented\OpenTween.Tests.dll'
) `
-NoNewWindow `
-PassThru `
-Wait
if ($p.ExitCode -ne 0) {
exit $p.ExitCode
}
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true