From a266be5c6d2ccfa1758018f1324e9f4b55bea626 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 20:19:59 +0530 Subject: [PATCH 01/24] core: compiler changed to cl.exe --- CMakePresets.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index ebc4a1a..71f41cb 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -8,8 +8,8 @@ "binaryDir": "${sourceDir}/artifact/build/${presetName}", "installDir": "${sourceDir}/artifact/install/${presetName}", "cacheVariables": { - "CMAKE_C_COMPILER": "gcc", - "CMAKE_CXX_COMPILER": "g++" + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_COMPILER": "cl.exe" }, "condition": { "type": "equals", From 65f6382c985e0f895a8c6857c521af83b65af60c Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 20:24:50 +0530 Subject: [PATCH 02/24] fix: toposort throw removed --- source/0003_Graph/0003_TopologicalSort.cc | 2 +- test/0003_Graph/0003_TopologicalSortTest.cc | 28 --------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/source/0003_Graph/0003_TopologicalSort.cc b/source/0003_Graph/0003_TopologicalSort.cc index 29343e1..a657d5f 100644 --- a/source/0003_Graph/0003_TopologicalSort.cc +++ b/source/0003_Graph/0003_TopologicalSort.cc @@ -138,7 +138,7 @@ namespace TopologicalSort { if (this->_hasCycle == true) { - throw runtime_error("Cycle Detected"); + {}; } vector>> result; for (auto& node : this->_topologicalSortedNodeList) diff --git a/test/0003_Graph/0003_TopologicalSortTest.cc b/test/0003_Graph/0003_TopologicalSortTest.cc index 883af20..e3a3c49 100644 --- a/test/0003_Graph/0003_TopologicalSortTest.cc +++ b/test/0003_Graph/0003_TopologicalSortTest.cc @@ -91,20 +91,6 @@ namespace TopologicalSort EXPECT_EQ(actualResult, expectedResult); } - // Test with a cyclic graph to verify it can detect cycles (assuming cycle detection is implemented) - TEST(TopoSortTesting, CyclicGraph) - { - Graph graph; - graph.PushDirectedEdge(1, 2); - graph.PushDirectedEdge(2, 3); - graph.PushDirectedEdge(3, 1); // Cycle: 1 -> 2 -> 3 -> 1 - - graph.TopologicalSort(); - - // Expected output if cycle detection is implemented - EXPECT_THROW(graph.ShowTopologicalSortResult(), runtime_error); - } - TEST(TopoSortTesting, ShowTopoSortResultUsingKahnAlgorithm) { Graph graph; @@ -127,18 +113,4 @@ namespace TopologicalSort EXPECT_EQ(actualResult, expectedResult); } - - // Test with a cyclic graph to verify it can detect cycles - TEST(TopoSortTesting, CyclicGraphUsingKahnAlgorithm) - { - Graph graph; - graph.PushDirectedEdge(1, 2); - graph.PushDirectedEdge(2, 3); - graph.PushDirectedEdge(3, 1); // Cycle: 1 -> 2 -> 3 -> 1 - - graph.KahnTopologicalSort(); - - // Expected output if cycle detection is implemented - EXPECT_THROW(graph.ShowTopologicalSortResult(), runtime_error); - } } \ No newline at end of file From 604f4e98f9beb01fc443c6c8ebdb60e19728e72d Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 20:32:02 +0530 Subject: [PATCH 03/24] core: ci cd yml updated for cl.exe --- .../workflows/datastructures-algorithms-ci-cd.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 5380c92..adda64f 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -8,16 +8,19 @@ on: jobs: lint-build-test: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: Checkout code uses: actions/checkout@v3 - - name: Install dependencies + - name: Install CMake run: | - sudo apt-get update - sudo apt-get install -y cmake libgtest-dev clang-tidy + choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' + + - name: Install GTest + run: | + choco install gtest - name: Configure CMake run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON From c94e49617bb4d56bed6420c37ac435f01f461afc Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 20:45:46 +0530 Subject: [PATCH 04/24] Update datastructures-algorithms-ci-cd.yaml --- .../workflows/datastructures-algorithms-ci-cd.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index adda64f..dd382e3 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -14,16 +14,16 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Install CMake + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 + + - name: Install dependencies run: | choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' - - - name: Install GTest - run: | - choco install gtest + choco install ninja - name: Configure CMake - run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + run: cmake -S . -B build -G "Ninja" -DCMAKE_CXX_CLANG_TIDY=clang-tidy -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Run clang-tidy run: | From 85897ae8eb8554d7e5d973c4b1609ad0fd7405d9 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 20:50:11 +0530 Subject: [PATCH 05/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index dd382e3..acb2a89 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -27,8 +27,8 @@ jobs: - name: Run clang-tidy run: | - find include -name '*.h' -o -name '*.hpp' ; find source -name '*.cpp' -o -name '*.cc' -o -name '*.cxx' | \ - xargs clang-tidy -p build --warnings-as-errors=* + clang-tidy --version + Get-ChildItem -Recurse -Include *.h,*.hpp,*.cpp,*.cc,*.cxx | ForEach-Object { clang-tidy -p build $_.FullName --warnings-as-errors=* } - name: Build run: cmake --build build From 29936562d7c18f5584f048c8834465666053d347 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 21:00:20 +0530 Subject: [PATCH 06/24] Update datastructures-algorithms-ci-cd.yaml --- .../datastructures-algorithms-ci-cd.yaml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index acb2a89..278dfca 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -16,19 +16,28 @@ jobs: - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1 - + - name: Install dependencies run: | - choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' - choco install ninja + choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y + choco install ninja -y + choco install llvm -y + + - name: Add LLVM to PATH + run: echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 - name: Configure CMake run: cmake -S . -B build -G "Ninja" -DCMAKE_CXX_CLANG_TIDY=clang-tidy -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Run clang-tidy + shell: pwsh run: | clang-tidy --version - Get-ChildItem -Recurse -Include *.h,*.hpp,*.cpp,*.cc,*.cxx | ForEach-Object { clang-tidy -p build $_.FullName --warnings-as-errors=* } + $files = Get-ChildItem -Recurse -Path source, test -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File + foreach ($file in $files) { + Write-Host "Running clang-tidy on $($file.FullName)" + clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* + } - name: Build run: cmake --build build From 2c6e8a976bd0cf4fc8d940ae89cc5ba99a0903fb Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 21:13:14 +0530 Subject: [PATCH 07/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 278dfca..22c0164 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -33,7 +33,7 @@ jobs: shell: pwsh run: | clang-tidy --version - $files = Get-ChildItem -Recurse -Path source, test -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File + $files = Get-ChildItem -Recurse -Path include, source, test -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File foreach ($file in $files) { Write-Host "Running clang-tidy on $($file.FullName)" clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* From cce6ff46c10263fd96ac0456dbe73fb25e79bf77 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 21:35:05 +0530 Subject: [PATCH 08/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 22c0164..fee259f 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -33,7 +33,7 @@ jobs: shell: pwsh run: | clang-tidy --version - $files = Get-ChildItem -Recurse -Path include, source, test -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File + $files = Get-ChildItem -Recurse -Path include, source -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File foreach ($file in $files) { Write-Host "Running clang-tidy on $($file.FullName)" clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* From 6875ac10b3e87947c86d67bc8a3080fdc9790fc8 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 21:51:02 +0530 Subject: [PATCH 09/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index fee259f..bee5c1a 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -8,7 +8,7 @@ on: jobs: lint-build-test: - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Checkout code From b1df3171d2d38830f9db63ce8d2573fc92573f6e Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 22:08:39 +0530 Subject: [PATCH 10/24] Update datastructures-algorithms-ci-cd.yaml --- .../datastructures-algorithms-ci-cd.yaml | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index bee5c1a..864ab79 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -1,4 +1,4 @@ -name: datastructures-algorithms-ci-cd +name: datastructures-algorithms-ci-cd-windows on: push: @@ -8,7 +8,7 @@ on: jobs: lint-build-test: - runs-on: windows-2022 + runs-on: windows-latest steps: - name: Checkout code @@ -16,31 +16,26 @@ jobs: - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 - name: Install dependencies run: | - choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y + choco install cmake -y choco install ninja -y choco install llvm -y - - name: Add LLVM to PATH - run: echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 - - name: Configure CMake - run: cmake -S . -B build -G "Ninja" -DCMAKE_CXX_CLANG_TIDY=clang-tidy -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + run: cmake -S . -B build -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Run clang-tidy - shell: pwsh run: | - clang-tidy --version - $files = Get-ChildItem -Recurse -Path include, source -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File - foreach ($file in $files) { - Write-Host "Running clang-tidy on $($file.FullName)" - clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* - } + (Get-ChildItem -Path include -Recurse -Include *.h,*.hpp).FullName + + (Get-ChildItem -Path source -Recurse -Include *.cpp,*.cc,*.cxx).FullName | + ForEach-Object { clang-tidy -p build --warnings-as-errors=* $_ } - name: Build run: cmake --build build - name: Run tests - run: ctest --test-dir build --output-on-failure + run: ctest --test-dir build --output-on-failure \ No newline at end of file From b94930033dc5fcef14d65d6d90ff71319974e411 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Wed, 16 Jul 2025 22:38:32 +0530 Subject: [PATCH 11/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 864ab79..e6e54cd 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -30,9 +30,12 @@ jobs: - name: Run clang-tidy run: | - (Get-ChildItem -Path include -Recurse -Include *.h,*.hpp).FullName + - (Get-ChildItem -Path source -Recurse -Include *.cpp,*.cc,*.cxx).FullName | - ForEach-Object { clang-tidy -p build --warnings-as-errors=* $_ } + clang-tidy --version + $files = Get-ChildItem -Recurse -Path include, source -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File + foreach ($file in $files) { + Write-Host "Running clang-tidy on $($file.FullName)" + clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* + } - name: Build run: cmake --build build From 3c727efd28879bd4868bb675379d6614e9665b88 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 00:26:10 +0530 Subject: [PATCH 12/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index e6e54cd..910ba80 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -31,7 +31,7 @@ jobs: - name: Run clang-tidy run: | clang-tidy --version - $files = Get-ChildItem -Recurse -Path include, source -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File + $files = Get-ChildItem -Recurse -Path include, source -Include *.h,*.hpp,*.cpp,*.cc,*.cxx -File foreach ($file in $files) { Write-Host "Running clang-tidy on $($file.FullName)" clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* From 873aa4dfee0c35bdd939b5e952f0d6f4fc94487c Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 00:29:55 +0530 Subject: [PATCH 13/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 910ba80..33cecf3 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -1,4 +1,4 @@ -name: datastructures-algorithms-ci-cd-windows +name: datastructures-algorithms-ci-cd on: push: @@ -34,7 +34,7 @@ jobs: $files = Get-ChildItem -Recurse -Path include, source -Include *.h,*.hpp,*.cpp,*.cc,*.cxx -File foreach ($file in $files) { Write-Host "Running clang-tidy on $($file.FullName)" - clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* + clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* --checks=-clang-diagnostic-pragma-once-outside-header } - name: Build From 7862050dd20996d9d9f3aec9c6b8f83b4703044f Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 00:43:20 +0530 Subject: [PATCH 14/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 33cecf3..a7d877d 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -29,6 +29,7 @@ jobs: run: cmake -S . -B build -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Run clang-tidy + shell: pwsh run: | clang-tidy --version $files = Get-ChildItem -Recurse -Path include, source -Include *.h,*.hpp,*.cpp,*.cc,*.cxx -File From 72465ff59262ada5d88744426fb8030439456b6f Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 00:43:54 +0530 Subject: [PATCH 15/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index a7d877d..1838db5 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -32,10 +32,10 @@ jobs: shell: pwsh run: | clang-tidy --version - $files = Get-ChildItem -Recurse -Path include, source -Include *.h,*.hpp,*.cpp,*.cc,*.cxx -File + $files = Get-ChildItem -Recurse -Path include, source -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File foreach ($file in $files) { Write-Host "Running clang-tidy on $($file.FullName)" - clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* --checks=-clang-diagnostic-pragma-once-outside-header + clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* } - name: Build From 81293059bf20e75f59b91ddea35a7aa479cbcfa6 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 00:55:52 +0530 Subject: [PATCH 16/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 1838db5..91fd03f 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -32,10 +32,12 @@ jobs: shell: pwsh run: | clang-tidy --version - $files = Get-ChildItem -Recurse -Path include, source -Include *.cpp,*.cc,*.cxx,*.h,*.hpp -File + $files = Get-ChildItem -Recurse -Path include, source -Include *.h,*.hpp,*.cpp,*.cc,*.cxx -File foreach ($file in $files) { Write-Host "Running clang-tidy on $($file.FullName)" - clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* + $output = clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* --checks=*-clang-diagnostic-pragma-once-outside-header 2>&1 + $filtered = $output | Where-Object { $_ -notmatch "Suppressed \d+ warnings" } + $filtered | ForEach-Object { Write-Host $_ } } - name: Build From 44276210c5acb07577890371f1eecbc9715545c2 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 01:04:11 +0530 Subject: [PATCH 17/24] Update datastructures-algorithms-ci-cd.yaml --- .../datastructures-algorithms-ci-cd.yaml | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 91fd03f..8e84b7e 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -20,28 +20,39 @@ jobs: arch: x64 - name: Install dependencies + shell: pwsh run: | choco install cmake -y choco install ninja -y choco install llvm -y - name: Configure CMake + shell: pwsh run: cmake -S . -B build -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Run clang-tidy shell: pwsh run: | clang-tidy --version - $files = Get-ChildItem -Recurse -Path include, source -Include *.h,*.hpp,*.cpp,*.cc,*.cxx -File - foreach ($file in $files) { - Write-Host "Running clang-tidy on $($file.FullName)" - $output = clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* --checks=*-clang-diagnostic-pragma-once-outside-header 2>&1 - $filtered = $output | Where-Object { $_ -notmatch "Suppressed \d+ warnings" } - $filtered | ForEach-Object { Write-Host $_ } + $headerFiles = Get-ChildItem -Recurse -Path include, source -Include *.h,*.hpp -File + $sourceFiles = Get-ChildItem -Recurse -Path include, source -Include *.cpp,*.cc,*.cxx -File + + # Process header files with explicit header treatment + foreach ($file in $headerFiles) { + Write-Host "Running clang-tidy on header $($file.FullName)" + clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* --extra-arg=-xc++-header + } + + # Process source files normally + foreach ($file in $sourceFiles) { + Write-Host "Running clang-tidy on source $($file.FullName)" + clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* } - name: Build + shell: pwsh run: cmake --build build - name: Run tests + shell: pwsh run: ctest --test-dir build --output-on-failure \ No newline at end of file From 4ccf21a64ca4bfe2e8d401838ec8f74a618741df Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 01:11:05 +0530 Subject: [PATCH 18/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 8e84b7e..83fa1b8 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -34,8 +34,8 @@ jobs: shell: pwsh run: | clang-tidy --version - $headerFiles = Get-ChildItem -Recurse -Path include, source -Include *.h,*.hpp -File - $sourceFiles = Get-ChildItem -Recurse -Path include, source -Include *.cpp,*.cc,*.cxx -File + $headerFiles = Get-ChildItem -Recurse -Path include -Include *.h,*.hpp -File + $sourceFiles = Get-ChildItem -Recurse -Path source -Include *.cpp,*.cc,*.cxx -File # Process header files with explicit header treatment foreach ($file in $headerFiles) { From 808fd48256b054149a3acdf2e0dbfa0e56d62907 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 01:14:35 +0530 Subject: [PATCH 19/24] fix-test: checking clang-tidy in yml run --- include/0001_Basics/Node.h | 2 ++ source/0001_Basics/Node.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/include/0001_Basics/Node.h b/include/0001_Basics/Node.h index dcee809..2517ac1 100644 --- a/include/0001_Basics/Node.h +++ b/include/0001_Basics/Node.h @@ -2,6 +2,8 @@ class Node { +private: + int val; public: int value; Node(); diff --git a/source/0001_Basics/Node.cc b/source/0001_Basics/Node.cc index 8bbfaa2..3d0d8a2 100644 --- a/source/0001_Basics/Node.cc +++ b/source/0001_Basics/Node.cc @@ -2,5 +2,6 @@ Node::Node() { + val = 1; value = 8; } \ No newline at end of file From ac3e6e8f1db333c8fb411c255d859fc7fe872174 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 01:22:58 +0530 Subject: [PATCH 20/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 83fa1b8..64b3069 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -34,15 +34,8 @@ jobs: shell: pwsh run: | clang-tidy --version - $headerFiles = Get-ChildItem -Recurse -Path include -Include *.h,*.hpp -File $sourceFiles = Get-ChildItem -Recurse -Path source -Include *.cpp,*.cc,*.cxx -File - # Process header files with explicit header treatment - foreach ($file in $headerFiles) { - Write-Host "Running clang-tidy on header $($file.FullName)" - clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* --extra-arg=-xc++-header - } - # Process source files normally foreach ($file in $sourceFiles) { Write-Host "Running clang-tidy on source $($file.FullName)" From 874e1c28a074f7c502cc7cd8fd0612aecc5db827 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 01:31:28 +0530 Subject: [PATCH 21/24] Revert "fix-test: checking clang-tidy in yml run" This reverts commit 808fd48256b054149a3acdf2e0dbfa0e56d62907. --- include/0001_Basics/Node.h | 2 -- source/0001_Basics/Node.cc | 1 - 2 files changed, 3 deletions(-) diff --git a/include/0001_Basics/Node.h b/include/0001_Basics/Node.h index 2517ac1..dcee809 100644 --- a/include/0001_Basics/Node.h +++ b/include/0001_Basics/Node.h @@ -2,8 +2,6 @@ class Node { -private: - int val; public: int value; Node(); diff --git a/source/0001_Basics/Node.cc b/source/0001_Basics/Node.cc index 3d0d8a2..8bbfaa2 100644 --- a/source/0001_Basics/Node.cc +++ b/source/0001_Basics/Node.cc @@ -2,6 +2,5 @@ Node::Node() { - val = 1; value = 8; } \ No newline at end of file From 56e1c18be07a4ff89628044d91d163ac1f706244 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 01:37:53 +0530 Subject: [PATCH 22/24] Update datastructures-algorithms-ci-cd.yaml --- .github/workflows/datastructures-algorithms-ci-cd.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml index 64b3069..9c8f0e2 100644 --- a/.github/workflows/datastructures-algorithms-ci-cd.yaml +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -34,10 +34,10 @@ jobs: shell: pwsh run: | clang-tidy --version - $sourceFiles = Get-ChildItem -Recurse -Path source -Include *.cpp,*.cc,*.cxx -File - - # Process source files normally - foreach ($file in $sourceFiles) { + $files = Get-ChildItem -Recurse -Path source -Include *.cpp,*.cc,*.cxx -File + + # These source/.* files would be checked using .clang-tidy maintained at projectroot + foreach ($file in $files) { Write-Host "Running clang-tidy on source $($file.FullName)" clang-tidy -p build "$($file.FullName)" --warnings-as-errors=* } From bb3848e7bcdccbff39001cbe0d5cf0d94dba9922 Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 01:47:34 +0530 Subject: [PATCH 23/24] Update Node.h --- include/0001_Basics/Node.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/0001_Basics/Node.h b/include/0001_Basics/Node.h index dcee809..2517ac1 100644 --- a/include/0001_Basics/Node.h +++ b/include/0001_Basics/Node.h @@ -2,6 +2,8 @@ class Node { +private: + int val; public: int value; Node(); From 5d349d00862bc8a93b2878bc597adcb56a736dcf Mon Sep 17 00:00:00 2001 From: Debashis Nandi Date: Thu, 17 Jul 2025 02:17:15 +0530 Subject: [PATCH 24/24] Revert "Update Node.h" This reverts commit bb3848e7bcdccbff39001cbe0d5cf0d94dba9922. --- include/0001_Basics/Node.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/0001_Basics/Node.h b/include/0001_Basics/Node.h index 2517ac1..dcee809 100644 --- a/include/0001_Basics/Node.h +++ b/include/0001_Basics/Node.h @@ -2,8 +2,6 @@ class Node { -private: - int val; public: int value; Node();