Repository navigation
Add link-new-tab flag to card / grid-item-card directives #935
This file contains hidden or 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: continuous-integration | |
| on: | |
| push: | |
| branches: [main] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.11" | |
| - uses: pre-commit/action@v3.0.1 | |
| tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ["3.11", "3.12", "3.13", "3.14"] | |
| sphinx-version: ["~=7.0", "~=8.0", "~=9.0"] | |
| extras: ["testing"] | |
| include: | |
| - os: windows-latest | |
| python-version: "3.11" | |
| sphinx-version: "~=7.0" | |
| extras: "testing" | |
| - os: windows-latest | |
| python-version: "3.13" | |
| sphinx-version: "~=8.0" | |
| extras: "testing" | |
| - os: windows-latest | |
| python-version: "3.14" | |
| sphinx-version: "~=9.0" | |
| extras: "testing" | |
| runs-on: ${{ matrix.os }} | |
| name: Tests (py${{ matrix.python-version }}, Sphinx${{ matrix.sphinx-version }}, on ${{ matrix.os }}) | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade "sphinx${{ matrix.sphinx-version }}" -e .[${{ matrix.extras}}] | |
| - name: Run pytest | |
| run: | | |
| pytest --cov=sphinx_design --cov-report=xml --cov-report=term-missing | |
| - name: Upload to Codecov | |
| if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' && matrix.python-version == '3.13' && matrix.sphinx-version == '~=8.0' && matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| name: pytests | |
| flags: pytests | |
| files: ./coverage.xml | |
| # coverage is informational: an upload failure must not fail CI | |
| fail_ci_if_error: false | |
| docs-build-format: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| format: [html, latex, man] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[rtd] | |
| - name: Install SVG conversion tools (for sphinx.ext.imgconverter) | |
| if: matrix.format == 'latex' | |
| run: sudo apt-get update -q && sudo apt-get install -y -q --no-install-recommends imagemagick librsvg2-bin | |
| - name: Build documentation | |
| run: sphinx-build -nW --keep-going -b ${{ matrix.format }} docs/ docs/_build/${{ matrix.format }} | |
| docs-build-pdf: | |
| # compiling the LaTeX sources catches what the sphinx build alone cannot: | |
| # missing LaTeX packages and icon names unknown to fontawesome5.sty | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[rtd] | |
| - name: Install SVG conversion tools (for sphinx.ext.imgconverter) | |
| run: sudo apt-get update -q && sudo apt-get install -y -q --no-install-recommends imagemagick librsvg2-bin | |
| - name: Build LaTeX sources | |
| run: sphinx-build -nW --keep-going -b latex docs/ docs/_build/latex | |
| - name: Compile PDF | |
| uses: xu-cheng/latex-action@v4 | |
| with: | |
| # TeX Live 2026's colortbl loops with Sphinx <9.1.1 table colorrows | |
| # (sphinx-doc/sphinx#14465) — drop this pin once on sphinx >=9.1.1 | |
| texlive_version: "2025" | |
| working_directory: docs/_build/latex | |
| root_file: sphinxdesign.tex | |
| - name: Upload PDF | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: docs-pdf | |
| path: docs/_build/latex/sphinxdesign.pdf | |
| build: | |
| # builds with the project's own [build-system] backend pin, the same way a release does, | |
| # so a packaging problem shows up on the PR rather than when a tag is pushed | |
| name: Build distributions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.13" | |
| - name: Install build tools | |
| run: python -m pip install --upgrade build twine | |
| - name: Build sdist and wheel | |
| run: python -m build | |
| - name: Check the distributions | |
| run: python -m twine check --strict dist/* | |
| - name: Check the tag matches the built version | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| # compares parsed versions, so a tag such as v0.8.0-rc1 matches the normalized 0.8.0rc1; | |
| # packaging is installed with build and twine | |
| shell: python | |
| run: | | |
| import os, pathlib, sys | |
| from packaging.version import InvalidVersion, Version | |
| ref = os.environ["GITHUB_REF_NAME"] | |
| try: | |
| tag = Version(ref.removeprefix("v")) | |
| except InvalidVersion: | |
| sys.exit(f"tag {ref} is not a valid version") | |
| dist = pathlib.Path("dist") | |
| versions = {p.name.split("-")[1] for p in dist.glob("*.whl")} | |
| versions |= {p.name.removesuffix(".tar.gz").rsplit("-", 1)[1] for p in dist.glob("*.tar.gz")} | |
| if not versions or {Version(v) for v in versions} != {tag}: | |
| sys.exit(f"tag {ref} does not match the built version(s) {sorted(versions)}") | |
| print(f"tag {ref} matches the built version(s) {sorted(versions)}") | |
| - name: Upload the distributions | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist | |
| path: dist/ | |
| if-no-files-found: error | |
| retention-days: 7 | |
| # https://github.com/marketplace/actions/alls-green#why | |
| check: # This job does nothing and is only used for the branch protection | |
| if: always() | |
| needs: | |
| - pre-commit | |
| - tests | |
| - docs-build-format | |
| - docs-build-pdf | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} | |
| publish: | |
| # PyPI trusted publishing: the PyPI publisher is registered for this workflow file (ci.yml) | |
| # and the `pypi` environment, so do not rename either | |
| name: Publish to PyPI | |
| # `check` fails when any job it needs fails, so every job gating a merge also gates a release; | |
| # `build` is listed too because it produces the `dist` artifact this job uploads | |
| needs: [check, build] | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/sphinx-design | |
| permissions: | |
| id-token: write # the only permission this job has | |
| steps: | |
| - name: Download the distributions | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dist | |
| path: dist/ | |
| # uploads attestations by default | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |