Skip to content

core: compiler changed to cl.exe #83

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

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a266be5
core: compiler changed to cl.exe
Debashis08 Jul 16, 2025
65f6382
fix: toposort throw removed
Debashis08 Jul 16, 2025
604f4e9
core: ci cd yml updated for cl.exe
Debashis08 Jul 16, 2025
c94e496
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
85897ae
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
2993656
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
2c6e8a9
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
cce6ff4
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
6875ac1
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
b1df317
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
b949300
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
3c727ef
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
873aa4d
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
7862050
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
72465ff
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
8129305
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
4427621
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
4ccf21a
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
808fd48
fix-test: checking clang-tidy in yml run
Debashis08 Jul 16, 2025
ac3e6e8
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
874e1c2
Revert "fix-test: checking clang-tidy in yml run"
Debashis08 Jul 16, 2025
56e1c18
Update datastructures-algorithms-ci-cd.yaml
Debashis08 Jul 16, 2025
bb3848e
Update Node.h
Debashis08 Jul 16, 2025
5d349d0
Revert "Update Node.h"
Debashis08 Jul 16, 2025
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
31 changes: 24 additions & 7 deletions .github/workflows/datastructures-algorithms-ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,44 @@ on:

jobs:
lint-build-test:
runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Install dependencies
shell: pwsh
run: |
sudo apt-get update
sudo apt-get install -y cmake libgtest-dev clang-tidy
choco install cmake -y
choco install ninja -y
choco install llvm -y

- name: Configure CMake
run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
shell: pwsh
run: cmake -S . -B build -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: Run clang-tidy
shell: pwsh
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
$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=*
}

- name: Build
shell: pwsh
run: cmake --build build

- name: Run tests
run: ctest --test-dir build --output-on-failure
shell: pwsh
run: ctest --test-dir build --output-on-failure
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion source/0003_Graph/0003_TopologicalSort.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace TopologicalSort
{
if (this->_hasCycle == true)
{
throw runtime_error("Cycle Detected");
{};
}
vector<pair<int, pair<int, int>>> result;
for (auto& node : this->_topologicalSortedNodeList)
Expand Down
28 changes: 0 additions & 28 deletions test/0003_Graph/0003_TopologicalSortTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}