summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-02-15 02:10:09 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-02-15 03:10:50 +0000
commitff852bc7c31f48e66100e4647749fc199d92ca79 (patch)
tree6c5f2314fdd941d348d7125f85c8062b13895136
parentbb9821b968388b788e5af7f079b738302416bb9a (diff)
downloadsphinx-git-ff852bc7c31f48e66100e4647749fc199d92ca79.tar.gz
Update GitHub Actions workflows
-rw-r--r--.github/workflows/builddoc.yml16
-rw-r--r--.github/workflows/coverage.yml14
-rw-r--r--.github/workflows/latex.yml17
-rw-r--r--.github/workflows/lint.yml99
-rw-r--r--.github/workflows/lock.yml8
-rw-r--r--.github/workflows/main.yml56
-rw-r--r--.github/workflows/nodejs.yml6
-rw-r--r--.github/workflows/transifex.yml24
-rw-r--r--doc/internals/contributing.rst16
-rw-r--r--tox.ini72
10 files changed, 193 insertions, 135 deletions
diff --git a/.github/workflows/builddoc.yml b/.github/workflows/builddoc.yml
index bb24a82e4..d80a4bafb 100644
--- a/.github/workflows/builddoc.yml
+++ b/.github/workflows/builddoc.yml
@@ -20,9 +20,17 @@ jobs:
with:
python-version: 3
- name: Install dependencies
- run: |
+ run: |
sudo apt update
sudo apt install -y graphviz
- pip install -U tox
- - name: Run Tox
- run: tox -e docs
+ python -m pip install --upgrade pip
+ python -m pip install .[docs]
+ - name: Render the documentation
+ run: >
+ python
+ -X dev
+ -X warn_default_encoding
+ -m sphinx
+ -M html ./doc ./build/sphinx
+ -W
+ --keep-going
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 1db73578c..a3ac27837 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -5,6 +5,9 @@ on: [push]
permissions:
contents: read
+env:
+ FORCE_COLOR: "1"
+
jobs:
coverage:
runs-on: ubuntu-latest
@@ -24,11 +27,16 @@ jobs:
run: sudo apt-get install graphviz
- name: Install dependencies
- run: python -m pip install -U pip tox pytest-cov
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install .[test] pytest-cov
- - name: Run Tox
- run: tox -e py -- -vv
+ - name: Test with pytest
+ run: python -m pytest -vv
env:
+ PYTHONDEVMODE: "1" # -X dev
+ PYTHONWARNDEFAULTENCODING: "1" # -X warn_default_encoding
+ PYTHONWARNINGS: "always" # -W always
PYTEST_ADDOPTS: "--cov ./ --cov-append --cov-config pyproject.toml"
VIRTUALENV_SYSTEM_SITE_PACKAGES: "1"
diff --git a/.github/workflows/latex.yml b/.github/workflows/latex.yml
index b61d5598e..1eaeccaa9 100644
--- a/.github/workflows/latex.yml
+++ b/.github/workflows/latex.yml
@@ -16,7 +16,7 @@ jobs:
container:
image: ghcr.io/sphinx-doc/sphinx-ci
env:
- DO_EPUBCHECK: 1
+ DO_EPUBCHECK: "1"
steps:
- name: Alias python3 to python
run: ln -s /usr/bin/python3 /usr/bin/python
@@ -24,6 +24,15 @@ jobs:
- name: Check Python version
run: python --version
- name: Install dependencies
- run: pip install -U pip tox
- - name: Run Tox
- run: tox -e py -- -vv
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install .[test]
+ - name: Test with pytest
+ run: >
+ python
+ -X dev
+ -X warn_default_encoding
+ -m pytest
+ -vv
+ --color yes
+ --durations 25
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 60be3701d..bbcf14233 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -10,15 +10,11 @@ concurrency:
cancel-in-progress: true
env:
- FORCE_COLOR: 1
+ FORCE_COLOR: "1"
jobs:
- build:
+ ruff:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- tool: [docslint, flake8, isort, mypy, twine]
steps:
- uses: actions/checkout@v3
@@ -27,11 +23,13 @@ jobs:
with:
python-version: 3
- name: Install dependencies
- run: python -m pip install -U tox pip
- - name: Run Tox
- run: tox -e ${{ matrix.tool }}
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install --upgrade ruff
+ - name: Lint with Ruff
+ run: ruff . --diff --format github
- ruff:
+ flake8:
runs-on: ubuntu-latest
steps:
@@ -41,8 +39,81 @@ jobs:
with:
python-version: 3
- name: Install dependencies
- run: |
+ run: |
python -m pip install --upgrade pip
- python -m pip install --upgrade ruff
- - name: Lint with Ruff
- run: ruff . --diff --format github
+ python -m pip install --upgrade "flake8>=3.5.0" "flake8-simplify"
+ - name: Lint with flake8
+ run: flake8 .
+
+ isort:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: 3
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install --upgrade isort
+ - name: Lint with isort
+ run: isort --check-only --diff .
+
+ mypy:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: 3
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install --upgrade "mypy>=0.990" docutils-stubs types-requests
+ - name: Type check with mypy
+ run: mypy sphinx/
+
+ docs-lint:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: 3
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install --upgrade sphinx-lint
+ - name: Lint documentation with sphinx-lint
+ run: >
+ sphinx-lint
+ --enable line-too-long
+ --max-line-length 85
+ CHANGES
+ CONTRIBUTING.rst
+ README.rst
+ doc/
+
+ twine:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: 3
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install --upgrade twine build
+ - name: Lint with twine
+ run: |
+ python -m build .
+ twine check dist/*
diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml
index e24c068d1..d86f4b362 100644
--- a/.github/workflows/lock.yml
+++ b/.github/workflows/lock.yml
@@ -1,8 +1,8 @@
-name: 'Lock old threads'
+name: Lock old threads
on:
schedule:
- - cron: '0 0 * * *'
+ - cron: "0 0 * * *"
permissions:
issues: write
@@ -16,5 +16,5 @@ jobs:
- uses: dessant/lock-threads@v3
with:
github-token: ${{ github.token }}
- issue-inactive-days: '30'
- pr-inactive-days: '30'
+ issue-inactive-days: "30"
+ pr-inactive-days: "30"
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ae2c7ab27..108e5d83e 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -9,10 +9,16 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
+env:
+ FORCE_COLOR: "1"
+ PYTHONDEVMODE: "1" # -X dev
+ PYTHONWARNDEFAULTENCODING: "1" # -X warn_default_encoding
+ PYTHONWARNINGS: "always" # -W always
+
jobs:
ubuntu:
runs-on: ubuntu-latest
- name: Python ${{ matrix.python }} (${{ matrix.docutils }})
+ name: Python ${{ matrix.python }} (Docutils ${{ matrix.docutils }})
strategy:
fail-fast: false
matrix:
@@ -23,9 +29,8 @@ jobs:
- "3.11"
- "3.12-dev"
docutils:
- - "du18"
- - "du19"
- - "du-latest"
+ - "0.18"
+ - "0.19"
steps:
- uses: actions/checkout@v3
@@ -44,12 +49,18 @@ jobs:
- name: Install graphviz
run: sudo apt-get install graphviz
- name: Install dependencies
- run: python -m pip install -U pip tox
- - name: Run Tox
- run: tox -e ${{ matrix.docutils }} -- -vv
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install .[test]
+ - name: Install Docutils ${{ matrix.docutils }}
+ run: python -m pip install --upgrade "docutils==${{ matrix.docutils }}.*"
+ - name: Test with pytest
+ run: python -m pytest -vv --durations 25
windows:
runs-on: windows-2019
+ name: Windows
+
steps:
- uses: actions/checkout@v3
- name: Set up Python
@@ -57,6 +68,31 @@ jobs:
with:
python-version: 3
- name: Install dependencies
- run: python -m pip install -U pip tox
- - name: Run Tox
- run: tox -e py -- -vv
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install .[test]
+ - name: Test with pytest
+ run: python -m pytest -vv --durations 25
+
+ docutils-latest:
+ runs-on: ubuntu-latest
+ name: Docutils HEAD
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python 3
+ uses: actions/setup-python@v4
+ with:
+ python-version: "3"
+ - name: Check Python version
+ run: python --version
+ - name: Install graphviz
+ run: sudo apt-get install graphviz
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install .[test]
+ - name: Install Docutils' HEAD
+ run: python -m pip install git+https://repo.or.cz/docutils.git\#subdirectory=docutils
+ - name: Test with pytest
+ run: python -m pytest -vv
diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml
index f66be63e5..184d33211 100644
--- a/.github/workflows/nodejs.yml
+++ b/.github/workflows/nodejs.yml
@@ -13,7 +13,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
- node-version: 16
+ node-version: "16"
steps:
- uses: actions/checkout@v3
@@ -24,6 +24,4 @@ jobs:
cache: "npm"
- run: npm install
- name: Run headless test
- uses: GabrielBB/xvfb-action@v1
- with:
- run: npm test
+ run: xvfb-run -a npm test
diff --git a/.github/workflows/transifex.yml b/.github/workflows/transifex.yml
index 263622d02..68d68d28a 100644
--- a/.github/workflows/transifex.yml
+++ b/.github/workflows/transifex.yml
@@ -22,15 +22,15 @@ jobs:
with:
python-version: 3.9 # https://github.com/transifex/transifex-client/pull/330
- name: Install dependencies
- run: pip install -U babel jinja2 transifex-client
+ run: pip install -U babel jinja2 transifex-client
- name: Install Sphinx
- run: pip install .
+ run: pip install .
- name: Extract translations from source code
- run: python utils/babel_runner.py extract
+ run: python utils/babel_runner.py extract
- name: Push translations to transifex.com
- run: cd sphinx/locale && tx push -s --no-interactive --parallel
+ run: cd sphinx/locale && tx push -s --no-interactive --parallel
env:
- TX_TOKEN: ${{ secrets.TX_TOKEN }}
+ TX_TOKEN: "${{ secrets.TX_TOKEN }}"
pull:
permissions:
@@ -48,21 +48,21 @@ jobs:
with:
python-version: 3.9 # https://github.com/transifex/transifex-client/pull/330
- name: Install dependencies
- run: pip install -U babel jinja2 transifex-client
+ run: pip install -U babel jinja2 transifex-client
- name: Install Sphinx
- run: pip install .
+ run: pip install .
- name: Extract translations from source code
- run: python utils/babel_runner.py extract
+ run: python utils/babel_runner.py extract
- name: Pull translations to transifex.com
- run: cd sphinx/locale && tx pull -a -f --no-interactive --parallel
+ run: cd sphinx/locale && tx pull -a -f --no-interactive --parallel
env:
- TX_TOKEN: ${{ secrets.TX_TOKEN }}
+ TX_TOKEN: "${{ secrets.TX_TOKEN }}"
- name: Compile message catalogs
- run: python utils/babel_runner.py compile
+ run: python utils/babel_runner.py compile
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
- commit-message: 'Update message catalogs'
+ commit-message: "Update message catalogs"
branch: bot/pull-translations
title: Update message catalogs
labels: i18n
diff --git a/doc/internals/contributing.rst b/doc/internals/contributing.rst
index 6d5279f9e..a8753dddc 100644
--- a/doc/internals/contributing.rst
+++ b/doc/internals/contributing.rst
@@ -154,10 +154,10 @@ Please follow these guidelines when writing code for Sphinx:
* Add appropriate unit tests.
-Style and type checks can be run using ``tox``::
+Style and type checks can be run as follows::
- tox -e mypy
- tox -e flake8
+ ruff .
+ mypy sphinx/
Unit tests
~~~~~~~~~~
@@ -252,13 +252,9 @@ documentation, as well as key aspects of a few different tools that we use.
Build the documentation
~~~~~~~~~~~~~~~~~~~~~~~
-We use `the tox tool <https://tox.wiki/en/latest/>`__ to quickly build the
-documentation. Tox is kind-of like a Makefile, but includes the ability to
-install an isolated environment used to run each task.
+To build the documentation, run the following command::
-To build the documentation with ``tox``, run the following command::
-
- tox -e docs
+ sphinx-build -M html ./doc ./build/sphinx -W --keep-going
This will parse the Sphinx documentation's source files and generate HTML for
you to preview in ``build/sphinx/html``.
@@ -267,7 +263,7 @@ You can also build a **live version of the documentation** that you can preview
in the browser. It will detect changes and reload the page any time you make
edits. To do so, run the following command::
- tox -e docs-live
+ sphinx-autobuild ./doc ./build/sphinx/
Translations
~~~~~~~~~~~~
diff --git a/tox.ini b/tox.ini
index 657479953..487b07537 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
minversion = 2.4.0
-envlist = docs,flake8,mypy,twine,py{38,39,310,311,312},du{18,19,-latest}
+envlist = py{38,39,310,311,312}
isolated_build = True
[testenv]
@@ -18,12 +18,6 @@ passenv =
TERM
description =
py{38,39,310,311,312}: Run unit tests against {envname}.
- du{18,19}: Run unit tests with the given version of docutils.
- du-latest: Run unit tests with Docutils' HEAD
-deps =
- du18: docutils==0.18.*
- du19: docutils==0.19.*
- du-latest: git+https://repo.or.cz/docutils.git\#subdirectory=docutils
extras =
test
setenv =
@@ -32,48 +26,6 @@ setenv =
commands=
python -X dev -X warn_default_encoding -m pytest --durations 25 {posargs}
-[testenv:flake8]
-basepython = python3
-description =
- Run style checks.
-whitelist_externals =
- flake8
-extras =
- lint
-commands =
- flake8 {posargs}
-
-[testenv:ruff]
-basepython = python3
-description =
- Run style checks with ruff.
-whitelist_externals =
- ruff
-extras =
- lint
-commands =
- ruff {posargs}
-
-[testenv:isort]
-basepython = python3
-description =
- Run import sorting checks.
-whitelist_externals =
- isort
-extras =
- lint
-commands =
- isort --check-only --diff .
-
-[testenv:mypy]
-basepython = python3
-description =
- Run type checks.
-extras =
- lint
-commands=
- mypy sphinx/
-
[testenv:docs]
basepython = python3
description =
@@ -81,16 +33,7 @@ description =
extras =
docs
commands =
- python -X dev -X warn_default_encoding -m sphinx -M html ./doc ./build/sphinx -W --keep-going
-
-[testenv:docslint]
-basepython = python3
-description =
- Lint documentation.
-extras =
- lint
-commands =
- sphinx-lint --enable line-too-long --max-line-length 85 CHANGES CONTRIBUTING.rst README.rst doc/
+ sphinx-build -M html ./doc ./build/sphinx -W --keep-going
[testenv:docs-live]
basepython = python3
@@ -103,17 +46,6 @@ deps =
commands =
sphinx-autobuild ./doc ./build/sphinx/
-[testenv:twine]
-basepython = python3
-description =
- Lint package.
-deps =
- twine
- build
-commands =
- python -m build .
- twine check dist/*
-
[testenv:bindep]
description =
Install binary dependencies.