forked from MeshInspector/MeshLib
-
Notifications
You must be signed in to change notification settings - Fork 0
259 lines (229 loc) · 9.8 KB
/
build-test-linux-vcpkg.yml
File metadata and controls
259 lines (229 loc) · 9.8 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
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
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 19, GCC 11]
full_config_build:
- ${{ fromJSON( inputs.full_config_build ) }}
exclude:
# Do not run Debug Clang 19 build on every commit (but only once a day)
- full_config_build: false
compiler: Clang 19
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 19
cxx-compiler: /usr/bin/clang++-19
c-compiler: /usr/bin/clang-19
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: [ self-hosted, linux-arm64, spot, meshinspector ]
- arch: arm64
compiler: GCC 11
skip_mrbind: true # GCC + ARM64 build has unresolved problems
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
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
- name: Get AWS instance type
run: |
TOKEN=$(curl -fsS --max-time 2 \
-X PUT "http://169.254.169.254/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 10" || true)
AWS_INSTANCE_TYPE=$(curl -fsS --max-time 2 \
-H "X-aws-ec2-metadata-token: $TOKEN" \
"http://169.254.169.254/latest/meta-data/instance-type" || true)
# if not an EC2 instance
if test -z "$AWS_INSTANCE_TYPE" ; then
AWS_INSTANCE_TYPE="self-hosted"
fi
echo "AWS_INSTANCE_TYPE=$AWS_INSTANCE_TYPE" >> $GITHUB_ENV
echo $AWS_INSTANCE_TYPE
- name: Checkout
uses: actions/checkout@v5
- name: Collect runner's system stats
if: ${{ inputs.internal_build }}
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}
git submodule update --init --recursive --depth 1 thirdparty/imgui thirdparty/mrbind-pybind11 thirdparty/mrbind
- name: Install MRBind
if: ${{ (inputs.mrbind || inputs.mrbind_c) && !matrix.skip_mrbind }}
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 && !matrix.skip_mrbind }}
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_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 && !matrix.skip_mrbind] }}
- name: Generate and build Python bindings
if: ${{ inputs.mrbind && !matrix.skip_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@v4
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: MR_LOCAL_RESOURCES=1 xvfb-run -a ./build/${{ matrix.config }}/bin/MeshViewer -hidden -noEventLoop -unloadPluginsAtEnd
- name: Unit Tests
run: ./build/${{ matrix.config }}/bin/MRTest ${{ matrix.skip_mrbind && '--no-python-tests' || '' }}
- name: C Unit Tests (old bindings)
run: ./build/${{ matrix.config }}/bin/MRTestC
- name: C Unit Tests
if: ${{ inputs.mrbind_c && !matrix.skip_mrbind }}
run: ./build/${{ matrix.config }}/bin/MRTestC2
- name: Python Sanity Tests
if: ${{ inputs.mrbind && !matrix.skip_mrbind }}
timeout-minutes: 8
working-directory: ./build/${{ matrix.config }}/bin
run: python3 ./../../../scripts/run_python_test_script.py -d '../test_python'
- name: Python Regression Tests
if: ${{ inputs.internal_build && inputs.mrbind && !matrix.skip_mrbind }}
uses: ./.github/actions/python-regression-tests
with:
build_config: ${{ matrix.config }}
mrbind: ${{ inputs.mrbind && !matrix.skip_mrbind }}
pytest_args: "--run-cuda=negative"
smoke: ${{ !inputs.full_config_build && matrix.config == 'Debug' }}
test_artifacts_path: linux-vcpkg-${{ matrix.arch }}/${{ matrix.config }}/${{ matrix.compiler }}
ubuntu20_arm_workaround: ${{ inputs.mrbind && matrix.arch == 'arm64' }}
upload_test_artifacts: ${{ inputs.upload_test_artifacts }}
- name: Create Package
if: ${{ matrix.config == 'Release' && matrix.compiler == 'Clang 19' }}
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 19' }}
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 19' }}
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 19'}}
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 19' }}
uses: actions/upload-artifact@v4
with:
name: Distributives_linux-vcpkg-${{ matrix.arch }}
path: meshlib_linux-vcpkg-${{ matrix.arch }}.tar.xz
retention-days: 1