Skip to content
Open
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
47 changes: 47 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

echo "Starting pre-commit checks..."

if ! command -v cmake &> /dev/null || ! command -v ninja &> /dev/null; then
echo "Error: cmake or ninja not found."
exit 1
fi

echo "Configuring project..."
cmake -S . -B build \
-G Ninja \
-DCMAKE_PREFIX_PATH=$(brew --prefix qt6) \
-DCMAKE_BUILD_TYPE=Release

if [ $? -ne 0 ]; then
echo "Configuration failed. Retrying with a clean build directory..."
rm -rf build
cmake -S . -B build \
-G Ninja \
-DCMAKE_PREFIX_PATH=$(brew --prefix qt6) \
-DCMAKE_BUILD_TYPE=Release

if [ $? -ne 0 ]; then
echo "Configuration failed again."
exit 1
fi
fi

echo "Building tests..."
cmake --build build --target tests --parallel $(sysctl -n hw.ncpu)

if [ $? -ne 0 ]; then
echo "Build failed."
exit 1
fi

echo "Running tests..."
cd build && ./tests

if [ $? -ne 0 ]; then
echo "Tests failed."
exit 1
fi

echo "Pre-commit checks passed."
exit 0
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"preLaunchTask": "Build Project",
"visualizerFile": "/Users/mateuszadamowicz/Library/Application Support/Code/User/workspaceStorage/39f5990b86fcd335d48f145a08be8b3a/tonka3000.qtvsctools/qt.natvis.xml"
"visualizerFile": "/Users/mateuszadamowicz/Library/Application Support/Code/User/workspaceStorage/838ef04dbd7312a4e085a4551843a85b/tonka3000.qtvsctools/qt.natvis.xml"
},
{
"name": "Run Project Tests",
Expand All @@ -20,7 +20,7 @@
"MIMode": "lldb",
"preLaunchTask": "Build Project Tests",
"externalConsole": false,
"visualizerFile": "/Users/mateuszadamowicz/Library/Application Support/Code/User/workspaceStorage/39f5990b86fcd335d48f145a08be8b3a/tonka3000.qtvsctools/qt.natvis.xml"
"visualizerFile": "/Users/mateuszadamowicz/Library/Application Support/Code/User/workspaceStorage/838ef04dbd7312a4e085a4551843a85b/tonka3000.qtvsctools/qt.natvis.xml"
}
]
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ The repository supports custom Git hooks for development automation.
```bash
# Enables git hooks
chmod u+x .git/hooks/*

# Setup local tests
chmod +x .githooks/pre-commit
git config core.hooksPath .githooks
```

## 🛠 Technologies
Expand Down
Loading