-
Notifications
You must be signed in to change notification settings - Fork 14
228 lines (179 loc) · 7.05 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: Build
on: [push, pull_request]
env:
BUILD_CONFIGURATION: Release
BUILD_NET_TEST_TARGET: net8.0
BUILD_NETFWK_TEST_TARGET: net48
DOTNET_NOLOGO: 1
jobs:
unix:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- name: Linux x64
runner: ubuntu-latest
platform: x64
extension: so
- name: macOS arm64
runner: macos-14
platform: arm64
extension: dylib
- name: macOS x64
runner: macos-12
platform: x64
extension: dylib
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
8.0.x
- name: CMake
run: |
mkdir src/cmake
cd src/cmake
cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_CONFIGURATION }}
- name: Build Native
run: |
cd src/cmake
make
- name: Copy Native Lib
run: |
mkdir lib
cp src/cmake/PCRE.NET.Native.${{ matrix.extension }} lib/PCRE.NET.Native.${{ matrix.platform }}.${{ matrix.extension }}
- name: Test .NET
run: dotnet test src/PCRE.NET.Tests/PCRE.NET.Tests.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --framework ${{ env.BUILD_NET_TEST_TARGET }} -p:PcreNetTestBuild=true -p:ExpectPlatform=${{ matrix.platform }}
- name: Test .NET Standard
run: dotnet test src/PCRE.NET.Tests/PCRE.NET.Tests.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --framework ${{ env.BUILD_NET_TEST_TARGET }} -p:PcreNetTestBuild=true -p:ExpectPlatform=${{ matrix.platform }} -p:ForceNetStandard=true
- name: Test Allocations
run: dotnet run --project src/PCRE.NET.Benchmarks/PCRE.NET.Benchmarks.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --framework ${{ env.BUILD_NET_TEST_TARGET }} -- --allocations
- name: Upload Native Lib
uses: actions/upload-artifact@v4
with:
name: lib-${{ matrix.platform }}.${{ matrix.extension }}
path: lib/PCRE.NET.Native.${{ matrix.platform }}.${{ matrix.extension }}
if-no-files-found: error
windows:
name: Windows ${{ matrix.platform }}
runs-on: windows-2022
strategy:
matrix:
include:
- platform: x86
msbuild-platform: Win32
- platform: x64
msbuild-platform: x64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
8.0.x
- name: Setup VS Dev Tools
uses: ilammy/msvc-dev-cmd@v1
- name: Setup Environment
run: |
echo 'BUILD_COMMON_MSBUILD_ARGS=/v:m /m /p:Configuration=${{ env.BUILD_CONFIGURATION }}' >> $GITHUB_ENV
echo 'Platform=' >> $GITHUB_ENV
shell: bash
- name: NuGet Restore
run: dotnet restore src/PCRE.NET.sln
- name: Build Native
run: msbuild src/PCRE.NET.Native/PCRE.NET.Native.vcxproj ${{ env.BUILD_COMMON_MSBUILD_ARGS }} /p:Platform=${{ matrix.msbuild-platform }}
- name: Build Tests
run: msbuild src/PCRE.NET.Tests/PCRE.NET.Tests.csproj ${{ env.BUILD_COMMON_MSBUILD_ARGS }} /p:Platform=${{ matrix.platform }} /p:PcreNetTestBuild=true /p:ExpectPlatform=${{ matrix.platform }}
- name: Test .NET Framework
run: vstest.console src/PCRE.NET.Tests/bin/${{ matrix.platform }}/${{ env.BUILD_CONFIGURATION }}/${{ env.BUILD_NETFWK_TEST_TARGET }}/PCRE.NET.Tests.dll /Platform:${{ matrix.platform }}
- name: Test .NET
run: dotnet test src/PCRE.NET.Tests/PCRE.NET.Tests.csproj --configuration ${{ env.BUILD_CONFIGURATION }} -p:PcreNetTestBuild=true -p:ExpectPlatform=${{ matrix.platform }}
if: ${{ matrix.platform == 'x64' }}
- name: Test .NET Standard
run: dotnet test src/PCRE.NET.Tests/PCRE.NET.Tests.csproj --configuration ${{ env.BUILD_CONFIGURATION }} -p:PcreNetTestBuild=true -p:ExpectPlatform=${{ matrix.platform }} -p:ForceNetStandard=true
if: ${{ matrix.platform == 'x64' }}
- name: Test Allocations .NET
run: dotnet run --project src/PCRE.NET.Benchmarks/PCRE.NET.Benchmarks.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --framework ${{ env.BUILD_NET_TEST_TARGET }} -- --allocations
if: ${{ matrix.platform == 'x64' }}
- name: Test Allocations .NET Framework
run: dotnet run --project src/PCRE.NET.Benchmarks/PCRE.NET.Benchmarks.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --framework ${{ env.BUILD_NETFWK_TEST_TARGET }} -- --allocations
if: ${{ matrix.platform == 'x64' }}
- name: Upload Native Lib
uses: actions/upload-artifact@v4
with:
name: lib-${{ matrix.platform }}.dll
path: lib/PCRE.NET.Native.${{ matrix.platform }}.dll
if-no-files-found: error
pack:
name: Pack
runs-on: ubuntu-latest
needs:
- unix
- windows
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
8.0.x
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: lib
merge-multiple: true
- name: Delete Native Lib Artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: lib-*
failOnError: false
- name: NuGet Restore
run: dotnet restore src/PCRE.NET/PCRE.NET.csproj
- name: Build PCRE.NET
run: dotnet build --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore src/PCRE.NET/PCRE.NET.csproj -p:PcreNetPackage=true
- name: NuGet Pack
run: dotnet pack --configuration ${{ env.BUILD_CONFIGURATION }} --no-build src/PCRE.NET/PCRE.NET.csproj -p:PcreNetPackage=true
- name: Upload NuGet
uses: actions/upload-artifact@v4
with:
name: NuGet
path: src/PCRE.NET/bin/${{ env.BUILD_CONFIGURATION }}/*.nupkg
if-no-files-found: error
integration-tests:
name: Integration Test ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
needs:
- pack
strategy:
matrix:
include:
- name: Linux x64
runner: ubuntu-latest
- name: macOS arm64
runner: macos-14
- name: macOS x64
runner: macos-12
- name: Windows x64
runner: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Download NuGet
uses: actions/download-artifact@v4
with:
name: NuGet
path: src/PCRE.NET.Tests.Integration/nuget
- name: Integration Test
run: dotnet test src/PCRE.NET.Tests.Integration/PCRE.NET.Tests.Integration.csproj -p:PcreNetIntegrationTest=true