Skip to content

Commit 714c6a0

Browse files
authored
Merge pull request #1211 from bratpiorka/rrudnick_compile_compat
Add compatibility testing for compilation based on examples
2 parents 25d9074 + 00aa593 commit 714c6a0

File tree

6 files changed

+203
-101
lines changed

6 files changed

+203
-101
lines changed

.github/workflows/reusable_compatibility.yml

+185-82
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
- name: Install apt packages
2424
run: |
2525
sudo apt-get update
26-
sudo apt-get install -y clang cmake libnuma-dev libtbb-dev
26+
sudo apt-get install -y clang cmake hwloc libnuma-dev libtbb-dev
2727
2828
- name: Checkout "tag" UMF version
29-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3030
with:
3131
fetch-depth: 0
3232
ref: refs/tags/${{inputs.tag}}
@@ -36,61 +36,66 @@ jobs:
3636
working-directory: ${{github.workspace}}/tag_version
3737
run: .github/scripts/install_hwloc.sh
3838

39-
- name: Configure "tag" UMF build
40-
working-directory: ${{github.workspace}}/tag_version
39+
- name: Checkout latest UMF version
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
with:
42+
fetch-depth: 0
43+
path: ${{github.workspace}}/latest_version
44+
45+
- name: Configure latest UMF build
46+
working-directory: ${{github.workspace}}/latest_version
4147
run: >
4248
cmake
43-
-B ${{github.workspace}}/tag_version/build
49+
-B ${{github.workspace}}/latest_version/build
50+
-DCMAKE_INSTALL_PREFIX=_install
4451
-DCMAKE_BUILD_TYPE=Debug
4552
-DUMF_BUILD_SHARED_LIBRARY=ON
4653
-DCMAKE_C_COMPILER=gcc
4754
-DCMAKE_CXX_COMPILER=g++
48-
-DUMF_BUILD_TESTS=ON
49-
-DUMF_BUILD_EXAMPLES=ON
55+
-DUMF_BUILD_TESTS=OFF
5056
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
5157
-DUMF_BUILD_CUDA_PROVIDER=ON
5258
-DUMF_FORMAT_CODE_STYLE=OFF
5359
-DUMF_DEVELOPER_MODE=ON
5460
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
55-
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
56-
-DUMF_TESTS_FAIL_ON_SKIP=ON
57-
58-
- name: Build "tag" UMF
59-
working-directory: ${{github.workspace}}/tag_version
60-
run: |
61-
cmake --build ${{github.workspace}}/tag_version/build -j $(nproc)
6261
63-
- name: Run "tag" UMF tests
64-
working-directory: ${{github.workspace}}/tag_version/build
62+
- name: Build latest UMF
63+
working-directory: ${{github.workspace}}/latest_version
6564
run: |
66-
LD_LIBRARY_PATH=${{github.workspace}}/tag_version/build/lib/ ctest --output-on-failure
67-
68-
- name: Checkout latest UMF version
69-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
70-
with:
71-
fetch-depth: 0
72-
path: ${{github.workspace}}/latest_version
65+
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
7366
74-
- name: Configure latest UMF build
67+
- name: Install latest UMF
7568
working-directory: ${{github.workspace}}/latest_version
69+
run: sudo cmake --install ${{github.workspace}}/latest_version/build --config Debug
70+
71+
- name: Configure "tag" UMF build
72+
working-directory: ${{github.workspace}}/tag_version
7673
run: >
7774
cmake
78-
-B ${{github.workspace}}/latest_version/build
75+
-B ${{github.workspace}}/tag_version/build
7976
-DCMAKE_BUILD_TYPE=Debug
8077
-DUMF_BUILD_SHARED_LIBRARY=ON
8178
-DCMAKE_C_COMPILER=gcc
8279
-DCMAKE_CXX_COMPILER=g++
83-
-DUMF_BUILD_TESTS=OFF
80+
-DUMF_BUILD_TESTS=ON
81+
-DUMF_BUILD_EXAMPLES=ON
8482
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
8583
-DUMF_BUILD_CUDA_PROVIDER=ON
8684
-DUMF_FORMAT_CODE_STYLE=OFF
8785
-DUMF_DEVELOPER_MODE=ON
8886
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
87+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
88+
-DUMF_TESTS_FAIL_ON_SKIP=ON
8989
90-
- name: Build latest UMF
91-
working-directory: ${{github.workspace}}/latest_version
90+
- name: Build "tag" UMF
91+
working-directory: ${{github.workspace}}/tag_version
9292
run: |
93-
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
93+
cmake --build ${{github.workspace}}/tag_version/build -j $(nproc)
94+
95+
- name: Run "tag" UMF tests
96+
working-directory: ${{github.workspace}}/tag_version/build
97+
run: |
98+
LD_LIBRARY_PATH=${{github.workspace}}/tag_version/build/lib/ ctest --output-on-failure
9499
95100
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
96101
working-directory: ${{github.workspace}}/tag_version/build
@@ -103,15 +108,37 @@ jobs:
103108
GTEST_FILTER="-*umfIpcTest.GetPoolByOpenedHandle*"
104109
ctest --verbose -E "umf-mempolicy"
105110
111+
# Browse all folders in the examples directory, build them using the
112+
# latest UMF version, and run them, excluding those in the exclude list.
113+
- name: Build and run "tag" examples using the latest UMF libraries
114+
working-directory: ${{github.workspace}}/tag_version
115+
run: |
116+
EXAMPLES_EXCLUDE_LIST="cmake|common|hmat|level_zero|cuda"
117+
rm -rf build
118+
rm -rf include
119+
mkdir _examples
120+
cd _examples
121+
EXAMPLES_LIST=$(find ${{github.workspace}}/tag_version/examples -maxdepth 1 -mindepth 1 -type d | grep -Ev $EXAMPLES_EXCLUDE_LIST | xargs -n 1 basename)
122+
for EXAMPLE_NAME in $EXAMPLES_LIST; do
123+
cd ${{github.workspace}}/tag_version
124+
mkdir -p _examples/$EXAMPLE_NAME;
125+
cd _examples/$EXAMPLE_NAME;
126+
echo "Building example: $EXAMPLE_NAME"
127+
CMAKE_PREFIX_PATH=${{github.workspace}}/latest_version/_install cmake ${{github.workspace}}/tag_version/examples/$EXAMPLE_NAME;
128+
make;
129+
find . -maxdepth 1 -type f -executable -exec echo "Running example: {}" \; -exec {} \;
130+
done
131+
106132
windows:
107133
name: Windows
108134
env:
109135
VCPKG_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows"
136+
VCPKG_BIN_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows/bin;${{github.workspace}}/vcpkg/packages/tbb_x64-windows/bin;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows/bin"
110137
runs-on: "windows-2022"
111138

112139
steps:
113140
- name: Checkout "tag" UMF version
114-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
141+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115142
with:
116143
fetch-depth: 0
117144
ref: refs/tags/${{inputs.tag}}
@@ -130,56 +157,61 @@ jobs:
130157
run: vcpkg install --triplet x64-windows
131158
shell: pwsh # Specifies PowerShell as the shell for running the script.
132159

133-
- name: Configure "tag" UMF build
134-
working-directory: ${{github.workspace}}/tag_version
160+
- name: Checkout latest UMF version
161+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
162+
with:
163+
fetch-depth: 0
164+
path: ${{github.workspace}}/latest_version
165+
166+
- name: Configure latest UMF build
167+
working-directory: ${{github.workspace}}/latest_version
135168
run: >
136169
cmake
137-
-B "${{github.workspace}}/tag_version/build"
170+
-B "${{github.workspace}}/latest_version/build"
138171
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
172+
-DCMAKE_INSTALL_PREFIX=_install
139173
-DCMAKE_C_COMPILER=cl
140174
-DCMAKE_CXX_COMPILER=cl
141175
-DUMF_BUILD_SHARED_LIBRARY=ON
142-
-DUMF_BUILD_TESTS=ON
143-
-DUMF_BUILD_EXAMPLES=ON
176+
-DUMF_BUILD_TESTS=OFF
144177
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
145178
-DUMF_BUILD_CUDA_PROVIDER=ON
146179
-DUMF_FORMAT_CODE_STYLE=OFF
147180
-DUMF_DEVELOPER_MODE=ON
148181
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
149-
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
150-
-DUMF_TESTS_FAIL_ON_SKIP=ON
151-
152-
- name: Build "tag" UMF
153-
run: cmake --build "${{github.workspace}}/tag_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
154-
155-
- name: Run "tag" UMF tests
156-
working-directory: "${{github.workspace}}/tag_version/build"
157-
run: ctest -C Debug --output-on-failure --test-dir test
158182
159-
- name: Checkout latest UMF version
160-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
161-
with:
162-
fetch-depth: 0
163-
path: ${{github.workspace}}/latest_version
183+
- name: Build latest UMF
184+
run: cmake --build "${{github.workspace}}/latest_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
164185

165-
- name: Configure latest UMF build
186+
- name: Install latest UMF
166187
working-directory: ${{github.workspace}}/latest_version
188+
run: cmake --install ${{github.workspace}}/latest_version/build --config Debug
189+
190+
- name: Configure "tag" UMF build
191+
working-directory: ${{github.workspace}}/tag_version
167192
run: >
168193
cmake
169-
-B "${{github.workspace}}/latest_version/build"
194+
-B "${{github.workspace}}/tag_version/build"
170195
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
171196
-DCMAKE_C_COMPILER=cl
172197
-DCMAKE_CXX_COMPILER=cl
173198
-DUMF_BUILD_SHARED_LIBRARY=ON
174-
-DUMF_BUILD_TESTS=OFF
199+
-DUMF_BUILD_TESTS=ON
200+
-DUMF_BUILD_EXAMPLES=ON
175201
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
176202
-DUMF_BUILD_CUDA_PROVIDER=ON
177203
-DUMF_FORMAT_CODE_STYLE=OFF
178204
-DUMF_DEVELOPER_MODE=ON
179205
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
206+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
207+
-DUMF_TESTS_FAIL_ON_SKIP=ON
180208
181-
- name: Build latest UMF
182-
run: cmake --build "${{github.workspace}}/latest_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
209+
- name: Build "tag" UMF
210+
run: cmake --build "${{github.workspace}}/tag_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
211+
212+
- name: Run "tag" UMF tests
213+
working-directory: "${{github.workspace}}/tag_version/build"
214+
run: ctest -C Debug --output-on-failure --test-dir test
183215

184216
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
185217
working-directory: ${{github.workspace}}/tag_version/build
@@ -191,6 +223,48 @@ jobs:
191223
cp ${{github.workspace}}/latest_version/build/bin/Debug/umf.dll ${{github.workspace}}/tag_version/build/bin/Debug/umf.dll
192224
ctest -C Debug --verbose
193225
226+
# Browse all folders in the examples directory, build them using the
227+
# latest UMF version, and run them, excluding those in the exclude list.
228+
- name: Build and run "tag" examples using the latest UMF libraries
229+
working-directory: ${{github.workspace}}/tag_version
230+
run: |
231+
$ErrorActionPreference = "Stop"
232+
$EXAMPLES_EXCLUDE_LIST = "cmake|common|hmat|level_zero|cuda|custom|ipc|numa"
233+
Set-Location "${{github.workspace}}/tag_version"
234+
Remove-Item -Recurse -ErrorAction Ignore -Force build, include
235+
New-Item -ItemType Directory -Path _examples
236+
Set-Location -Path _examples
237+
$EXAMPLES_LIST = Get-ChildItem -Path "${{github.workspace}}/tag_version/examples" -Directory | Where-Object { $_.Name -notmatch $EXAMPLES_EXCLUDE_LIST } | ForEach-Object { $_.Name }
238+
# NOTE: we add our paths at the beginning of the PATH variable because
239+
# there is a limit on the size of the PATH variable in Windows
240+
$env:Path = "${{github.workspace}}/latest_version/_install/bin;${{env.VCPKG_BIN_PATH}};$env:Path"
241+
foreach ($EXAMPLE_NAME in $EXAMPLES_LIST) {
242+
Set-Location -Path "${{github.workspace}}/tag_version"
243+
New-Item -ItemType Directory -Path "_examples/$EXAMPLE_NAME"
244+
Set-Location -Path "_examples/$EXAMPLE_NAME"
245+
Write-Output "`nBuilding example: $EXAMPLE_NAME"
246+
cmake -DCMAKE_PREFIX_PATH="${{github.workspace}}/latest_version/_install;${{env.VCPKG_PATH}}" "${{github.workspace}}/tag_version/examples/$EXAMPLE_NAME"
247+
cmake --build .
248+
Set-Location -Path Debug
249+
Write-Output "`nRunning example: $EXAMPLE_NAME"
250+
$exeFiles = Get-ChildItem -Filter *.exe
251+
if ($exeFiles.Count -eq 0) {
252+
Write-Error "No executable files found in the current directory."
253+
exit 1
254+
}
255+
foreach ($exeFile in $exeFiles) {
256+
Write-Output "Running: $($exeFile.FullName)"
257+
& $exeFile.FullName
258+
if ($LASTEXITCODE -ne 0) {
259+
$unsignedExitCode = [Convert]::ToInt32($LASTEXITCODE)
260+
# Format the error code as a hexadecimal string
261+
$hexErrorCode = [Convert]::ToString($unsignedExitCode, 16).ToUpper()
262+
Write-Output "error 0x$hexErrorCode"
263+
exit $LASTEXITCODE
264+
}
265+
}
266+
}
267+
194268
gpu:
195269
name: GPU Ubuntu
196270
# run only on upstream; forks will not have the HW
@@ -201,8 +275,40 @@ jobs:
201275
runs-on: ["DSS-${{matrix.provider}}", "DSS-UBUNTU"]
202276

203277
steps:
278+
- name: Checkout latest UMF version
279+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
280+
with:
281+
fetch-depth: 0
282+
path: ${{github.workspace}}/latest_version
283+
284+
- name: Configure latest UMF build
285+
working-directory: ${{github.workspace}}/latest_version
286+
run: >
287+
cmake
288+
-B ${{github.workspace}}/latest_version/build
289+
-DCMAKE_INSTALL_PREFIX=_install
290+
-DCMAKE_BUILD_TYPE=Debug
291+
-DUMF_BUILD_SHARED_LIBRARY=ON
292+
-DCMAKE_C_COMPILER=gcc
293+
-DCMAKE_CXX_COMPILER=g++
294+
-DUMF_BUILD_TESTS=OFF
295+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
296+
-DUMF_BUILD_CUDA_PROVIDER=ON
297+
-DUMF_FORMAT_CODE_STYLE=OFF
298+
-DUMF_DEVELOPER_MODE=ON
299+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
300+
301+
- name: Build latest UMF
302+
working-directory: ${{github.workspace}}/latest_version
303+
run: |
304+
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
305+
306+
- name: Install latest UMF
307+
working-directory: ${{github.workspace}}/latest_version
308+
run: cmake --install ${{github.workspace}}/latest_version/build --config Debug
309+
204310
- name: Checkout "tag" UMF version
205-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
311+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
206312
with:
207313
fetch-depth: 0
208314
ref: refs/tags/${{inputs.tag}}
@@ -242,33 +348,6 @@ jobs:
242348
GTEST_FILTER="-*umfIpcTest.GetPoolByOpenedHandle*"
243349
ctest --output-on-failure
244350
245-
- name: Checkout latest UMF version
246-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
247-
with:
248-
fetch-depth: 0
249-
path: ${{github.workspace}}/latest_version
250-
251-
- name: Configure latest UMF build
252-
working-directory: ${{github.workspace}}/latest_version
253-
run: >
254-
cmake
255-
-B ${{github.workspace}}/latest_version/build
256-
-DCMAKE_BUILD_TYPE=Debug
257-
-DUMF_BUILD_SHARED_LIBRARY=ON
258-
-DCMAKE_C_COMPILER=gcc
259-
-DCMAKE_CXX_COMPILER=g++
260-
-DUMF_BUILD_TESTS=OFF
261-
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
262-
-DUMF_BUILD_CUDA_PROVIDER=ON
263-
-DUMF_FORMAT_CODE_STYLE=OFF
264-
-DUMF_DEVELOPER_MODE=ON
265-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
266-
267-
- name: Build latest UMF
268-
working-directory: ${{github.workspace}}/latest_version
269-
run: |
270-
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
271-
272351
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
273352
working-directory: ${{github.workspace}}/tag_version/build
274353
# Disable incompatible tests:
@@ -280,3 +359,27 @@ jobs:
280359
LD_LIBRARY_PATH=${{github.workspace}}/latest_version/build/lib/
281360
GTEST_FILTER="-*umfIpcTest.GetPoolByOpenedHandle*"
282361
ctest --verbose -E "not_impl|umf-mempolicy"
362+
363+
# Browse all folders in the examples directory, build them using the
364+
# latest UMF version, and run them, excluding those in the exclude list.
365+
# NOTE: exclude cuda examples as they require linking with static disjoint
366+
# pool library
367+
- name: Build and run "tag" examples using the latest UMF libraries
368+
working-directory: ${{github.workspace}}/tag_version
369+
run: |
370+
EXAMPLES_EXCLUDE_LIST="cmake|common|hmat|cuda${{matrix.provider == 'LEVEL_ZERO' && '' || '|level_zero' }}"
371+
rm -rf build
372+
rm -rf include
373+
mkdir _examples
374+
cd _examples
375+
EXAMPLES_LIST=$(find ${{github.workspace}}/tag_version/examples -maxdepth 1 -mindepth 1 -type d | grep -Ev $EXAMPLES_EXCLUDE_LIST | xargs -n 1 basename)
376+
for EXAMPLE_NAME in $EXAMPLES_LIST; do
377+
cd ${{github.workspace}}/tag_version
378+
mkdir -p _examples/$EXAMPLE_NAME;
379+
cd _examples/$EXAMPLE_NAME;
380+
echo "Building example: $EXAMPLE_NAME"
381+
CMAKE_PREFIX_PATH=${{github.workspace}}/latest_version/_install cmake ${{github.workspace}}/tag_version/examples/$EXAMPLE_NAME;
382+
find . -maxdepth 1 -type f -executable -exec echo "Running example: {}" \; -exec {} \;
383+
done
384+
385+
# TODO add GPU windows

0 commit comments

Comments
 (0)