wagtail/.circleci/config.yml

158 wiersze
4.8 KiB
YAML
Czysty Wina Historia

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

version: 2
jobs:
backend:
docker:
- image: cimg/python:3.12
steps:
- checkout
- restore_cache:
key: &venv-cache venv-v1-{{ checksum "setup.py" }}
# Only install if .venv wasnt cached.
- run: |
if [[ ! -e ".venv" ]]; then
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .[testing,docs]
fi
echo "source $(pwd)/.venv/bin/activate" >> $BASH_ENV
- save_cache:
key: *venv-cache
paths:
- .venv
- run: ruff check .
- run: ruff format --check .
- run: semgrep --config .semgrep.yml --error .
- run: git ls-files '*.html' | xargs djhtml --check
- run: curlylint --parse-only wagtail
- run: doc8 docs
- run:
name: Run tests
command: |
export PYTHONUNBUFFERED=1
WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT=1 python -u runtests.py --parallel=2
frontend:
docker:
- image: cimg/node:22.11
steps:
- checkout
- restore_cache:
key: frontend-v1-{{ checksum "package-lock.json" }}
# Only install if node_modules wasnt cached.
- run: |
if [[ ! -e "node_modules" ]]; then
npm install --no-save --no-optional --no-audit --no-fund --progress=false
fi
- save_cache:
paths:
- node_modules
key: frontend-v1-{{ checksum "package-lock.json" }}
- run: npm run build
# Save static files for subsequent jobs.
- persist_to_workspace:
root: ~/project
paths:
- wagtail
- run: npm run build-storybook
- run: npm run lint:js
- run: npm run lint:css
- run: npm run lint:format
- run: npm run test:unit:coverage -- --runInBand
- run: bash <(curl -s https://codecov.io/bash) -F frontend
ui_tests:
docker:
- image: cimg/python:3.12-browsers
environment:
DJANGO_SETTINGS_MODULE: wagtail.test.settings_ui
DJANGO_DEBUG: 'true'
steps:
- checkout
- attach_workspace:
at: ~/project
- restore_cache:
key: &ui_tests-venv-cache ui_tests-venv-v1-{{ checksum "setup.py" }}
# Only install if .venv wasnt cached.
- run: |
if [[ ! -e ".venv" ]]; then
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .[testing]
fi
echo "source $(pwd)/.venv/bin/activate" >> $BASH_ENV
- save_cache:
key: *ui_tests-venv-cache
paths:
- .venv
- restore_cache:
key: &ui_tests-npm-cache ui_tests-npm_integration-v3-{{ checksum "client/tests/integration/package-lock.json" }}
# Only install if node_modules wasnt cached.
- run: |
if [[ ! -e "client/tests/integration/node_modules" ]]; then
npm --prefix ./client/tests/integration ci
fi
- save_cache:
key: *ui_tests-npm-cache
paths:
- client/tests/integration/node_modules
# Also cache the global location where Puppeteer stores browsers.
# https://pptr.dev/guides/configuration/#changing-the-default-cache-directory
- ~/.cache/puppeteer
- run: ./wagtail/test/manage.py migrate
- run:
command: ./wagtail/test/manage.py runserver 0:8000
background: true
- run: ./wagtail/test/manage.py createcachetable
- run:
command: ./wagtail/test/manage.py createsuperuser --noinput
environment:
DJANGO_SUPERUSER_EMAIL: admin@example.com
DJANGO_SUPERUSER_USERNAME: admin
DJANGO_SUPERUSER_PASSWORD: changeme
- run:
command: npm run test:integration -- --runInBand --reporters=default --reporters=jest-junit
environment:
JEST_JUNIT_OUTPUT_DIR: reports/jest
- run:
command: ./wagtail/test/manage.py collectstatic --noinput
environment:
DJANGO_DEBUG: 'false'
STATICFILES_STORAGE: manifest
- store_test_results:
path: ./reports/jest
nightly-build:
docker:
- image: cimg/python:3.12-node
steps:
- checkout
- run: pip install --user wheel boto3
- run: npm install
- run: npm run build
- run: PYTHONPATH=. python scripts/nightly/get_version.py > __init__.py
- run: mv __init__.py wagtail/__init__.py
- run: python setup.py bdist_wheel
- run: python scripts/nightly/upload.py
workflows:
version: 2
test:
jobs:
- backend
- frontend
- ui_tests:
requires:
- frontend
nightly:
jobs:
- nightly-build
triggers:
- schedule:
cron: '0 0 * * *'
filters:
branches:
only:
- main