Skip to content

Commit

Permalink
ci: update static checks
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaDucak committed Mar 17, 2024
1 parent b252578 commit a9974e0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and test
name: PR check

on:
pull_request:
Expand Down Expand Up @@ -85,11 +85,11 @@ jobs:

- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCAPS_LOG_BUILD_TESTS=On -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake

- name: Configure CMake (Windows)
if: matrix.os != 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCAPS_LOG_BUILD_TESTS=On

- name: Build
run: cmake --build ${{github.workspace}}/build --config Release
Expand All @@ -98,32 +98,24 @@ jobs:
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure


static-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install libboost-program-options-dev libgit2-dev
- run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCAPS_LOG_BUILD_TESTS=On
- uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: 19
database: 'build'
style: 'file' # Use .clang-format config file
tidy-checks: '' # Use .clang-tidy config file
# only 'update' a single comment in a pull request's thread.
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: exit 1

- name: Prepare environment
run: sudo apt-get update && sudo apt-get install libboost-program-options-dev libgit2-dev clang-tidy

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=Off

- name: Build
run: cmake --build ${{github.workspace}}/build --config Release

- name: Static Analysis
run: ln -s ./build/compile_commands.json ./ && run-clang-tidy ./source/

code-formatting:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: DoozyX/[email protected]
with:
source: 'source test'
extensions: 'hpp,cpp'
clangFormatVersion: 16
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ endif()
# ------------------------------- OpenSSL -------------------------------- #

set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL REQUIRED)
find_package(OpenSSL REQUIRED COMPONENTS Crypto)

# ------------------------------- LibGit2 -------------------------------- #

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ by typing `caps-log` in your terminal.
If you wish to build and run the tests, execute:

```shell
mkdir build && cd build && cmake .. -DBUILD_TESTS=ON
mkdir build && cd build && cmake .. -DCAPS_LOG_BUILD_TESTS=ON
make
ctest
```
3 changes: 2 additions & 1 deletion test/calendar_component_test.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "view/calendar_component.hpp"

Check notice on line 1 in test/calendar_component_test.cpp

View workflow job for this annotation

GitHub Actions / static-analysis

Run clang-format on test/calendar_component_test.cpp

File test/calendar_component_test.cpp does not conform to Custom style guidelines. (lines 1)
#include <fstream>
#include <filesystem>
#include <gtest/gtest.h>

static const std::filesystem::path data_dir_path =
CAPS_LOG_TEST_DATA_DIR "/calendar_component_test_expected_render.bin";
std::filesystem::path{CAPS_LOG_TEST_DATA_DIR} / "calendar_component_test_expected_render.bin";

TEST(CalnedarComponentTest, Render) {
using namespace std::chrono_literals;
Expand Down

0 comments on commit a9974e0

Please sign in to comment.