Skip to content

Commit

Permalink
fix: CI
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
  • Loading branch information
xDimon committed Feb 7, 2024
1 parent 58a60b3 commit c192452
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 32 deletions.
29 changes: 19 additions & 10 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
build:
runs-on: macOS-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
name: checkout
Expand All @@ -27,20 +27,29 @@ jobs:
fetch-depth: 1
- name: install
run: |
brew install ninja llvm
set -e
sudo apt-get update || true
sudo apt-get install -y ninja-build gcovr gcc-13 g++-13 clang-15 clang++-15 llvm-15
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 90
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 999
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 999
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-15/bin/clang-15 999
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 999
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 90
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 90
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-13 90
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install scikit-build
sudo python3 -m pip install cmake requests gitpython gcovr pyyaml
sudo python3 -m pip install cmake==3.25 requests gitpython gcovr pyyaml
- name: run checks
run: |
#!/bin/bash
LLVM_DIR=/usr/local/Cellar/llvm
test -d $LLVM_DIR || echo $(echo "llvm is absent, cannot continue" && exit 1)
VER_COUNT=$(ls -1 ${LLVM_DIR} | wc -l)
LLVM_DIR=/usr/lib/llvm-??
VER_COUNT=$(ls -d -1 ${LLVM_DIR} | wc -l)
test ${VER_COUNT} -eq 0 && echo "no llvm version detected" && exit 1
test $VER_COUNT -gt 1 && echo "wrong llvm installation" && exit 1
LLVM_VER=$(ls -1 ${LLVM_DIR})
export LLVM_ROOT=${LLVM_DIR}/${LLVM_VER}
export LLVM_ROOT=$(ls -r -d -1 ${LLVM_DIR} | head -1)
export PATH=${LLVM_ROOT}/bin:${LLVM_ROOT}/share/clang:${PATH}
cmake . -GNinja -Bbuild
cmake . -Bbuild
.github/aux/clang-tidy.sh build
21 changes: 15 additions & 6 deletions .github/workflows/compilers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
os: [ubuntu-22.04, macOS-14]
compiler: [{
"cc": "gcc",
"cxx": "g++"
}, {
"cc": "clang",
"cxx": "clang++"
}]
}]
exclude:
- os: macOS-latest
- os: macOS-14
compiler:
cc: gcc
steps:
Expand All @@ -49,11 +49,20 @@ jobs:
brew install ninja
else
sudo apt-get update || true
sudo apt-get install -y ninja-build
sudo apt-get install -y ninja-build gcc-13 g++-13 clang-15 clang++-15
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 90
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 999
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 999
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-15/bin/clang-15 999
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 999
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 90
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 90
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-13 90
fi
sudo python3 -m pip install --upgrade pip
sudo pip3 install cmake requests gitpython gcovr pyyaml
sudo python3 -m pip install scikit-build
sudo python3 -m pip install cmake==3.25 requests gitpython gcovr pyyaml
- name: cmake
env:
Expand All @@ -62,7 +71,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # has to be included to access other secrets
GITHUB_HUNTER_USERNAME: ${{ secrets.GITHUB_HUNTER_USERNAME }}
GITHUB_HUNTER_TOKEN: ${{ secrets.GITHUB_HUNTER_TOKEN }}
run: cmake . -GNinja -Bbuild
run: cmake . -Bbuild

- name: build
run: cmake --build build -- -j4
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
jobs:
coverage:
name: "codecov"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v1
Expand All @@ -30,16 +30,27 @@ jobs:
run: |
set -e
sudo apt-get update || true
sudo apt-get install -y ninja-build gcovr
sudo apt-get install -y ninja-build gcovr gcc-13 g++-13 clang-15 clang++-15
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 90
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 999
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 999
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-15/bin/clang-15 999
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 999
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 90
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 90
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-13 90
sudo python3 -m pip install --upgrade pip
sudo pip3 install scikit-build
sudo pip3 install cmake requests gitpython gcovr pyyaml
sudo python3 -m pip install scikit-build
sudo python3 -m pip install cmake==3.25 requests gitpython gcovr pyyaml
- name: "cmake"
env:
CC: clang
CXX: clang++
run: |
cmake . -GNinja -Bbuild-coverage -DCOVERAGE=ON -DEXAMPLES=OFF
cmake . -Bbuild-coverage -DCOVERAGE=ON -DEXAMPLES=OFF
cmake --build build-coverage
- name: "build report"
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: "Undefined Behavior Sanitizer"
sanitizer: UBSAN
name: "${{ matrix.options.name }}"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v1
Expand All @@ -62,7 +62,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # has to be included to access other secrets
GITHUB_HUNTER_USERNAME: ${{ secrets.GITHUB_HUNTER_USERNAME }}
GITHUB_HUNTER_TOKEN: ${{ secrets.GITHUB_HUNTER_TOKEN }}
run: cmake . -GNinja -Bbuild -D${{ matrix.options.sanitizer }}=ON
run: cmake . -Bbuild -D${{ matrix.options.sanitizer }}=ON

- name: build
run: cmake --build build -- -j4
Expand Down
4 changes: 2 additions & 2 deletions cmake/toolchain/compiler/clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ set(
)

string(REGEX MATCH "([0-9]+).([0-9]+).([0-9]+)" v ${CMAKE_CXX_COMPILER_VERSION})
if (${CMAKE_MATCH_1} LESS 11)
print("Requires Clang compiler at least version 11")
if (${CMAKE_MATCH_1} LESS 15)
print("Requires Clang compiler at least version 15")
endif()

if (${CMAKE_MATCH_1} GREATER_EQUAL 10)
Expand Down
4 changes: 4 additions & 0 deletions include/soralog/circular_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace soralog {
public:
using element_type = T;

// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init)
struct Node final {
template <typename... Args>
void init(Args &&...args) {
Expand All @@ -36,9 +37,11 @@ namespace soralog {
return *reinterpret_cast<const T *>(item_);
}

// NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
std::atomic_flag busy = ATOMIC_VAR_INIT(false);

private:
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
alignas(std::alignment_of_v<T>) char item_[sizeof(T)];
};

Expand Down Expand Up @@ -98,6 +101,7 @@ namespace soralog {
}
};

// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init)
explicit CircularBuffer(size_t capacity) : CircularBuffer(capacity, 0){};

size_t capacity() const noexcept {
Expand Down
2 changes: 2 additions & 0 deletions include/soralog/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ namespace soralog {
return *pos;
}
constexpr auto &operator++() {
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
++pos;
return *this;
}
constexpr auto operator++(int) {
auto origin = *this;
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
++pos;
return origin;
}
Expand Down
14 changes: 7 additions & 7 deletions include/soralog/sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
#define IF_RELEASE false
#endif

#if not defined(likely_if)
#if not defined(LIKELY_IF)
#if __cplusplus >= 202002L
#define likely_if(x) [[likely]] if (x)
#define LIKELY_IF(x) [[likely]] if (x)
#elif defined(__has_builtin)
#if __has_builtin(__builtin_expect)
#define likely_if(x) if (__builtin_expect((x), 1))
#define LIKELY_IF(x) if (__builtin_expect((x), 1))
#else
#define likely_if(x) if (x)
#define LIKELY_IF(x) if (x)
#endif
#else
#define likely_if(x) if (x)
#define LIKELY_IF(x) if (x)
#endif
#endif

Expand Down Expand Up @@ -107,7 +107,7 @@ namespace soralog {
max_message_length_, args...);

// Event is queued successfully
likely_if((bool)node) {
LIKELY_IF((bool)node) {
size_ += node->message().size();
break;
}
Expand Down Expand Up @@ -165,4 +165,4 @@ namespace soralog {

} // namespace soralog

#undef likely_if
#undef LIKELY_IF

0 comments on commit c192452

Please sign in to comment.