-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.19 KB
/
cd.yml
File metadata and controls
70 lines (60 loc) · 2.19 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
name: CD
on:
push:
branches: [main]
# Streamlit Community Cloud escucha push a main y despliega automáticamente.
# Este workflow añade un smoke-test antes de que eso ocurra: verifica que la
# app arranca, responde en el puerto 8501 y devuelve HTTP 200 en /healthz.
jobs:
smoke-test:
if: false
runs-on: ubuntu-latest
needs: [] # ejecutar independientemente de CI (ya lo pasó para llegar a main)
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install production dependencies
run: pip install -r requirements.txt
- name: Start Streamlit (background)
run: |
streamlit run app.py \
--server.headless true \
--server.port 8501 &
echo "Streamlit PID: $!"
- name: Wait for app to be ready
run: |
for i in $(seq 1 20); do
if curl -sf http://localhost:8501/healthz > /dev/null 2>&1; then
echo "App lista en intento $i"
exit 0
fi
echo "Intento $i/20 — esperando..."
sleep 2
done
echo "La app no respondió a tiempo"
exit 1
- name: Verify home page responds
run: curl -sf http://localhost:8501/ -o /dev/null
# ── Nota sobre el despliegue ────────────────────────────────────────────────
# Streamlit Community Cloud (https://share.streamlit.io/) detecta el push a
# main y despliega automáticamente sin configuración adicional en este workflow.
#
# Para despliegues en otras plataformas (Docker, Kubernetes, etc.):
#
# docker:
# runs-on: ubuntu-latest
# needs: smoke-test
# steps:
# - uses: actions/checkout@v4
# - uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_TOKEN }}
# - uses: docker/build-push-action@v5
# with:
# push: true
# tags: usuario/dashboard-ventas:latest