-
Notifications
You must be signed in to change notification settings - Fork 110
295 lines (263 loc) · 11 KB
/
build-test-linux-vcpkg.yml
File metadata and controls
295 lines (263 loc) · 11 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
name: Build and test Linux vcpkg
on:
workflow_call:
inputs:
app_version:
required: true
type: string
docker_image_tag:
required: true
type: string
full_config_build:
default: false
required: false
type: boolean
internal_build:
required: false
type: boolean
upload_artifacts:
required: true
type: boolean
upload_test_artifacts:
required: true
type: boolean
mrbind:
default: true
required: false
type: boolean
mrbind_c:
default: true
required: false
type: boolean
nuget_build_patch:
default: false
required: false
type: boolean
jobs:
linux-vcpkg-build-test:
timeout-minutes: 50
runs-on: ${{ matrix.os }}
container:
image: meshlib/meshlib-rockylinux8-vcpkg-${{ matrix.arch }}:${{ inputs.docker_image_tag }}
options: --user root
strategy:
fail-fast: false
matrix:
config: [Debug, Release]
arch: [x64, arm64]
compiler: [Clang 20, GCC 11]
full_config_build:
- ${{ fromJSON( inputs.full_config_build ) }}
exclude:
# Do not run Debug Clang 20 build on every commit (but only once a day)
- full_config_build: false
compiler: Clang 20
config: Debug
# Do not run Release GCC 11 build on every commit (but only once a day)
- full_config_build: false
compiler: GCC 11
config: Release
include:
- compiler: Clang 20
cxx-compiler: /usr/bin/clang++-20
c-compiler: /usr/bin/clang-20
cxx-standard: 23
- compiler: GCC 11
cxx-compiler: /opt/rh/gcc-toolset-11/root/usr/bin/g++
c-compiler: /opt/rh/gcc-toolset-11/root/usr/bin/gcc
cxx-standard: 20
- arch: x64
os: ubuntu-latest
- arch: arm64
os: ubuntu-24.04-arm
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
env:
# Disables AWS Instance Metadata Service (IMDS), that not in use.
# Workaround for aws cli s3 copy - it doesn't work anonymously without this. Specific for Ubuntu 20 and Fedora.
# https://github.com/aws/aws-cli/issues/5623#issuecomment-801240811
AWS_EC2_METADATA_DISABLED: true
steps:
- name: Enable GCC 11 toolset
run: |
source /opt/rh/gcc-toolset-11/enable
for VAR in PATH ; do
echo "${VAR}=${!VAR}" >> $GITHUB_ENV
echo "${VAR}=${!VAR}"
done
- name: Checkout
uses: actions/checkout@v6
- name: Get AWS instance type
uses: ./.github/actions/get-aws-instance-type
- name: Collect runner's system stats
if: ${{ inputs.internal_build }}
id: collect-runner-stats
continue-on-error: true
uses: ./.github/actions/collect-runner-stats
with:
target_os: linux-vcpkg
target_arch: ${{ matrix.arch }}
cxx_compiler: ${{ matrix.cxx-compiler }}
build_config: ${{ matrix.config }}
aws_instance_type: ${{ env.AWS_INSTANCE_TYPE }}
- name: Checkout third-party submodules
run: |
# have to checkout selective submodules by our own
# related issue: https://github.com/actions/checkout/issues/1779
export HOME=${RUNNER_TEMP}
git config --global --add safe.directory ${GITHUB_WORKSPACE}
# Retried via retry.sh: submodule endpoints occasionally 500.
bash scripts/retry.sh -- git submodule update --init --depth 1 \
thirdparty/imgui \
thirdparty/mrbind-pybind11 \
thirdparty/mrbind
# mrbind needs deps/cppdecl; recurse only there
bash scripts/retry.sh -- git -C thirdparty/mrbind submodule update --init --depth 1 deps/cppdecl
- name: Install MRBind
if: ${{ inputs.mrbind || inputs.mrbind_c }}
run: scripts/mrbind/install_mrbind_rockylinux.sh
- name: Create virtualenv
run: |
python3.12 -m venv .venv
. .venv/bin/activate
python3 -m ensurepip --upgrade
python3 -m pip install --upgrade pip
echo $PATH >> $GITHUB_PATH
- name: Setup python requirements
run: python3 -m pip install -r ./requirements/python.txt
- name: Generate C bindings
if: ${{ inputs.mrbind_c }}
env:
CXX: ${{ matrix.cxx-compiler }}
run: make -f scripts/mrbind/generate.mk -B --trace TARGET=c DEPS_BASE_DIR=/opt/vcpkg/installed/${{ matrix.arch }}-linux-meshlib CXX_FOR_BINDINGS=/usr/bin/clang++
- name: Build
run: ./scripts/build_source.sh
env:
MESHLIB_BUILD_RELEASE: ${{ fromJSON('["OFF", "ON"]')[matrix.config == 'Release'] }}
MESHLIB_BUILD_DEBUG: ${{ fromJSON('["OFF", "ON"]')[matrix.config == 'Debug'] }}
CMAKE_CXX_COMPILER: ${{ matrix.cxx-compiler }}
MR_VERSION: ${{ inputs.app_version }}
# options to be passed to cmake
MR_CMAKE_OPTIONS: >
-DMR_PLATFORM=Linux_vcpkg
-DMR_CXX_STANDARD=${{ matrix.cxx-standard }}
-DMR_PCH_USE_EXTRA_HEADERS=ON
-DCMAKE_CUDA_HOST_COMPILER=/opt/rh/gcc-toolset-11/root/usr/bin/g++
-DMESHLIB_BUILD_GENERATED_C_BINDINGS=${{ fromJSON('["OFF", "ON"]')[inputs.mrbind_c] }}
-DMRVIEWER_NO_GTK=ON
-DMRVIEWER_WITH_BUNDLED_CURL=ON
- name: MRMesh Exported Symbols
run: objdump -T ./build/${{ matrix.config }}/bin/libMRMesh.so | llvm-cxxfilt
- name: Generate and build Python bindings
if: ${{ inputs.mrbind }}
env:
CXX: ${{ matrix.cxx-compiler }}
run: make -f scripts/mrbind/generate.mk MODE=none -B --trace MESHLIB_SHLIB_DIR=build/${{matrix.config}}/bin CXX_FOR_BINDINGS=/usr/bin/clang++ DEPS_BASE_DIR=/opt/vcpkg/installed/${{ matrix.arch }}-linux-meshlib
- name: Collect Timings
run: ./scripts/devops/collect_timing_logs.sh linux-vcpkg-${{ matrix.arch }} ${{matrix.config}} "${{matrix.compiler}}"
#Save timing in artifact
- name: Upload Timings
uses: actions/upload-artifact@v7
with:
name: Timing_Logs_linux-vcpkg-${{ matrix.arch }}_${{matrix.config}}_${{matrix.compiler}}
path: time_log/
- name: Run Start-and-Exit Tests
timeout-minutes: 3
run: xvfb-run -a ./build/${{ matrix.config }}/bin/MeshViewer -hidden -noEventLoop -unloadPluginsAtEnd
- name: Verify meshlib.mrmeshpy import
if: ${{ inputs.mrbind }}
timeout-minutes: 3
uses: ./.github/actions/verify-meshlib-python-import
with:
build-bin-dir: ./build/${{ matrix.config }}/bin
- name: Unit Tests
env:
GTEST_OUTPUT: 'xml:unit_tests_report_gtest.xml'
timeout-minutes: 10
run: ./build/${{ matrix.config }}/bin/MRTest
- name: C Unit Tests
if: ${{ inputs.mrbind_c }}
timeout-minutes: 10
run: ./build/${{ matrix.config }}/bin/MRTestC2
- name: Python Sanity Tests
if: ${{ inputs.mrbind }}
timeout-minutes: 8
working-directory: ./build/${{ matrix.config }}/bin
run: python3 -u ./../../../scripts/run_python_test_script.py -d '../test_python' -a ' --junit-xml=../unit_tests_report_pytest.xml'
- name: Python Regression Tests
if: ${{ inputs.internal_build && inputs.mrbind }}
uses: ./.github/actions/python-regression-tests
with:
build_config: ${{ matrix.config }}
pytest_args: "--run-cuda=negative --junit-xml=../unit_tests_report_regression.xml"
smoke: ${{ !inputs.full_config_build && matrix.config == 'Debug' }}
test_artifacts_path: linux-vcpkg-${{ matrix.arch }}/${{ matrix.config }}/${{ matrix.compiler }}
upload_test_artifacts: ${{ inputs.upload_test_artifacts }}
- name: Generate Test Performance Report
continue-on-error: true
run: |
scripts/junit_to_csv.py unit_tests_report.csv unit_tests_report_*.xml
cat unit_tests_report.csv
- name: Create Package
if: ${{ matrix.config == 'Release' && matrix.compiler == 'Clang 20' }}
run: |
./scripts/distribution_vcpkg.sh ${{ inputs.app_version }}
mv meshlib_linux-vcpkg.tar.xz meshlib_linux-vcpkg-${{ matrix.arch }}.tar.xz
- name: Extract Package
if: ${{ matrix.config == 'Release' && matrix.compiler == 'Clang 20' }}
run: |
mkdir meshlib_install
tar -xf meshlib_linux-vcpkg-${{ matrix.arch }}.tar.xz -C meshlib_install
- name: Build C++ examples
if: ${{ matrix.config == 'Release' && matrix.compiler == 'Clang 20' }}
run: |
cmake \
-S examples/cpp-examples \
-B cpp-examples-build \
-D CMAKE_FIND_ROOT_PATH=$(pwd)/meshlib_install/ \
-D CMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
cmake \
--build cpp-examples-build \
--parallel $(nproc)
- name: Build C examples
if: ${{ matrix.config == 'Release' && matrix.compiler == 'Clang 20'}}
run: |
cmake \
-S examples/c-examples \
-B c-examples-build \
-D CMAKE_FIND_ROOT_PATH=$(pwd)/meshlib_install/ \
-D CMAKE_C_COMPILER=${{ matrix.c-compiler }}
cmake \
--build c-examples-build \
--parallel $(nproc)
- name: Upload vcpkg Distribution
if: ${{ inputs.upload_artifacts && matrix.config == 'Release' && matrix.compiler == 'Clang 20' }}
uses: actions/upload-artifact@v7
with:
name: Distributives_linux-vcpkg-${{ matrix.arch }}
path: meshlib_linux-vcpkg-${{ matrix.arch }}.tar.xz
retention-days: 1
- name: Collect artifact stats
if: ${{ inputs.internal_build && inputs.upload_artifacts }}
continue-on-error: true
uses: ./.github/actions/collect-artifact-stats
with:
artifact_path: ${{ github.workspace }}
artifact_glob: meshlib_linux-vcpkg-${{ matrix.arch }}.tar.xz
stats_file_suffix: -${{ steps.collect-runner-stats.outputs.job_id }}
- name: Create and fix fake Wheel for NuGet
if: ${{ inputs.nuget_build_patch && matrix.compiler == 'Clang 20' && matrix.config == 'Release' }}
shell: bash
run: |
python3 -m venv ./wheel_venv
source ./wheel_venv/bin/activate
python3 -m pip install auditwheel patchelf
python3 ./scripts/nuget_patch/patch_library_deps.py ./patched_content/ ./build/Release/bin/lib{MeshLibC2,MeshLibC2Cuda}.so
- name: Upload NuGet files to Artifacts
if: ${{ inputs.nuget_build_patch && matrix.compiler == 'Clang 20' && matrix.config == 'Release' }}
uses: actions/upload-artifact@v7
with:
name: DotNetPatchArchiveLinux-${{ matrix.arch }}
path: ./patched_content/*
retention-days: 1