Skip to content

Commit 3622820

Browse files
committed
Final version of license check
1 parent d8ba0f4 commit 3622820

File tree

3 files changed

+146
-11
lines changed

3 files changed

+146
-11
lines changed

.github/workflows/reusable_checks.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ jobs:
5252
run: cmake --build build --target black-format-check
5353

5454
- name: Run check-license
55-
run: cmake --build build --target check-license
55+
run: |
56+
bash ./check_license/check-headers.sh ./ "Apache-2.0 WITH LLVM-exception" -v
5657
5758
- name: Run copyright-format
58-
run: cmake --build build --target copyright-format
59+
run: |
60+
bash ./check_license/check-headers.sh ./ "Apache-2.0 WITH LLVM-exception" -d
5961
6062
- name: Run a spell check
6163
uses: crate-ci/typos@b63f421581dce830bda2f597a678cb7776b41877 # v1.18.2

.github/workflows/sanitizers.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Check code with compilers' sanitizers
2+
name: Sanitizers
3+
4+
on: workflow_call
5+
6+
env:
7+
BUILD_DIR : "${{github.workspace}}/build"
8+
INSTL_DIR : "${{github.workspace}}/../install-dir"
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
ubuntu-build:
15+
name: Ubuntu
16+
strategy:
17+
matrix:
18+
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}, {c: icx, cxx: icpx}]
19+
# TSAN is mutually exclusive with other sanitizers
20+
sanitizers: [{asan: ON, ubsan: ON, tsan: OFF}, {asan: OFF, ubsan: OFF, tsan: ON}]
21+
runs-on: ubuntu-22.04
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install apt packages
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y clang cmake libhwloc-dev libnuma-dev libjemalloc-dev libtbb-dev
33+
34+
- name: Install oneAPI basekit
35+
if: matrix.compiler.cxx == 'icpx'
36+
run: |
37+
sudo apt-get install -y gpg-agent wget
38+
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
39+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
40+
sudo apt-get update
41+
sudo apt-get install -y intel-oneapi-ippcp-devel intel-oneapi-ipp-devel intel-oneapi-common-oneapi-vars intel-oneapi-compiler-dpcpp-cpp
42+
43+
44+
- name: Set ptrace value for IPC test
45+
run: sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
46+
47+
- name: Configure build
48+
run: >
49+
${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh &&' || ''}}
50+
cmake
51+
-B ${{env.BUILD_DIR}}
52+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
53+
-DCMAKE_BUILD_TYPE=Debug
54+
-DUMF_BUILD_SHARED_LIBRARY=OFF
55+
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
56+
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
57+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
58+
-DUMF_FORMAT_CODE_STYLE=OFF
59+
-DUMF_DEVELOPER_MODE=ON
60+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
61+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
62+
-DUMF_USE_ASAN=${{matrix.sanitizers.asan}}
63+
-DUMF_USE_UBSAN=${{matrix.sanitizers.ubsan}}
64+
-DUMF_USE_TSAN=${{matrix.sanitizers.tsan}}
65+
-DUMF_BUILD_EXAMPLES=ON
66+
-DUMF_TESTS_FAIL_ON_SKIP=ON
67+
68+
- name: Build UMF
69+
run: |
70+
${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh' || true }}
71+
cmake --build ${{env.BUILD_DIR}} -j $(nproc)
72+
73+
- name: Run tests
74+
working-directory: ${{env.BUILD_DIR}}
75+
run: >
76+
${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh &&' || ''}}
77+
ctest --output-on-failure
78+
79+
windows-build:
80+
name: cl and clang-cl on Windows
81+
env:
82+
VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows"
83+
strategy:
84+
matrix:
85+
compiler: [{c: cl, cxx: cl}, {c: clang-cl, cxx: clang-cl}]
86+
# Only ASAN is supported
87+
sanitizers: [{asan: ON}]
88+
runs-on: windows-2022
89+
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
93+
with:
94+
fetch-depth: 0
95+
96+
# Use the latest MSVC toolset available, when compiling UMF with ASan.
97+
# Running binaries compiled with older toolsets results in a
98+
# 'STATUS_DLL_INIT_FAILED' error despite being linked with ASan from
99+
# the same toolset as the compiler being used.
100+
# https://github.com/actions/runner-images/issues/8891
101+
- name: Setup MSVC dev command prompt
102+
if: matrix.sanitizers.asan == 'ON'
103+
uses: TheMrMilchmann/setup-msvc-dev@48edcef51a12c80d7e62ace57aae1417795e511c # v3.0.0
104+
with:
105+
arch: x64
106+
toolset: '14'
107+
108+
- name: Initialize vcpkg
109+
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
110+
with:
111+
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
112+
vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg
113+
vcpkgJsonGlob: '**/vcpkg.json'
114+
115+
- name: Install dependencies
116+
run: vcpkg install
117+
shell: pwsh # Specifies PowerShell as the shell for running the script.
118+
119+
# TODO enable level zero provider
120+
- name: Configure build
121+
run: >
122+
cmake
123+
-B ${{env.BUILD_DIR}}
124+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
125+
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
126+
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
127+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
128+
-DUMF_BUILD_SHARED_LIBRARY=OFF
129+
-DUMF_FORMAT_CODE_STYLE=OFF
130+
-DUMF_DEVELOPER_MODE=ON
131+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
132+
-DUMF_USE_ASAN=${{matrix.sanitizers.asan}}
133+
-DUMF_BUILD_EXAMPLES=ON
134+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
135+
-DUMF_TESTS_FAIL_ON_SKIP=ON
136+
137+
- name: Build UMF
138+
run: cmake --build ${{env.BUILD_DIR}} --config Debug -j $Env:NUMBER_OF_PROCESSORS
139+
140+
- name: Run tests
141+
working-directory: ${{env.BUILD_DIR}}
142+
run: ctest -C Debug --output-on-failure

CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,6 @@ else()
175175
add_custom_target(jemalloc_prod
176176
DEPENDS ${jemalloc_targ_BINARY_DIR}/lib/libjemalloc.a)
177177

178-
add_custom_target(
179-
check-license
180-
COMMAND ${UMF_CMAKE_SOURCE_DIR}/check_license/check-headers.sh
181-
${UMF_CMAKE_SOURCE_DIR} Apache-2.0 WITH LLVM-exception -v)
182-
add_custom_target(
183-
copyright-format
184-
COMMAND ${UMF_CMAKE_SOURCE_DIR}/check_license/check-headers.sh
185-
${UMF_CMAKE_SOURCE_DIR} Apache-2.0 WITH LLVM-exception -d)
186-
187178
add_library(jemalloc INTERFACE)
188179
target_link_libraries(
189180
jemalloc INTERFACE ${jemalloc_targ_BINARY_DIR}/lib/libjemalloc.a)

0 commit comments

Comments
 (0)