-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.15 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
---
name: Test
on:
workflow_dispatch:
pull_request:
push:
branches: [ main ]
env:
BUILD_CONFIG: Debug # Release
PLATFORM: x64 # x85
TEST_PROJECT_DIR: ./Tests
PROJECT_FILE: Tests.vcxproj
TEST_EXEC_FILE: Tests.exe
TEST_RESULT_FILE_PATH: ${{ github.workspace }}/test-results.xml
jobs:
build-and-test:
name: Build & Run Tests
runs-on: windows-latest
steps:
- name: Check Out Code
uses: actions/checkout@v4
- name: Setup Microsoft Build Engine
uses: microsoft/setup-msbuild@v2
- name: Restore NuGet Packages
working-directory: ${{ env.TEST_PROJECT_DIR }}
run: |
nuget restore `
./packages.config `
-PackagesDirectory "${{ github.workspace }}/packages"
- name: Build Project
working-directory: ${{ env.TEST_PROJECT_DIR }}
run: |
msbuild `
"/p:Configuration=${{ env.BUILD_CONFIG }}" `
"/p:Platform=${{ env.PLATFORM }}" `
"/p:RestorePackagesPath=${{ github.workspace }}/packages" `
"${{ env.PROJECT_FILE }}"
- name: Run Google Tests
working-directory: ${{ env.TEST_PROJECT_DIR }}
env:
BINARY_PATH: ./bin/${{ env.PLATFORM }}/${{ env.BUILD_CONFIG }}/${{ env.TEST_EXEC_FILE }}
run: |
${{ env.BINARY_PATH }} `
"--gtest_output=xml:${{ env.TEST_RESULT_FILE_PATH }}"
- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: gtest-results
path: ${{ env.TEST_RESULT_FILE_PATH }}
publish-test-results:
name: Download & Publish Results
needs: build-and-test
runs-on: ubuntu-latest
if: always()
permissions:
checks: write
pull-requests: write
steps:
- name: Download Test Results
uses: actions/download-artifact@v4
with:
name: gtest-results
path: ./gtest-results
- name: Display Structure of Downloaded Files
run: ls -R ./gtest-results
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: ./gtest-results/test-results.xml
check_name: Test Results