Skip to content

Develop #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ jobs:
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main"
sudo apt-get -y update
sudo apt-get -y install --no-install-recommends --no-install-suggests clang-format
# yamllint enable rule:line-length

- name: Check Tools
run: |
make --version
cmake --version
clang-format --version
# yamllint enable rule:line-length

- name: Style Check
run: make test/styling
10 changes: 2 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ jobs:

- name: Install dependencies
run: |
vcpkg --x-wait-for-lock integrate install
vcpkg --x-wait-for-lock install
make dependencies

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down Expand Up @@ -112,12 +111,7 @@ jobs:
shell: bash
run: |
export VCPKG_ROOT=/usr/local/share/vcpkg
cmake --preset debug -B build
cmake --preset debug \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
build
cmake --build build --verbose
make build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/cpp-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,13 @@ jobs:

- name: Install dependencies
run: |
vcpkg --x-wait-for-lock integrate install
vcpkg --x-wait-for-lock install
make dependencies

# yamllint disable rule:line-length
- name: Build
run: |
export VCPKG_ROOT=/usr/local/share/vcpkg
cmake --preset debug -B build
cmake --preset debug \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
build
cmake --build build --verbose
make build
# yamllint enable rule:line-length

- name: Test / Coverage
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,13 @@ jobs:

- name: Install dependencies
run: |
vcpkg --x-wait-for-lock integrate install
vcpkg --x-wait-for-lock install
make dependencies

# yamllint disable rule:line-length
- name: Build
run: |
export VCPKG_ROOT=/usr/local/share/vcpkg
cmake --preset debug -B build
cmake --preset debug \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
build
cmake --build build --verbose
make build
# yamllint enable rule:line-length

- name: Test
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ jobs:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Install dependencies
- name: Install tools
run: |
sudo snap install cppcheck

- name: Check Tools
run: |
sudo apt-get update
sudo apt-get install cppcheck
make --version
cmake --version
vcpkg --version
cppcheck --version

- name: Install dependencies
run: |
make dependencies

- name: Lint
run: make test/static
run: |
export VCPKG_ROOT=/usr/local/share/vcpkg
make test/static
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure")
include(CTest)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(VCPKG_MANIFEST_INSTALL OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

SET(GCC_COVERAGE_COMPILE_FLAGS "-fsanitize=address -fprofile-arcs -ftest-coverage -g -O0")
SET(GCC_COVERAGE_LINK_FLAGS "--coverage")
Expand Down
1 change: 0 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default"

}
]
}
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ clean:
touch ./coverage/.gitkeep
sh -c "rm -fr -v ./vcpkg_installed" || true

build: dependencies
cmake --preset debug -B build && \
cmake --preset debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 build && \
prebuild: dependencies
cmake --preset debug -B build

build: prebuild
cmake --build build --verbose

dependencies:
Expand All @@ -72,17 +73,18 @@ lint/yaml:

lint: lint/markdown lint/yaml test/styling test/static

test/static:
test/static: prebuild
cppcheck \
--project=build/compile_commands.json \
--enable=all \
--check-level=exhaustive \
--std=c++17 \
--library=posix \
--inconclusive \
--inline-suppr \
--error-exitcode=13 \
--suppress=missingIncludeSystem \
--showtime=summary \
src/
--showtime=summary

test/styling:
clang-format --dry-run --Werror $(FILES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

namespace hackerrank::warmup {
std::string miniMaxSumCalculate(const std::vector<int> &arr);
void miniMaxSum(const std::vector<int> &ar);
void miniMaxSum(const std::vector<int> &arr);
} // namespace hackerrank::warmup