Skip to content

Improve handling of non-string values for 'override_tag's 'default_html' argument #270

Improve handling of non-string values for 'override_tag's 'default_html' argument

Improve handling of non-string values for 'override_tag's 'default_html' argument #270

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install "poetry>=1.1.12,<2"
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'poetry'
- run: pip install tox
- run: tox -e lint,py311-dj42
test_compatibility:
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Test with all supported Django versions, for all compatible Python versions.
# See https://docs.djangoproject.com/en/4.0/faq/install/#what-python-version-can-i-use-with-django for the official matrix.
# Additionally test on Django’s main branch with the most recent Python version.
- python: "3.8"
toxenv: py38-dj32,py38-dj41,py38-dj42
- python: "3.9"
toxenv: py39-dj32,py39-dj41,py39-dj42
- python: "3.10"
# Skip testing Django 4.0, already tested in previous workflow job.
toxenv: py310-dj32,py310-dj41,py310-dj42,py310-djmain
- python: "3.11"
toxenv: py311-dj41,py311-dj42,py311-djmain
# Tentative support for next Python pre-release.
# When django supports the version, uncomment this
# - python: "3.12"
# toxenv: py312-dj41
steps:
- uses: actions/checkout@v4
- run: pipx install "poetry>=1.1.12,<2"
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- run: pip install tox
- run: tox -q
env:
TOXENV: ${{ matrix.toxenv }}
build_site:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- id: node-cache
uses: actions/cache@v3
with:
# Cache node_modules rather than the npm cache, as we rarely update npm packages.
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
- if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci --no-audit
- run: npm run build
- run: pipx install "poetry>=1.1.12,<2"
- uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml
cache: 'poetry'
- run: poetry install
- run: poetry run django-admin runserver --settings=tests.settings.production --pythonpath=. &
# Docs website build.
- run: poetry run mkdocs build --strict
# Demo website build.
- run: wget --mirror --page-requisites --no-parent --no-verbose http://localhost:8000/django-pattern-library/demo/
- run: mv localhost:8000/django-pattern-library/demo site
# Demo render_patterns.
- run: poetry run django-admin render_patterns --settings=tests.settings.production --pythonpath=. --wrap-fragments --output=site/dpl-rendered-patterns 2>&1 >/dev/null | tee dpl-list.txt
# Create an archive of render_patterns output so the build artifacts can be inspected easily.
- run: mv dpl-list.txt site/dpl-rendered-patterns && tar -czvf site/dpl-rendered-patterns.tar.gz site/dpl-rendered-patterns
# Package build, incl. publishing an experimental pre-release via GitHub Pages for builds on `main`.
- run: cat pyproject.toml | awk '{sub(/^version = .+/,"version = \"0.0.0.dev\"")}1' > pyproject.toml.tmp && mv pyproject.toml.tmp pyproject.toml
- run: poetry build
- run: mv dist site
- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
with:
path: site
deploy_site:
needs: build_site
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/deploy-pages@v4