-
Notifications
You must be signed in to change notification settings - Fork 31
454 lines (390 loc) · 14.7 KB
/
Copy pathubuntu.yml
File metadata and controls
454 lines (390 loc) · 14.7 KB
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
name: Ubuntu CI (push and/or release)
on:
push:
branches:
- develop
- feature/*
- features/*
- fix/*
- issue-*
- release/*
- doc/*
- dependabot/**
- tests/*
- copilot/*
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_DEVELOP_TESTS: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/develop') || inputs.run-tests == 'true' }}
RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }}
REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}}
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
triplet: x64-linux
PYTHON_VERSION: "3.12"
jobs:
build:
name: Build
env:
ORTOOLS_DIR: ${{ github.workspace }}/or-tools
os: ubuntu-22.04
# Caching strategy of VCPKG dependencies
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite"
runs-on: ubuntu-22.04
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
include:
- testNRTarget: versionTestNR
isUploadTarget: true
- testNRTarget: latestTestNR
isUploadTarget: false
steps:
- uses: actions/checkout@v7
with:
ref: ${{ env.REF }}
- name: Install VCPKG
run: git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Restore vcpkg binary dir from cache
id: cache-vcpkg-binary
uses: actions/cache/restore@v6
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-cache-ubuntu-${{ hashFiles('vcpkg.json', '.git/modules/vcpkg/HEAD') }}
# Allows to restore a cache when deps have only partially changed (like adding a dependency)
restore-keys: vcpkg-cache-ubuntu-
- name: Install ccache
run: sudo apt-get install -y ccache
- name: Restore ccache cache
id: cache
uses: actions/cache/restore@v6
with:
path: ${{ github.workspace }}/.ccache_ubuntu
key: ${{ env.os }}-${{ github.ref_name }}
restore-keys: |
${{ env.os }}-
- name: Configure ccache
run: |
ccache --set-config=cache_dir=${{ github.workspace }}/.ccache_ubuntu
ccache --set-config=max_size=500M
ccache --set-config=compression=true
ccache -p
ccache -z
- name: Install libraries
run: |
sudo apt-get update
sudo apt-get install uuid-dev
sudo apt-get install xsltproc
- name: Config OR-Tools URL
run: |
echo "ORTOOLS_URL=https://github.com/rte-france/or-tools-rte/releases/download/$(cat ortools_tag)/ortools_cxx_ubuntu-22.04_static_sirius.zip" >> $GITHUB_ENV
- name: Download pre-compiled librairies
uses: ./.github/workflows/download-extract-precompiled-libraries-tgz
with:
os: ${{env.os}}
ortools-url: ${{env.ORTOOLS_URL}}
ortools-dir: ${{env.ORTOOLS_DIR}}
- name: Set up Python
id: setup-python
uses: actions/setup-python@v6
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip3 install -r src/tests/examples/requirements.txt
- name: Configure
run: |
cmake -B _build -S . \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-linux-release \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DBUILD_TOOLS=ON \
-DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install \
-DPython3_EXECUTABLE="${{ env.Python3_ROOT_DIR }}/bin/python"
- name: Build
run: |
cmake --build _build -j$(nproc)
- name: Creation of complete .tar.gz archive
if: ${{ success() && matrix.isUploadTarget }}
run: |
cd _build
cpack -G TGZ -D CPACK_INSTALLED_DIRECTORIES="${{ env.ORTOOLS_DIR }}/install/lib;bin"
- name: Creation of solver only .tar.gz archive
if: ${{ success() && matrix.isUploadTarget }}
run: |
cd _build
cmake --install . --prefix install
pushd .
cd install/bin
cp ${{ env.ORTOOLS_DIR }}/install/lib/*.so* .
tar czf ../../antares-solver_ubuntu22.04.tar.gz antares-solver libsirius_solver.so *.so*
popd
rm -rf install
- name: Both previous archives upload
if: ${{ success() && matrix.isUploadTarget }}
uses: actions/upload-artifact@v7
with:
name: ubuntu-targz
path: _build/*.tar.gz
- name: Run API tests
run: |
cmake --install _build --prefix antares_install
cd src/api_client_example
cmake -B _build -S . \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-linux-release \
-DCMAKE_PREFIX_PATH="${{github.workspace}}/_build/vcpkg_installed/x64-linux-release;${{github.workspace}}/install;${{ env.ORTOOLS_DIR }}/install;${{github.workspace}}/antares_install"
cmake --build _build -j$(nproc)
cd _build
ctest -C Release --output-on-failure
- name: Read simtest version
run: |
echo 'SIMTEST_JSON<<EOF' >> $GITHUB_ENV
cat ./simtest.json >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Export simtest version
run: |
echo "SIMTEST=${{ fromJson(env.SIMTEST_JSON).version }}" >> $GITHUB_ENV
- name: Init submodule Antares_Simulator_Tests_NR (committed submodule)
if: ${{ matrix.testNRTarget == 'versionTestNR' }}
run: |
git submodule update --init --depth 1 --recursive resources/Antares_Simulator_Tests_NR
- name: Init submodule Antares_Simulator_Tests_NR (latest)
if: ${{ matrix.testNRTarget == 'latestTestNR' }}
run: |
git submodule update --init --remote --recursive resources/Antares_Simulator_Tests_NR
- name: Run named mps tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-named-mps
os: ${{ env.os }}
variant: "named-mps"
- name: Run short cucumber
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/cucumber-tests
with:
tags: "@short"
- name: Run medium cucumber
if: ${{ env.RUN_DEVELOP_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/cucumber-tests
with:
tags: "@medium"
- name: Run unit and end-to-end tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
run: |
cd _build
ctest -C Release --output-on-failure -L "unit|end-to-end"
- name: Merge XML reports into single HTML
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
run: |
cd _build/tests
${{github.workspace}}/src/tests/merge_all.sh ${{github.workspace}}/src/tests/format_xml_report.xsl
- name: Rename report
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
run: |
mkdir testing-report
mv ${{ github.workspace }}/_build/tests/report.html testing-report/$PAGE
env:
PAGE: ${{ github.sha }}.html
- name: Upload logs for failed tests
if: ${{ failure() }}
uses: actions/upload-artifact@v7
with:
name: test-log-${{ matrix.testNRTarget }}
path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log
- name: Run tests about infinity on BCs RHS
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-v830
os: ${{ env.os }}
- name: Run MILP with CBC
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-milp
variant: "milp-cbc"
os: ${{ env.os }}
- name: Run tests on adequacy patch (CSR)
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: adequacy-patch-CSR
os: ${{ env.os }}
- name: Run tests introduced in 8.6.0
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-v860
os: ${{ env.os }}
- name: Run tests introduced in 8.7.0
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-v870
os: ${{ env.os }}
- name: Run tests introduced in 9.1.0
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-v910
os: ${{ env.os }}
- name: Run tests introduced in 9.2.0
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-v920
os: ${{ env.os }}
- name: Run tests introduced in 9.3.0
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-v930
os: ${{ env.os }}
- name: Run short-tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: short-tests
os: ${{ env.os }}
- name: Run mps tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-mps
os: ${{ env.os }}
- name: Run unfeasibility-related tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
run: |
cd _build
ctest -C Release --output-on-failure -R "^unfeasible$"
- name: Run parallel tests
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-parallel
os: ${{ env.os }}
variant: "parallel"
- name: Run medium-tests
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: medium-tests
os: ${{ env.os }}
- name: Run long cucumber
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/cucumber-tests
with:
tags: "@long"
- name: Run long-tests-1
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: long-tests-1
os: ${{ env.os }}
- name: Run long-tests-2
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: long-tests-2
os: ${{ env.os }}
- name: Run long-tests-3
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: long-tests-3
os: ${{ env.os }}
- name: Barrier
if: ${{ !success() }}
run: exit 1
- name: Installer .deb creation
if: ${{ matrix.isUploadTarget }}
run: |
cd _build
cpack -G DEB -D CPACK_INSTALLED_DIRECTORIES="${{ env.ORTOOLS_DIR }}/install/lib;bin"
- name: Installer deb upload push
if: ${{ matrix.isUploadTarget }}
uses: actions/upload-artifact@v7
with:
name: deb
path: _build/*.deb
- name: Publish assets
if: ${{ env.IS_RELEASE == 'true' && matrix.isUploadTarget }}
env:
GITHUB_TOKEN: ${{ github.token }}
tag: ${{ github.event.inputs.release_tag }}
run: |
gh release upload "$tag" _build/*.tar.gz _build/*.deb
- name: Update continuous-delivery release
if: ${{ github.ref == 'refs/heads/develop' && matrix.isUploadTarget && env.IS_RELEASE != 'true' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
mv _build/antares-*-Ubuntu-22.04.tar.gz _build/antares-cd-Ubuntu-22.04.tar.gz
mv _build/antares-*-Ubuntu-22.04.deb _build/antares-cd-Ubuntu-22.04.deb
gh release upload --clobber continuous-delivery _build/*.tar.gz _build/*.deb
gh release edit continuous-delivery --title "continuous delivery (generated $(date +'%Y-%m-%d %H:%M'))"
#update continuous delivery tag to point to the latest develop commit
gh api repos/${{ github.repository }}/git/refs/tags/continuous-delivery -X PATCH -f sha=$(git rev-parse HEAD)
- name: Cache vcpkg binary dir
if: always()
id: save-cache-vcpkg-binary
uses: actions/cache/save@v6
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-cache-ubuntu-${{ hashFiles('vcpkg.json', '.git/modules/vcpkg/HEAD') }}
- name: Display ccache statistics
run: ccache -s
# Delete the old cache on hit to emulate a cache update. See
# https://github.com/actions/cache/issues/342.
- name: Delete old cache
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api gh cache delete
if: ${{ !cancelled() && steps.cache.outputs.cache-hit }}
# Using `--repo` makes it so that this step doesn't require checking out the
# repo first.
run: gh cache delete --repo ${{ github.repository }} ${{ steps.cache.outputs.cache-primary-key }}
- name: Save ccache cache
if: ${{ !cancelled() }}
uses: actions/cache/save@v6
with:
path: ${{ github.workspace }}/.ccache_ubuntu
key: ${{ steps.cache.outputs.cache-primary-key }}