forked from TanninOne/usvfs
-
Notifications
You must be signed in to change notification settings - Fork 26
143 lines (137 loc) · 4.66 KB
/
build.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
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
136
137
138
139
140
141
142
143
name: Build USVFS
on:
push:
branches: master
pull_request:
types: [opened, synchronize, reopened]
env:
BOOST_PREBUILT_URL: "https://github.com/ModOrganizer2/mob/releases/download/2.5-dependencies/boost_prebuilt_1_85_0.7z"
jobs:
build:
name: Build USVFS
strategy:
matrix:
arch: [x86, x64]
config: [Debug, Release]
tests: ["", "Test"]
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch Boost prebuilt
run: |
Invoke-WebRequest -Uri ${env:BOOST_PREBUILT_URL} -OutFile boost.7z
Expand-7ZipArchive -Path boost.7z -Destination .\boost
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: ${{ matrix.arch }}
- if: matrix.tests == 'Test'
name: Fetch googletest
uses: actions/checkout@v4
with:
repository: google/googletest
path: ./googletest
- if: matrix.tests == 'Test'
name: Build googletest
run: |
cmake -B googletest/build_${{ matrix.arch }} `
-A ${{ matrix.arch == 'x86' && 'Win32' || 'x64' }} `
-Dgtest_force_shared_crt=ON `
googletest
cmake --build googletest/build_${{ matrix.arch }} --config ${{ matrix.config }}
- name: Build
run: |
msbuild -nologo `
-maxCpuCount "-property:UseMultiToolTask=true" "-property:EnforceProcessCountAcrossBuilds=true" `
"-property:Configuration=${{ matrix.config }}${{ matrix.tests }}" `
"-property:Platform=${{ matrix.arch }}" `
"-property:BOOST_PATH=..\boost" `
"-property:GTEST_PATH=..\googletest" `
"-property:GTEST_LIBDIR=..\googletest\build_${{ matrix.arch }}\lib\${{ matrix.config }}" `
"-property:RunCodeAnalysis=false" `
.\vsbuild\usvfs.sln
- if: matrix.tests == 'Test'
uses: actions/upload-artifact@master
with:
name: usvfs-libs_${{ matrix.arch }}_${{ matrix.config }}
path: ./lib
- if: matrix.tests == 'Test'
uses: actions/upload-artifact@master
with:
name: usvfs-bins_${{ matrix.arch }}_${{ matrix.config }}
path: ./bin
- if: matrix.tests == 'Test'
uses: actions/upload-artifact@master
with:
name: usvfs-tests_${{ matrix.arch }}_${{ matrix.config }}
path: ./test/bin
# merge x86 / x64 artifacts
merge-artifacts:
runs-on: ubuntu-latest
name: Merge Artifacts for Tests
strategy:
matrix:
config: [Debug, Release]
needs: build
steps:
- name: Merge USVFS libs
uses: actions/upload-artifact/merge@v4
with:
name: usvfs-libs_${{ matrix.config }}
pattern: usvfs-libs_*_${{ matrix.config }}
- name: Merge USVFS bins
uses: actions/upload-artifact/merge@v4
with:
name: usvfs-bins_${{ matrix.config }}
pattern: usvfs-bins_*_${{ matrix.config }}
- name: Merge USVFS tests
uses: actions/upload-artifact/merge@v4
with:
name: usvfs-tests_${{ matrix.config }}
pattern: usvfs-tests_*_${{ matrix.config }}
test:
name: Test USVFS
needs: merge-artifacts
runs-on: windows-2022
strategy:
matrix:
arch: [x86, x64]
config: [Debug, Release]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@master
with:
name: usvfs-libs_${{ matrix.config }}
path: ./lib
- uses: actions/download-artifact@master
with:
name: usvfs-bins_${{ matrix.config }}
path: ./bin
- uses: actions/download-artifact@master
with:
name: usvfs-tests_${{ matrix.config }}
path: ./test/bin
- run: ./test/bin/shared_test_${{ matrix.arch }}.exe
if: always()
- run: ./test/bin/testinject_bin_${{ matrix.arch }}.exe
if: always()
- run: ./test/bin/thooklib_test_${{ matrix.arch }}.exe
if: always()
- run: ./test/bin/tinjectlib_test_${{ matrix.arch }}.exe
if: always()
- run: ./test/bin/tvfs_test_${{ matrix.arch }}.exe
if: always()
- run: ./test/bin/usvfs_test_runner_${{ matrix.arch }}.exe
if: always()
- run: ./test/bin/usvfs_global_test_runner_${{ matrix.arch }}.exe
if: always()
- uses: actions/upload-artifact@master
if: always()
with:
name: tests-outputs_${{ matrix.arch }}_${{ matrix.config }}
path: ./test/temp
if-no-files-found: ignore
retention-days: 7
overwrite: true