Alice — an open-source AI trading bot covering equities, crypto, commodities, forex, and macro
Add demo container setup and smoke tests to CI
Cameron “Camo” De Vries committed
Nov 6, 2026 at 10:03 UTC
af131103172e6c33f69467bbf5fdebd421f2450f
1 file changed
+28
.github/workflows/ci.yml
+28
@@ -41,3 +41,31 @@ jobs:
41
with:
42
name: coverage-report
43
path: htmlcov/
44
+
45
+ demo-container:
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+ - name: Build existing CLI/test image
50
+ run: docker build -t alice-cli .
51
+ - name: Test existing image (override alice entrypoint)
52
+ run: docker run --rm --entrypoint pytest alice-cli tests/ -q
53
+ - name: Build broker-free demo image
54
+ run: docker build -f Dockerfile.demo -t alice-demo .
55
+ - name: Start and smoke-test demo container
56
+ shell: bash
57
+ run: |
58
+ set -euo pipefail
59
+ docker run -d --name alice-demo -p 127.0.0.1:8080:8080 alice-demo
60
+ trap 'docker logs alice-demo; docker rm -f alice-demo' EXIT
61
+ for i in {1..30}; do
62
+ if curl -fsS http://127.0.0.1:8080/ > /tmp/dashboard.html; then break; fi
63
+ sleep 1
64
+ done
65
+ grep -q 'Alice Trading Dashboard' /tmp/dashboard.html
66
+ curl -fsS http://127.0.0.1:8080/api/account | python -c 'import json,sys; d=json.load(sys.stdin); assert d["connected"] is False and "no saved login" in d["error"]'
67
+ status=$(curl -sS -o /tmp/live.json -w '%{http_code}' -H 'Content-Type: application/json' -d '{"symbol":"EURUSD","side":"buy","volume":0.01,"live":true}' http://127.0.0.1:8080/api/order)
68
+ test "$status" = 403
69
+ python -c 'import json; d=json.load(open("/tmp/live.json")); assert d["ok"] is False and "Demo mode" in d["message"]'
70
+ curl -fsS -H 'Content-Type: application/json' -d '{"symbol":"EURUSD","side":"buy","volume":0.01,"live":false}' http://127.0.0.1:8080/api/order | python -c 'import json,sys; d=json.load(sys.stdin); assert d["ok"] is True and "DRY RUN" in d["message"]'
71
+ docker exec alice-demo python -c 'import os; from open_alice.broker import load_credentials; assert os.getenv("ALICE_DEMO") == "1"; assert os.geteuid() != 0; assert load_credentials() is None'