Skip to content

Commit d565fdb

Browse files
committed
Fix CI/CD: Change test server ports to avoid conflicts
1 parent b20151a commit d565fdb

7 files changed

Lines changed: 139 additions & 15 deletions

File tree

.github/workflows/README.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# GitHub Actions CI/CD Workflow
2+
3+
## Overview
4+
5+
This workflow runs automated tests for the datastar-cl SDK on every commit, pull request, and monthly schedule.
6+
7+
## Workflow: `sdk-test.yml`
8+
9+
### What It Does
10+
11+
1. **Installs dependencies**
12+
- Roswell (Common Lisp implementation manager)
13+
- SBCL (Steel Bank Common Lisp)
14+
- libev-dev (required for Woo server)
15+
- golang-go (required for official Datastar test suite)
16+
17+
2. **Starts test servers** (in background)
18+
- Port 48331: Hunchentoot backend
19+
- Port 48332: Clack+Woo backend
20+
- Port 48333: Clack+Hunchentoot backend
21+
22+
3. **Waits for servers** to be ready (health checks on all 3 ports)
23+
24+
4. **Runs SDK compliance tests** using official Datastar test suite
25+
26+
5. **Runs SSE macro tests** to verify long-lived connections work correctly
27+
28+
6. **Cleans up** (kills SBCL process)
29+
30+
### Triggers
31+
32+
- **Push**: Every commit to any branch
33+
- **Pull Request**: When PRs are opened or updated
34+
- **Manual**: Via GitHub Actions UI (`workflow_dispatch`)
35+
- **Scheduled**: First day of each month at midnight UTC
36+
37+
### How It Works
38+
39+
The workflow uses a **simple sequential approach**:
40+
41+
```
42+
Start SBCL with servers → Wait for health checks → Run tests → Cleanup
43+
```
44+
45+
This is simpler than previous approaches that used complex third-party actions or Docker containers.
46+
47+
### Key Files
48+
49+
- `.github/workflows/sdk-test.yml` - GitHub Actions workflow definition
50+
- `tests/run.lisp` - Script that loads the system and starts all servers
51+
- `tests/run-sdk-tests.sh` - Shell script to run official Datastar SDK tests
52+
- `tests/run-sse-tests.sh` - Shell script to test SSE connection macros
53+
54+
### Running Locally
55+
56+
To reproduce the CI environment locally:
57+
58+
```bash
59+
# Start servers (in background)
60+
sbcl --non-interactive --load tests/run.lisp &
61+
SBCL_PID=$!
62+
63+
# Wait for servers
64+
for port in 48331 48332 48333; do
65+
while ! curl -f -s http://localhost:$port/ > /dev/null 2>&1; do
66+
echo "Waiting for port $port..."
67+
sleep 2
68+
done
69+
done
70+
71+
# Run tests
72+
./tests/run-sdk-tests.sh
73+
./tests/run-sse-tests.sh
74+
75+
# Cleanup
76+
kill $SBCL_PID
77+
```
78+
79+
### Troubleshooting
80+
81+
**Servers fail to start:**
82+
- Check SBCL logs in GitHub Actions output
83+
- Ensure all dependencies are installed (libev-dev for Woo)
84+
- Verify ports 48331-48333 are not already in use
85+
86+
**Health check timeout:**
87+
- Default timeout is 60 seconds (30 checks × 2 seconds)
88+
- Check if `tests/run.lisp` properly calls `start-all-servers`
89+
- Verify each server has a root endpoint that responds
90+
91+
**SDK tests fail:**
92+
- Check if Go is properly installed
93+
- Verify internet connectivity (downloads Datastar test suite)
94+
- Review test output for specific failures
95+
96+
**SSE tests fail:**
97+
- Ensure `curl` is available
98+
- Check timeout settings in `run-sse-tests.sh`
99+
- Verify servers are properly handling SSE connections
100+
101+
### Design Decision: Why This Approach?
102+
103+
We chose this **simple sequential approach** over alternatives because:
104+
105+
**Simple**: No complex third-party actions or Docker containers
106+
**Transparent**: Easy to understand and debug
107+
**Reproducible**: Same commands work locally and in CI
108+
**Fast**: No image building or complex setup
109+
**Maintainable**: Standard shell commands, no hidden complexity
110+
111+
Other approaches considered (and rejected):
112+
- **Docker containers**: Overkill, slower, more complex
113+
- **Background action**: Third-party dependency, harder to debug
114+
- **Service containers**: Requires image registry, complex setup
115+
- **Matrix testing**: Higher CI costs, unnecessary parallelization
116+
117+
### Monitoring
118+
119+
View workflow runs at: `https://github.com/YOUR_ORG/datastar-cl/actions`
120+
121+
Scheduled runs help detect:
122+
- Breaking changes in dependencies (SBCL, libraries)
123+
- Breaking changes in Datastar test suite
124+
- Bit rot or platform issues

.github/workflows/sdk-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
4545
- name: Wait for all servers to be ready
4646
run: |
47-
echo "Waiting for test servers on ports 7331, 7332, 7333..."
48-
for port in 7331 7332 7333; do
47+
echo "Waiting for test servers on ports 48331, 48332, 48333..."
48+
for port in 48331 48332 48333; do
4949
echo "Checking port $port..."
5050
for i in {1..30}; do
5151
if curl -f -s http://localhost:$port/ > /dev/null 2>&1; then

tests/run-sdk-tests.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
# Can be run locally or in CI/CD.
55
#
66
# Usage:
7-
# ./run-sdk-tests.sh # Test all ports (7331, 7332, 7333)
8-
# SDK_TEST_PORTS="7331" ./run-sdk-tests.sh # Test specific port(s)
7+
# ./run-sdk-tests.sh # Test all ports (48331, 48332, 48333)
8+
# SDK_TEST_PORTS="48331" ./run-sdk-tests.sh # Test specific port(s)
99

1010
set -e
1111

1212
# Default to all three backend configurations
13-
PORTS="${SDK_TEST_PORTS:-7331 7332 7333}"
13+
PORTS="${SDK_TEST_PORTS:-48331 48332 48333}"
1414

1515
# Backend names for display
1616
declare -A BACKEND_NAMES
17-
BACKEND_NAMES[7331]="Hunchentoot"
18-
BACKEND_NAMES[7332]="Clack+Woo"
19-
BACKEND_NAMES[7333]="Clack+Hunchentoot"
17+
BACKEND_NAMES[48331]="Hunchentoot"
18+
BACKEND_NAMES[48332]="Clack+Woo"
19+
BACKEND_NAMES[48333]="Clack+Hunchentoot"
2020

2121
echo ""
2222
echo "* Running Datastar SDK Compliance Tests *"

tests/run-sse-tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ echo "* Testing SSE Macro with All Backends *"
4949
echo ""
5050
echo "Note: Testing multiple sequential connections ensures proper cleanup"
5151
echo " (prevents worker thread leaks that cause connection hangs)"
52-
echo
52+
echo
5353
echo "Timeout:" ${timeout_interval} "s"
5454
# Test all backends
55-
test_sse_endpoint 7331 "Hunchentoot" "ht-sse"
56-
test_sse_endpoint 7332 "Clack+Woo" "clack-woo-sse"
57-
test_sse_endpoint 7333 "Clack+Hunchentoot" "clack-ht-sse"
55+
test_sse_endpoint 48331 "Hunchentoot" "ht-sse"
56+
test_sse_endpoint 48332 "Clack+Woo" "clack-woo-sse"
57+
test_sse_endpoint 48333 "Clack+Hunchentoot" "clack-ht-sse"
5858

5959
# If we're here, nothing failed
6060
echo ""

tests/test-clack-hunchentoot.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
(in-package #:datastar-cl-tests)
66

77

8-
(defparameter *clack-hunchentoot-http-port* 7333 "Port in which to listen")
8+
(defparameter *clack-hunchentoot-http-port* 48333 "Port in which to listen")
99
(defvar *clack-hunchentoot-handler* nil
1010
"Clack+Hunchentoot server handler instance")
1111

tests/test-clack.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
(in-package #:datastar-cl-tests)
66

77

8-
(defparameter *clack-http-port* 7332 "Port in which to listen")
8+
(defparameter *clack-http-port* 48332 "Port in which to listen")
99
(defvar *clack-handler* nil
1010
"Clack server handler instance")
1111

tests/test-hunchentoot.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
(in-package #:datastar-cl-tests)
66

7-
(defparameter *hunchentoot-http-port* 7331 "Port in which to listen")
7+
(defparameter *hunchentoot-http-port* 48331 "Port in which to listen")
88

99
(defvar *server*
1010
"Hunchentoot server instance")

0 commit comments

Comments
 (0)