1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/.github/workflows/web-ci.yaml
jbpratt 08153b6660 chore: CI runtime improvements (#4586)
* chore: update ci to use new large ubuntu 24.04 runner

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-Authored-By: Dave O'Connor <doconnor@redhat.com>

* fix: add libfreetype6-dev for Ubuntu 24.04 compatibility

The reportlab package requires FreeType development headers to build.
On Ubuntu 24.04, this dependency is not pulled in transitively and
must be explicitly installed. This fixes the "cannot find ft2build.h"
build error.

Added libfreetype6-dev to all jobs that install system dependencies
in CI.yaml and CI-nightly.yaml workflows.

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-Authored-By: Dave O'Connor <doconnor@redhat.com>

* chore: set the TEST_DATETIME to a static value

this caused an issue in xdist when generating test names

Signed-off-by: Brady Pratt <bpratt@redhat.com>

* chore: cache pip packages in CI

Signed-off-by: Brady Pratt <bpratt@redhat.com>

* chore: run registry tests with -n auto

Signed-off-by: Brady Pratt <bpratt@redhat.com>

* chore: run psql with -n auto

Signed-off-by: Brady Pratt <bpratt@redhat.com>

* chore: add file locking to prevent parallel test db init race condition

When running pytest -n auto with multiple workers, both workers would
simultaneously execute populate_database(), causing duplicate key
violations on shared tables like imagestoragelocation:

Worker 1: Check if User "devtable" exists → No → Start populating
Worker 2: Check if User "devtable" exists → No → Start populating
Both: INSERT INTO imagestoragelocation (name) VALUES ('local_eu')
Result: IntegrityError - duplicate key violation

Solution: Wrap init_db_path fixture with FileLock to ensure only one
worker initializes the database at a time. The lock file is created
in pytest's shared temp directory, coordinating across all workers.

- First worker acquires lock and populates database
- Subsequent workers wait at lock, then see database is already
  populated (via User.get() check in populate_database())
- Works for both PostgreSQL and MySQL
- 300-second timeout prevents deadlocks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: run mysql with -n auto

Signed-off-by: Brady Pratt <bpratt@redhat.com>

---------

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-authored-by: Dave O'Connor <doconnor@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-20 09:01:18 -05:00

135 lines
3.4 KiB
YAML

name: Web CI
on:
push:
branches:
- "!dependabot/*"
- "*"
pull_request:
branches:
- "*"
jobs:
cypress:
name: Cypress Tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Build
env:
DOCKER_BUILDKIT: 1
run: docker build -t localhost/quay-local:latest .
- name: Start Quay
run: |
docker compose up -d redis quay-db
docker exec -t quay-db bash -c 'while ! pg_isready; do echo "waiting for postgres"; sleep 2; done'
DOCKER_USER="1001:0" docker compose up -d --no-build quay
- name: Checkout
uses: actions/checkout@v3
- name: Seed Database
run: cd web && npm run quay:seed
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
cache: 'pip'
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest requests
- name: Integration Test
run: |
docker restart quay-quay
sleep 30
make integration-test
- name: Apply extra config options
run: |
cat web/cypress/test/extra-config.yaml >> local-dev/stack/config.yaml
docker restart quay-quay
sleep 30
- name: Set up Node.js with npm caching
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: chrome
build: npm run build
start: npm run start:integration
wait-on: 'http://localhost:9000'
wait-on-timeout: 120
working-directory: web
env:
REACT_QUAY_APP_API_URL: http://localhost:8080
- name: Save PR number
if: always() && github.event_name == 'pull_request'
run: |
mkdir -p ./test-results
echo ${{ github.event.pull_request.number }} > ./test-results/pr_number.txt
- name: Upload test results
uses: actions/upload-artifact@v4
if: always() && github.event_name == 'pull_request'
with:
name: test-results
path: |
web/cypress/reports/ctrf-report.json
test-results/pr_number.txt
- name: Create report
run: |
mkdir -p logs/
docker ps -a >logs/container-status.txt 2>&1 || true
docker logs quay-quay >logs/quay.log 2>&1 || true
docker logs quay-db >logs/quay-db.log 2>&1 || true
docker logs quay-redis >logs/redis.log 2>&1 || true
if: failure()
- name: Upload debugging artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-debug
path: |
web/cypress/screenshots
web/cypress/videos
logs/
frontend-plugin:
name: Build Frontend Plugin
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js with npm caching
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install dependencies
run: cd web && npm install
- name: Build plugin
run: cd web && npm run build-plugin