-
Notifications
You must be signed in to change notification settings - Fork 356
206 lines (176 loc) · 6.34 KB
/
Copy pathrender.yml
File metadata and controls
206 lines (176 loc) · 6.34 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: render
on:
workflow_call:
secrets:
SLACK_WEBHOOK_URL:
required: false
env:
NOTIFY: ${{ github.ref_name == 'staging' }}
STAGING: ${{ github.ref_name == 'staging' }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
CACHE_KEY_SUFFIX: ${{ github.run_id }}-${{ github.run_attempt }}
FPS_METRICS_CACHE_KEY: fps-metrics-${{ github.ref_name }}
FE_COVERAGE_CACHE_KEY: fe-coverage-p-${{ github.ref_name }}
jobs:
render:
runs-on: gpu
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set render env
run: scripts/ci/export-render-env
- name: Set up CI
uses: ./.github/actions/setup-ci
with:
rails-env: production
- name: Set render service hosts
run: |
runner_ip=$(ip route get 1.1.1.1 | awk '{for (i=1; i<=NF; i++) if ($i == "src") {print $(i+1); exit}}')
echo "Runner IP: $runner_ip"
sed -i "s/^API_HOST=.*/API_HOST=$runner_ip/" .env
sed -i "s/^MQTT_HOST=.*/MQTT_HOST=$runner_ip/" .env
sudo docker compose run --rm web bundle exec rails runner RmqConfigWriter.render
- name: Start services
run: |
sudo docker compose up -d
sudo docker compose ps
- name: Install playwright
run: |
curl -fsSL https://bun.sh/install | bash
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
export PLAYWRIGHT_BROWSERS_PATH=/tmp/playwright-browsers
echo "BUN_INSTALL=$BUN_INSTALL" >> "$GITHUB_ENV"
echo "$BUN_INSTALL/bin" >> "$GITHUB_PATH"
echo "PLAYWRIGHT_BROWSERS_PATH=$PLAYWRIGHT_BROWSERS_PATH" >> "$GITHUB_ENV"
bunx playwright install chromium --with-deps
- name: Set up GPU
run: |
sudo modprobe nvidia || true
sudo modprobe nvidia_uvm || true
ls -la /dev/nvidia* || true
nvidia-smi
- name: Wait for load
run: |
for i in $(seq 1 90); do
if curl -fsS "http://127.0.0.1:3000/promo" >/dev/null; then
echo "web is up"
exit 0
fi
sleep 2
done
echo "web did not become ready"
exit 1
- name: Wait for MQTT auth
run: |
admin_password=$(awk -F= '/^ADMIN_PASSWORD=/{print $2; exit}' .env)
for i in $(seq 1 90); do
if timeout 5s sudo docker compose exec -T mqtt rabbitmqctl authenticate_user admin "$admin_password" >/dev/null; then
echo "mqtt auth is up"
exit 0
fi
sleep 2
done
echo "mqtt auth did not become ready"
exit 1
- name: Restore metric history
id: restore_metric_history
run: |
scripts/ci/git-restore-artifact-branch-file "$SCENE_METRICS_NAME*.csv"
if compgen -G "/tmp/$SCENE_METRICS_NAME*.csv" >/dev/null; then
echo "scene_metrics_found=true" >> "$GITHUB_OUTPUT"
fi
- name: Restore fps history
id: restore_fps_history
run: |
scripts/ci/git-restore-artifact-branch-file "$FPS_HISTORY.csv"
if compgen -G "/tmp/$FPS_HISTORY.csv" >/dev/null; then
echo "fps_history_found=true" >> "$GITHUB_OUTPUT"
fi
- name: Restore FPS metrics
if: steps.restore_metric_history.outputs.scene_metrics_found != 'true'
uses: actions/cache/restore@v5
with:
path: |
/tmp/${{ env.SCENE_METRICS_NAME }}*.csv
key: ${{ env.FPS_METRICS_CACHE_KEY }}-${{ env.CACHE_KEY_SUFFIX }}
restore-keys: |
${{ env.FPS_METRICS_CACHE_KEY }}-
- name: Restore frontend coverage value
if: always()
uses: actions/cache/restore@v5
with:
path: /tmp/${{ env.FE_COVERAGE_NAME }}.csv
key: ${{ env.FE_COVERAGE_CACHE_KEY }}-${{ env.CACHE_KEY_SUFFIX }}
restore-keys: |
${{ env.FE_COVERAGE_CACHE_KEY }}-
- name: Restore frontend coverage history fallback
if: always()
run: |
[ -f "/tmp/$FE_COVERAGE_NAME.csv" ] && exit 0
scripts/ci/git-restore-artifact-branch-file "$FE_COVERAGE_NAME.csv"
- name: Run playwright
run: scripts/ci/run-playwright-render
- name: Track FPS value
run: scripts/ci/track-fps-history
- name: Plot metric CSVs
if: always()
run: |
for csv in /tmp/*.csv; do
[ -f "$csv" ] || continue
bun scripts/metric_plot.js "$csv"
done
- name: Combine plots
if: always()
run: |
bun scripts/ci/combine-render-images
- name: Save FPS metrics
uses: actions/cache/save@v5
with:
path: |
/tmp/${{ env.SCENE_METRICS_NAME }}*.csv
key: ${{ env.FPS_METRICS_CACHE_KEY }}-${{ env.CACHE_KEY_SUFFIX }}
- name: View values
if: always()
run: |
echo $FPS_VALUE
echo $SCENE_METRICS
- name: Send notification
if: env.NOTIFY == 'true'
run: scripts/ci/send-notification "${FPS_VALUE} fps (${PERCENT_CHANGE}% change)"
- name: Upload image artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: images
path: |
/tmp/*.png
if-no-files-found: warn
- name: Upload csv artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: scene-metrics-csv
path: |
/tmp/*.csv
if-no-files-found: warn
- name: On failure
if: failure()
run: |
sudo docker compose ps || true
sudo docker compose logs --no-color --tail=500 || true
- name: Publish image links
if: success() && env.STAGING == 'true'
run: scripts/ci/git-publish-render-artifacts
- name: Send notification
if: success() && env.NOTIFY == 'true'
run: |
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
if [ -n "${RENDER_SUMMARY_URLS:-}" ]; then
for URL in $RENDER_SUMMARY_URLS; do
NAME="$(basename "$URL" .png)"
scripts/ci/send-notification "<$URL|$NAME>"
done
else
scripts/ci/send-notification "<$RUN_URL|render summary>"
fi