Skip to content

Add CI-only timeout headroom, retries, and video capture #261

Add CI-only timeout headroom, retries, and video capture

Add CI-only timeout headroom, retries, and video capture #261

Workflow file for this run

name: CI pipeline
on:
push:
branches:
- main
- 'release/**'
- develop
- 'feature/**'
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
comment:
description: "Purpose of the manual run:"
required: false
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@1a6d90ebcb0e6a6b1d87e37ba693fe453195ae25
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
test:
name: Cypress
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup environment
run: |
cp .env.example .env
sed -i.bak '/^DEMO_DATASET=/d;/^BE_TAG=/d;/^FE_TAG=/d;/^SECRET_KEY=/d' .env
rm -f .env.bak
echo 'SECRET_KEY=cypressci' >> .env
echo 'DEMO_DATASET=true' >> .env
echo 'DB_TAG=25.04' >> .env
echo 'BE_TAG=develop' >> .env
echo 'FE_TAG=develop' >> .env
echo 'DOMAIN=localhost' >> .env
echo 'HOSTS=localhost' >> .env
# CI resource tuning: GitHub-hosted ubuntu-latest is 2 vCPU / 7 GB RAM,
# which is too tight for 3 Celery workers alongside Postgres, OpenSearch,
# RabbitMQ, Redis, backend, frontend and Cypress. Cap workers at 1 here.
echo 'WORKER_REPLICAS=1' >> .env
cp .env.openSearch.example .env.openSearch
docker compose up -d
echo "Waiting for 'Starting Django...' in backend logs..."
BACKEND_CONTAINER=$(docker compose ps -q backend)
for i in {1..30}; do
if docker logs $BACKEND_CONTAINER 2>&1 | grep -q "Starting Django..."; then
echo "Server is ready"
exit 0
fi
echo "Not ready yet... retry $i/30"
docker logs --tail 50 $BACKEND_CONTAINER || true
sleep 10
done
echo "Server did not start in 5 minutes"
docker logs $BACKEND_CONTAINER || true
exit 1
- name: Capture resource baseline
if: always()
run: |
echo "=== free -m ==="
free -m
echo "=== nproc ==="
nproc
echo "=== docker compose ps ==="
docker compose ps
echo "=== docker stats (single snapshot) ==="
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}"
- name: Cypress run
uses: cypress-io/github-action@b8ba51a856ba5f4c15cf39007636d4ab04f23e3c
with:
record: false
parallel: false
wait-on: 'http://localhost/front/'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Capture resource snapshot after Cypress
if: always()
run: |
echo "=== free -m ==="
free -m
echo "=== docker stats (single snapshot) ==="
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}" || true
echo "=== backend log tail ==="
docker compose logs --tail=80 backend || true
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-artifacts
path: |
cypress/screenshots/**
cypress/videos/**
cypress/reports/**