Skip to content

Commit

Permalink
Merge pull request #162 from elbeno/update-cicd
Browse files Browse the repository at this point in the history
🚨 Updates for fixed clang-tidy
  • Loading branch information
elbeno authored Oct 23, 2024
2 parents d4ba91e + a68384f commit 5530b5d
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 41 deletions.
60 changes: 37 additions & 23 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ jobs:
run: |
${{ matrix.install }}
sudo apt install -y ninja-build python3-venv python3-pip
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Restore CPM cache
env:
Expand Down Expand Up @@ -132,6 +127,13 @@ jobs:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}

- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Build Unit Tests
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests

Expand Down Expand Up @@ -184,10 +186,6 @@ jobs:
run: |
${{ matrix.install }}
sudo apt install -y ninja-build python3-venv python3-pip
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Restore CPM cache
env:
Expand Down Expand Up @@ -215,6 +213,13 @@ jobs:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}

- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Build Unit Tests
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests

Expand Down Expand Up @@ -263,7 +268,7 @@ jobs:
CC: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang"
CXX: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang++"
PR_TARGET_BRANCH: ${{ steps.target_branch.outputs.branch }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=17 -DCPM_SOURCE_CACHE=~/cpm-cache

- name: Save CPM cache
env:
Expand Down Expand Up @@ -303,10 +308,6 @@ jobs:
run: |
${{ matrix.install }}
sudo apt install -y ninja-build python3-venv python3-pip
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Restore CPM cache
env:
Expand Down Expand Up @@ -335,6 +336,13 @@ jobs:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}

- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
# https://github.com/actions/runner-images/issues/9524
- name: Fix kernel mmap rnd bits
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
Expand All @@ -353,10 +361,6 @@ jobs:
- name: Install build tools
run: |
sudo apt update && sudo apt install -y gcc-${{env.DEFAULT_GCC_VERSION}} g++-${{env.DEFAULT_GCC_VERSION}} ninja-build valgrind python3-venv python3-pip
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Restore CPM cache
env:
Expand Down Expand Up @@ -384,6 +388,13 @@ jobs:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}

- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Build Unit Tests
run: cmake --build ${{github.workspace}}/build -t build_unit_tests

Expand Down Expand Up @@ -428,10 +439,6 @@ jobs:
- name: Install build tools
run: |
sudo apt update && sudo apt install -y clang-${{env.MULL_LLVM_VERSION}} ninja-build python3-venv python3-pip
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Install mull
env:
Expand Down Expand Up @@ -466,12 +473,19 @@ jobs:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}

- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Build and run mull tests
run: cmake --build build -t mull_tests

merge_ok:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
needs: [build_and_test_24, build_and_test_22, quality_checks_pass, sanitize, valgrind]
needs: [build_and_test_24, build_and_test_22, mutate, quality_checks_pass, sanitize, valgrind]
if: ${{ !cancelled() }}
steps:
- name: Enable merge
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ CMakePresets.json
__pycache__
.mypy_cache
.pytest_cache
.hypothesis
.hypothesis
requirements.txt
5 changes: 4 additions & 1 deletion include/stdx/atomic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace stdx {
inline namespace v1 {
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
template <typename T> class atomic {
static_assert(std::is_trivially_copyable_v<T> and
std::is_copy_constructible_v<T> and
Expand All @@ -39,7 +40,7 @@ template <typename T> class atomic {

constexpr atomic() CPP20(requires std::is_default_constructible_v<elem_t>)
: value{} {}
constexpr atomic(T t) : value{static_cast<elem_t>(t)} {}
constexpr explicit atomic(T t) : value{static_cast<elem_t>(t)} {}
atomic(atomic const &) = delete;
auto operator=(atomic const &) -> atomic & = delete;

Expand All @@ -52,7 +53,9 @@ template <typename T> class atomic {
::atomic::store(value, static_cast<elem_t>(t), mo);
}

// NOLINTNEXTLINE(google-explicit-constructor)
[[nodiscard]] operator T() const { return load(); }
// NOLINTNEXTLINE(misc-unconventional-assign-operator)
auto operator=(T t) -> T {
store(t);
return t;
Expand Down
1 change: 1 addition & 0 deletions include/stdx/atomic_bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class atomic_bitset {
return static_cast<StorageElem>(salient_value(order));
}

// NOLINTNEXTLINE(google-explicit-constructor)
operator bitset_t() const {
return bitset_t{salient_value(std::memory_order_seq_cst)};
}
Expand Down
9 changes: 5 additions & 4 deletions include/stdx/bit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ inline namespace v1 {
// endian

#if __cpp_lib_endian < 201907L
enum struct endian {
// NOLINTNEXTLINE(performance-enum-size)
enum struct endian : underlying_type_t<decltype(__BYTE_ORDER__)> {
little = __ORDER_LITTLE_ENDIAN__,
big = __ORDER_BIG_ENDIAN__,
native = __BYTE_ORDER__
Expand Down Expand Up @@ -262,14 +263,14 @@ constexpr auto bit_pack = [](auto... args) {
};

template <>
constexpr auto bit_pack<std::uint16_t> =
constexpr inline auto bit_pack<std::uint16_t> =
[](std::uint8_t hi, std::uint8_t lo) -> std::uint16_t {
return static_cast<std::uint16_t>((static_cast<std::uint32_t>(hi) << 8u) |
lo);
};

template <>
constexpr auto bit_pack<std::uint32_t> =
constexpr inline auto bit_pack<std::uint32_t> =
stdx::overload{[](std::uint16_t hi, std::uint16_t lo) -> std::uint32_t {
return (static_cast<std::uint32_t>(hi) << 16u) | lo;
},
Expand All @@ -281,7 +282,7 @@ constexpr auto bit_pack<std::uint32_t> =
}};

template <>
constexpr auto bit_pack<std::uint64_t> =
constexpr inline auto bit_pack<std::uint64_t> =
stdx::overload{[](std::uint32_t hi, std::uint32_t lo) -> std::uint64_t {
return (static_cast<std::uint64_t>(hi) << 32u) | lo;
},
Expand Down
4 changes: 4 additions & 0 deletions include/stdx/compiler.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

// NOLINTBEGIN(cppcoreguidelines-macro-usage)

#ifndef CONSTINIT
#ifndef __cpp_constinit
#if defined(__clang__)
Expand Down Expand Up @@ -50,3 +52,5 @@
#else
#define STDX_PRAGMA(X) STDX_DO_PRAGMA(GCC X)
#endif

// NOLINTEND(cppcoreguidelines-macro-usage)
4 changes: 4 additions & 0 deletions include/stdx/panic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ auto panic(Args &&...args) -> void {
} // namespace v1
} // namespace stdx

// NOLINTBEGIN(cppcoreguidelines-macro-usage)

#if __cplusplus >= 202002L
#define STDX_PANIC(MSG, ...) \
[] { \
Expand All @@ -40,3 +42,5 @@ auto panic(Args &&...args) -> void {
#else
#define STDX_PANIC(...) stdx::panic(__VA_ARGS__)
#endif

// NOLINTEND(cppcoreguidelines-macro-usage)
4 changes: 4 additions & 0 deletions include/stdx/udls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ operator""_Gi(unsigned long long int n) -> unsigned long long int {
return n * 1'024ull * 1'024ull * 1'024ull;
}

// NOLINTBEGIN(cppcoreguidelines-macro-usage)

#define STDX_SMALL_INT_LITERAL_DEF(x) \
CONSTEVAL auto operator""_##x(char const *, std::size_t) \
->std::integral_constant<std::size_t, x##u> { \
Expand All @@ -103,6 +105,8 @@ STDX_SMALL_INT_LITERAL_DEF(9)

#undef STDX_SMALL_INT_LITERAL_DEF

// NOLINTEND(cppcoreguidelines-macro-usage)

// NOLINTEND(google-runtime-int)
} // namespace literals

Expand Down
6 changes: 5 additions & 1 deletion include/stdx/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ template <typename T, typename U>
if constexpr (t_is_const) {
return std::as_const(u);
} else {
return static_cast<U &>(u);
return (u);
}
} else {
if constexpr (t_is_const) {
Expand Down Expand Up @@ -182,6 +182,8 @@ constexpr auto is_aligned_with = [](auto v) -> bool {
} // namespace v1
} // namespace stdx

// NOLINTBEGIN(cppcoreguidelines-macro-usage)

#ifndef FWD
#define FWD(x) std::forward<decltype(x)>(x)
#endif
Expand Down Expand Up @@ -217,3 +219,5 @@ constexpr auto is_aligned_with = [](auto v) -> bool {
STDX_PRAGMA(diagnostic pop) \
}()
#endif

// NOLINTEND(cppcoreguidelines-macro-usage)
11 changes: 0 additions & 11 deletions requirements.txt

This file was deleted.

0 comments on commit 5530b5d

Please sign in to comment.