-
Notifications
You must be signed in to change notification settings - Fork 24
328 lines (284 loc) · 10.9 KB
/
windows-vcpkg.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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
name: Windows CI (VCPKG and pre-compiled)
on:
push:
branches:
- develop
- feature/*
- features/*
- fix/*
- issue-*
- release/*
- doc/*
- dependabot/*
schedule:
- cron: '21 2 * * *'
workflow_call:
inputs:
run-tests:
required: true
type: string
target_branch:
required: true
type: string
env:
GITHUB_TOKEN: ${{ github.token }}
IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }}
RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }}
RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }}
REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}}
jobs:
build:
env:
# Indicates the location of the vcpkg as a Git submodule of the project repository.
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
ORTOOLS_DIR: ${{ github.workspace }}/or-tools
os: windows-latest
test-platform: windows-2022
vcpkgPackages: wxwidgets boost-test yaml-cpp antlr4
triplet: x64-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.REF }}
- name: Config OR-Tools URL
run: |
echo "ORTOOLS_URL=https://github.com/rte-france/or-tools-rte/releases/download/$(cat ortools_tag)/ortools_cxx_windows-latest_static_sirius.zip" >> $GITHUB_ENV
shell: bash
- name: Pre-requisites
shell: cmd
run: |
choco install wget unzip zip --no-progress
# Downloads ccache, and copies it to "cl.exe" in order to trick cmake into using it,
# see ccache wiki for background on using it with MSVC:
# https://github.com/ccache/ccache/wiki/MS-Visual-Studio
- name: Install ccache
shell: bash
run: |
wget https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3-windows-x86_64.zip -O ccache.zip
unzip ccache.zip
rm ccache.zip
mv ccache-4.8.3-windows-x86_64 ccache
cp ccache/ccache.exe ccache/cl.exe
echo "${GITHUB_WORKSPACE}/ccache" >> $GITHUB_PATH
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: windows
- name : Init VCPKG submodule
run: |
git submodule update --init vcpkg
# Restore both vcpkg and its artifacts from the GitHub cache service.
- name: Restore vcpkg and its artifacts.
uses: actions/cache@v4
with:
# The first path is the location of vcpkg (it contains the vcpkg executable and data files).
# The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages.
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
# The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service.
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ env.triplet }}
- name : Install deps with VCPKG
run: |
cd vcpkg
./bootstrap-vcpkg.sh
vcpkg install ${{env.vcpkgPackages}} --triplet ${{env.triplet}}
rm -rf buildtrees packages downloads
shell: bash
- name: Read antares-deps version
id: antares-deps-version
uses: notiz-dev/github-action-json-property@release
with:
path: 'antares-deps-version.json'
prop_path: 'antares_deps_version'
- name: Download pre-compiled librairies
uses: ./.github/workflows/download-extract-precompiled-libraries-zip
with:
antares-deps-version: ${{steps.antares-deps-version.outputs.prop}}
os: ${{env.os}}
ortools-url: ${{env.ORTOOLS_URL}}
ortools-dir: ${{env.ORTOOLS_DIR}}
- name: Setup Python 3.12
uses: actions/setup-python@v5
id: setup-python
with:
architecture: 'x64'
python-version: '3.12'
- name: Install pip dependencies if necessary
run: pip install -r src/tests/examples/requirements.txt
- name: Init submodule
run: |
git submodule update --init src/antares-deps
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests
- name: Enable git longpaths
run: git config --system core.longpaths true
- name: Configure
shell: bash
run: |
cmake -B _build -S src \
-DDEPS_INSTALL_DIR=rte-antares-deps-Release \
-DCMAKE_PREFIX_PATH="${{ env.ORTOOLS_DIR }}/install" \
-DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \
-DVCPKG_TARGET_TRIPLET=${{ env.triplet }} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DBUILD_TOOLS=ON \
-DBUILD_not_system=OFF \
-DPython3_EXECUTABLE="${{ env.Python3_ROOT_DIR }}/python.exe" \
-DCMAKE_VS_GLOBALS="CLToolExe=cl.exe;CLToolPath=${GITHUB_WORKSPACE}/ccache;TrackFileAccess=false;UseMultiToolTask=true;DebugInformationFormat=OldStyle"
- name: Build
shell: bash
run: |
cmake --build _build --config Release -j$(nproc)
# simtest
- name: Read simtest version
id: simtest-version
uses: notiz-dev/github-action-json-property@release
with:
path: 'simtest.json'
prop_path: 'version'
- name: Run named mps tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-named-mps
os: ${{ env.test-platform }}
variant: "named-mps"
- name: Run unfeasibility-related tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
run: |
cd _build
ctest -C Release --output-on-failure -R "^unfeasible$"
- name: Run unit and end-to-end tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
run: |
cd _build
ctest -C Release --output-on-failure -L "unit|end-to-end" -LE ortools
- name: Upload build on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: MPS-diff
path: ${{ github.workspace }}/src/tests/mps
- name: Run tests about infinity on BCs RHS
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-v830
os: ${{ env.test-platform }}
- name: Run MILP with CBC
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-milp
variant: "milp-cbc"
os: ${{ env.test-platform }}
- name: Run tests introduced in v860
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-v860
os: ${{ env.test-platform }}
- name: Run tests introduced in v870
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-v870
os: ${{ env.test-platform }}
- name: Run short-tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: short-tests
os: ${{ env.test-platform }}
- name: Run mps tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-mps
os: ${{ env.test-platform }}
- name: Run parallel tests
if: ${{ env.RUN_EXTENDED_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-parallel
os: ${{ env.test-platform }}
variant: "parallel"
- name: Run medium-tests
if: ${{ env.RUN_EXTENDED_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: medium-tests
os: ${{ env.test-platform }}
- name: Run long-tests-1
if: ${{ env.RUN_EXTENDED_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: long-tests-1
os: ${{ env.test-platform }}
- name: Run long-tests-2
if: ${{ env.RUN_EXTENDED_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: long-tests-2
os: ${{ env.test-platform }}
- name: Run long-tests-3
if: ${{ env.RUN_EXTENDED_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: long-tests-3
os: ${{ env.test-platform }}
- name: Solver archive creation
shell: bash
run: |
cd _build
zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll
- name: NSIS Installer creation
shell: bash
run: |
rm -rf src/tests/resources/Antares_Simulator_Tests
cd _build
cpack -GNSIS
export NSIS_NAME=$(ls *.exe)
echo "NSIS_NAME=$NSIS_NAME" >> $GITHUB_ENV
- name: Upload NSIS log on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: NSISError.log
path: _build/_CPack_Packages/win64/NSIS/NSISOutput.log
- name: .zip creation
run: |
cd _build
cpack -G ZIP
- name: Installer upload
uses: actions/upload-artifact@v4
with:
name: installer
path: _build/${{env.NSIS_NAME}}
- name: Publish assets
if: ${{ env.IS_RELEASE == 'true' }}
env:
GITHUB_TOKEN: ${{ github.token }}
tag: ${{ github.event.inputs.release_tag }}
run: |
gh release upload "$tag" _build/*.zip _build/*.exe
shell: bash