-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.42 KB
/
Copy pathdemo-assets.yml
File metadata and controls
81 lines (69 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Verified Demo Assets
on:
pull_request:
paths:
- "examples/safe-agent-api/**"
- ".github/scripts/capture-demo.mjs"
- ".github/workflows/demo-assets.yml"
workflow_dispatch:
permissions:
contents: read
jobs:
capture:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: examples/safe-agent-api/pyproject.toml
- name: Install Safe Agent API
run: python -m pip install -e "examples/safe-agent-api[dev]"
- name: Start Safe Agent API
run: |
cd examples/safe-agent-api
fastapi run app/main.py --host 127.0.0.1 --port 8000 > /tmp/safe-agent-api.log 2>&1 &
echo $! > /tmp/safe-agent-api.pid
for attempt in {1..30}; do
if curl --fail --silent http://127.0.0.1:8000/health >/dev/null; then
exit 0
fi
sleep 1
done
cat /tmp/safe-agent-api.log
exit 1
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install Playwright Chromium
run: |
npm install --no-save playwright@1.55.0
npx playwright install --with-deps chromium
- name: Capture real Playground interactions
run: node .github/scripts/capture-demo.mjs | tee /tmp/demo-capture.log
- name: Convert recorded interaction to GIF
run: |
video_path="$(find assets/demo-video -type f -name '*.webm' | head -n 1)"
test -n "$video_path"
ffmpeg -y -i "$video_path" \
-vf "fps=8,scale=960:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=128[p];[s1][p]paletteuse=dither=bayer" \
assets/demo/safe-agent-demo.gif
test -s assets/demo/safe-agent-playground.png
test -s assets/demo/safe-agent-demo.gif
- name: Upload verified assets
uses: actions/upload-artifact@v4
with:
name: safe-agent-demo-assets
path: |
assets/demo/safe-agent-playground.png
assets/demo/safe-agent-demo.gif
if-no-files-found: error
retention-days: 14
- name: Show API logs on failure
if: failure()
run: cat /tmp/safe-agent-api.log || true