-
Notifications
You must be signed in to change notification settings - Fork 26
43 lines (41 loc) · 1.43 KB
/
windows-unit-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
name: Windows Build & Unit Tests
on: [push]
env:
testrunner: 'OleanderStemTestRunner'
outfile: 'stem-junit.xml'
jobs:
build:
name: unit-tests
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- run: git config --global core.autocrlf input
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
with:
vs-prerelease: true
- name: Build & run tests
run: |
cd ..
git clone https://github.com/catchorg/Catch2.git
cd ${{ github.workspace }}/tests
cmake ./
msbuild ${{ env.testrunner }}.sln
cd bin\Debug
./${{ env.testrunner }} --reporter JUnit::out=${{ env.outfile }}
cat ${{ env.outfile }}
$FileContent = Get-Content ${{ env.outfile }}
$errors = (Select-String -InputObject $FileContent -Pattern 'errors="([0-9]+)"' | % { $($_.matches.groups[1]) } )
$failures = (Select-String -InputObject $FileContent -Pattern 'failures="([0-9]+)"' | % { $($_.matches.groups[1]) } )
if ($errors.Value -gt 0)
{
Write-Host "Error count is: " + $errors.Value
exit 1
}
if ($failures.Value -gt 0)
{
Write-Host "Failure count is: " + $failures.Value
exit 1
}