Skip to content

Commit 02f298e

Browse files
authored
Merge pull request #10 from AbeRodz/develop
Develop
2 parents d1acd93 + b5d5512 commit 02f298e

24 files changed

Lines changed: 1047 additions & 414 deletions

.clang-format

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
BasedOnStyle: LLVM
2+
UseTab: Never
3+
IndentWidth: 4
4+
TabWidth: 4
5+
BreakBeforeBraces: Attach
6+
AllowShortBlocksOnASingleLine: false
7+
AllowShortIfStatementsOnASingleLine: false
8+
AllowShortFunctionsOnASingleLine: false
9+
AllowShortLambdasOnASingleLine: false
10+
SortIncludes: false
11+
IndentCaseLabels: false
12+
ColumnLimit: 100
13+
AccessModifierOffset: -4
14+
FixNamespaceComments: false
15+
PointerAlignment: Middle
16+
AlignConsecutiveMacros: AcrossEmptyLines

.github/workflows/validations.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Validations
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
actions: read
10+
checks: write
11+
pull-requests: write
12+
13+
jobs:
14+
verifications:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.13"
21+
- uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: "3.4.2"
24+
- name: Install Ceedling
25+
run: gem install ceedling
26+
- name: Install GCov Reporter
27+
run: pip install gcovr
28+
- name: Run Format Validations
29+
uses: pre-commit/action@v3.0.0
30+
- name: Run Unit Tests
31+
run: ceedling clobber gcov:all
32+
- name: Test Results Report
33+
uses: dorny/test-reporter@v1
34+
if: success() || failure()
35+
with:
36+
name: Ceedling Unit Tests
37+
path: build/artifacts/gcov/junit_tests_report.xml
38+
reporter: jest-junit
39+
- name: Code Coverage Report
40+
uses: irongut/CodeCoverageSummary@v1.3.0
41+
with:
42+
filename: build/artifacts/gcov/gcovr/GcovCoverageCobertura.xml
43+
badge: true
44+
format: markdown
45+
hide_branch_rate: false
46+
hide_complexity: false
47+
indicators: true
48+
output: both
49+
thresholds: "75 90"
50+
- name: Output to Job Summary
51+
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
52+
- name: Add Coverage PR Comment
53+
uses: marocchino/sticky-pull-request-comment@v2
54+
if: github.event_name == 'pull_request'
55+
with:
56+
recreate: true
57+
path: code-coverage-results.md

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
!*.*
33
!*/
44
/build
5+
*.ninja

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- id: check-case-conflict
9+
- id: check-merge-conflict
10+
- repo: https://github.com/pre-commit/mirrors-clang-format
11+
rev: v15.0.6
12+
hooks:
13+
- id: clang-format
14+
name: Formating C files with Clang-Format

CMakeLists.txt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,17 @@ set(CMAKE_C_STANDARD 11)
77

88
# Include directories
99
include_directories(
10-
${CMAKE_SOURCE_DIR} # Include the root directory
11-
Hashmap
12-
HTTP_status
13-
Network
14-
Routing
10+
${CMAKE_SOURCE_DIR} # Include the root directory
11+
${CMAKE_SOURCE_DIR}/inc # Include the 'include' directory where headers are stored
1512
)
1613

17-
# Collect source files
14+
# Collect source files from src/ directory
1815
file(GLOB SOURCES
19-
${CMAKE_SOURCE_DIR}/main.c
20-
${CMAKE_SOURCE_DIR}/Hashmap/*.c
21-
${CMAKE_SOURCE_DIR}/HTTP_status/*.c
22-
${CMAKE_SOURCE_DIR}/Network/*.c
23-
${CMAKE_SOURCE_DIR}/Routing/*.c
16+
${CMAKE_SOURCE_DIR}/src/*.c
2417
)
2518

19+
# Print out all sources for debugging
20+
message(STATUS "Sources: ${SOURCES}")
21+
2622
# Define the main executable
2723
add_executable(main ${SOURCES})

HTTP_status/HTTP_status.h

Lines changed: 0 additions & 79 deletions
This file was deleted.

Hashmap/Hashmap.h

Lines changed: 0 additions & 10 deletions
This file was deleted.

Routing/Routing.c

Lines changed: 0 additions & 69 deletions
This file was deleted.

Routing/RoutingTree.c

Lines changed: 0 additions & 80 deletions
This file was deleted.

build.sh

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
#!/bin/bash
22

3-
# Create a build directory if it doesn't exist
3+
# Create build directory and go into it
44
mkdir -p build
5-
65
cd build
76

8-
# Run CMake to generate Makefiles
9-
cmake ..
10-
11-
# Build
12-
make
7+
# Run cmake and build
8+
cmake .. || exit 1
9+
make || exit 1
1310

14-
if [ "$#" -gt 0 ] && [ "$1" == "-r" ]; then
15-
# Run the server with '-r' option
11+
# Optional: run executable
12+
if [ "$1" == "-r" ]; then
1613
echo -e "\nRunning Server..."
1714
./main
1815
fi
19-
20-
# Return to the project root directory
21-
cd ..

0 commit comments

Comments
 (0)