Skip to content

Commit 0bd595b

Browse files
authored
Merge pull request #100 from PlummersSoftwareLLC/neon
Neon - A New Web UI for Configuring and Monitoring the NDSCPP server
2 parents d71d90e + 977a1f7 commit 0bd595b

92 files changed

Lines changed: 6098 additions & 38489 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/run-tests/SKILL.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
name: run-tests
3+
description: This skill should be used when the user asks to "run the tests", "build and test", "run ndscpp tests", "execute the test suite", "check if tests pass", or wants to verify that the application builds correctly and the test suite passes. Handles dependency verification, building ndscpp and the test suite, running the server in the background, and executing the tests.
4+
version: 1.0.0
5+
---
6+
7+
# Run NDSCPP Tests
8+
9+
Build the application, start it in the background, run the full test suite, and report the outcome.
10+
11+
## Process
12+
13+
### 1. Verify dependencies
14+
15+
Run the dependency check script from the project root:
16+
17+
```bash
18+
bash .claude/skills/run-tests/scripts/check-deps.sh
19+
```
20+
21+
If any dependencies are missing, the script prints exactly what to install and exits non-zero. Stop and show the user the output — do not proceed until dependencies are satisfied.
22+
23+
### 2. Build the main application
24+
25+
```bash
26+
make
27+
```
28+
29+
If the build fails, show the compiler errors and stop.
30+
31+
### 3. Build the test suite
32+
33+
```bash
34+
make -C tests
35+
```
36+
37+
If this fails, show the errors and stop.
38+
39+
### 4. Start ndscpp in the background
40+
41+
```bash
42+
./ndscpp &
43+
NDSCPP_PID=$!
44+
```
45+
46+
Wait up to 5 seconds for the server to become ready by polling its health endpoint:
47+
48+
```bash
49+
for i in $(seq 1 10); do
50+
curl -sf http://localhost:7777/api/controller >/dev/null 2>&1 && break
51+
sleep 0.5
52+
done
53+
```
54+
55+
If the server hasn't responded after 5 seconds, kill the process, show its output, and stop.
56+
57+
### 5. Run the tests
58+
59+
On Linux:
60+
```bash
61+
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib" ./tests/tests
62+
TEST_EXIT=$?
63+
```
64+
65+
On macOS:
66+
```bash
67+
./tests/tests
68+
TEST_EXIT=$?
69+
```
70+
71+
### 6. Stop the server
72+
73+
```bash
74+
kill $NDSCPP_PID 2>/dev/null
75+
wait $NDSCPP_PID 2>/dev/null
76+
```
77+
78+
Always kill the server, even if the tests failed.
79+
80+
### 7. Report
81+
82+
Exit with `$TEST_EXIT`. Report pass/fail and any failing test names from the GoogleTest output.
83+
84+
## Notes
85+
86+
- The default server port is `7777`. If the config file specifies a different port, adjust the health-check URL accordingly.
87+
- `config.led` and `secrets.h` are auto-created from their `.example` counterparts on the first `make` run — this is expected and not an error.
88+
- On Ubuntu, `cpr` has no apt package and must be built from source (the dependency check script explains how). Once installed, its shared library is at `/usr/local/lib/libcpr.so`, which is why `LD_LIBRARY_PATH` must include `/usr/local/lib`.
89+
- To run a single test: append `--gtest_filter=SuiteName.TestName` to the test binary invocation.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env bash
2+
# Checks that all build and test dependencies are present.
3+
# Exits 0 if everything is in place; exits 1 and prints a diagnosis otherwise.
4+
5+
set -euo pipefail
6+
7+
PLATFORM=$(uname -s)
8+
MISSING_BUILD=()
9+
MISSING_TEST=()
10+
MISSING_CPR_SOURCE=false
11+
12+
check_brew() {
13+
brew list "$1" &>/dev/null || MISSING_BUILD+=("$1")
14+
}
15+
16+
check_brew_test() {
17+
brew list "$1" &>/dev/null || MISSING_TEST+=("$1")
18+
}
19+
20+
check_apt() {
21+
dpkg -s "$1" &>/dev/null || MISSING_BUILD+=("$1")
22+
}
23+
24+
check_apt_test() {
25+
dpkg -s "$1" &>/dev/null || MISSING_TEST+=("$1")
26+
}
27+
28+
if [[ "$PLATFORM" == "Darwin" ]]; then
29+
echo "Platform: macOS"
30+
for pkg in asio ffmpeg ncurses spdlog; do
31+
check_brew "$pkg"
32+
done
33+
check_brew_test googletest
34+
check_brew_test cpr
35+
else
36+
echo "Platform: Linux"
37+
for pkg in libasio-dev zlib1g-dev libavformat-dev libavcodec-dev \
38+
libavutil-dev libswscale-dev libswresample-dev \
39+
libcurl4-gnutls-dev libspdlog-dev; do
40+
check_apt "$pkg"
41+
done
42+
check_apt_test libgtest-dev
43+
check_apt_test cmake
44+
45+
# cpr has no apt package on Ubuntu; cmake installs to /usr/local/lib which
46+
# may not be registered in the ldconfig cache, so check both.
47+
if ! ldconfig -p 2>/dev/null | grep -qE '^\s+libcpr\.so' && \
48+
! ls /usr/local/lib/libcpr.so* &>/dev/null; then
49+
MISSING_CPR_SOURCE=true
50+
fi
51+
fi
52+
53+
RC=0
54+
55+
if [[ ${#MISSING_BUILD[@]} -gt 0 ]]; then
56+
echo ""
57+
echo "MISSING build dependencies: ${MISSING_BUILD[*]}"
58+
if [[ "$PLATFORM" == "Darwin" ]]; then
59+
echo " Install with: brew install ${MISSING_BUILD[*]}"
60+
else
61+
echo " Install with: sudo apt install ${MISSING_BUILD[*]}"
62+
fi
63+
RC=1
64+
fi
65+
66+
if [[ ${#MISSING_TEST[@]} -gt 0 ]]; then
67+
echo ""
68+
echo "MISSING test dependencies: ${MISSING_TEST[*]}"
69+
if [[ "$PLATFORM" == "Darwin" ]]; then
70+
echo " Install with: brew install ${MISSING_TEST[*]}"
71+
else
72+
echo " Install with: sudo apt install ${MISSING_TEST[*]}"
73+
fi
74+
RC=1
75+
fi
76+
77+
if [[ "$MISSING_CPR_SOURCE" == "true" ]]; then
78+
echo ""
79+
echo "MISSING: cpr (C++ Requests library) — no apt package available on Ubuntu."
80+
echo " Build and install it manually:"
81+
echo " git clone https://github.com/libcpr/cpr.git"
82+
echo " cd cpr && mkdir build && cd build"
83+
echo " cmake .. -DCPR_USE_SYSTEM_CURL=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_STANDARD=20"
84+
echo " cmake --build . --parallel"
85+
echo " sudo cmake --install ."
86+
RC=1
87+
fi
88+
89+
if [[ $RC -eq 0 ]]; then
90+
echo ""
91+
echo "All dependencies are present."
92+
fi
93+
94+
exit $RC

.github/workflows/CI.yml

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up dependencies (Linux)
2727
if: matrix.os == 'ubuntu-latest'
2828
run: |
29-
sudo apt-get update
29+
sudo apt-get update
3030
sudo apt-get install -y libasio-dev zlib1g-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libswresample-dev libcurl4-gnutls-dev libspdlog-dev libgtest-dev
3131
git clone https://github.com/libcpr/cpr.git
3232
cd cpr && mkdir build && cd build
@@ -46,35 +46,10 @@ jobs:
4646
4747
- name: Run tests
4848
# For the API tests, we start ndscpp in the background and then run the tests.
49-
# Killing ndscpp is a bit rude and technically unnecessary, but we've been
49+
# Killing ndscpp is a bit rude and technically unnecessary, but we've been
5050
# raised to clean up after ourselves, so that's what we do.
5151
run: |
5252
./ndscpp > /dev/null 2>&1 &
5353
sleep 1
5454
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib ./tests/tests
5555
sudo killall -9 ndscpp
56-
57-
build-web:
58-
59-
runs-on: ubuntu-latest
60-
61-
defaults:
62-
run:
63-
working-directory: ndsweb
64-
65-
steps:
66-
- name: Checkout repository
67-
uses: actions/checkout@v6
68-
69-
- name: Set up Node.js
70-
uses: actions/setup-node@v6
71-
with:
72-
node-version: '20'
73-
cache: 'npm'
74-
cache-dependency-path: ndsweb/package-lock.json
75-
76-
- name: Install dependencies
77-
run: npm install --legacy-peer-deps
78-
79-
- name: Build ndsweb
80-
run: npx nx build

.vscode/c_cpp_properties.json

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

.vscode/launch.json

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

.vscode/settings.json

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

0 commit comments

Comments
 (0)