feat: Rendered code view in Template output #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.12" | |
cache: 'poetry' | |
- run: pip install tox | |
- run: tox -e lint,py312-dj50 | |
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/dev/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-dj42 | |
- python: "3.9" | |
toxenv: py39-dj32,py39-dj42 | |
- python: "3.10" | |
toxenv: py310-dj32,py310-dj42,py310-dj50,py310-djmain | |
- python: "3.11" | |
toxenv: py311-dj42,py311-dj50,py311-djmain | |
- python: "3.12" | |
toxenv: py312-dj42,py312-djmain | |
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@v5 | |
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 |