Update CI configuration

- Merge LaTeX and Coverage into the main CI file
- Only run tests when a relevant file changes
- Update ``actions/checkout``
- Set ``-Werror`` only on pytest steps
- Reduce verbosity on the documentation workflow
This commit is contained in:
Adam Turner 2023-09-21 06:54:30 +01:00
parent 3ac143c8bf
commit 9298de548f
9 changed files with 126 additions and 128 deletions

View File

@ -20,15 +20,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install graphviz
run: sudo apt-get install graphviz
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y graphviz
python -m pip install --upgrade pip
python -m pip install .[docs]
- name: Render the documentation
@ -38,5 +38,5 @@ jobs:
-T
-W
--jobs=auto
-vvv
-vv
--keep-going

View File

@ -1,40 +0,0 @@
name: Coverage
on: [push]
permissions:
contents: read
env:
FORCE_COLOR: "1"
jobs:
coverage:
runs-on: ubuntu-latest
if: github.repository_owner == 'sphinx-doc'
steps:
- uses: actions/checkout@v3
- name: Set up Python
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] pytest-cov
- name: Test with pytest
run: python -m pytest -vv --cov . --cov-append --cov-config pyproject.toml
env:
VIRTUALENV_SYSTEM_SITE_PACKAGES: "1"
- name: codecov
uses: codecov/codecov-action@v3

View File

@ -17,11 +17,11 @@ jobs:
permissions:
id-token: write # for PyPI trusted publishing
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
cache: pip
cache-dependency-path: pyproject.toml
@ -75,7 +75,7 @@ jobs:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get release version
id: get_version
uses: actions/github-script@v6

View File

@ -1,38 +0,0 @@
name: CI (LaTeX)
on: [push, pull_request]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
name: Test on LaTeX image
container:
image: ghcr.io/sphinx-doc/sphinx-ci
env:
DO_EPUBCHECK: "1"
steps:
- name: Alias python3 to python
run: ln -s /usr/bin/python3 /usr/bin/python
- uses: actions/checkout@v3
- name: Check Python version
run: python --version
- name: Install dependencies
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

View File

@ -1,6 +1,9 @@
name: Lint source code
on: [push, pull_request]
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
@ -17,34 +20,34 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install pip
run: python -m pip install --upgrade pip
- name: Install known good Ruff
run: python -m pip install ruff==0.0.284
- name: Lint with known good Ruff
run: ruff . --diff --format github
run: ruff . --format github
- name: Install latest Ruff
run: python -m pip install --upgrade ruff
- name: Lint with Ruff
- name: Lint with latest Ruff
continue-on-error: true
run: ruff . --diff --format github
run: ruff . --format github
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@ -56,11 +59,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@ -72,11 +75,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@ -88,11 +91,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@ -113,11 +116,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip

View File

@ -1,6 +1,16 @@
name: CI
on: [push, pull_request]
on:
push:
paths:
- ".github/workflows/main.yml"
- "sphinx/**"
- "tests/**"
pull_request:
paths:
- ".github/workflows/main.yml"
- "sphinx/**"
- "tests/**"
permissions:
contents: read
@ -13,7 +23,6 @@ env:
FORCE_COLOR: "1"
PYTHONDEVMODE: "1" # -X dev
PYTHONWARNDEFAULTENCODING: "1" # -X warn_default_encoding
PYTHONWARNINGS: "error" # default: all warnings as errors
jobs:
ubuntu:
@ -34,7 +43,7 @@ jobs:
- "0.20"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
if: "!endsWith(matrix.python, '-dev')"
@ -45,8 +54,6 @@ jobs:
if: "endsWith(matrix.python, '-dev')"
with:
python-version: ${{ matrix.python }}
env:
PYTHONWARNINGS: ""
- name: Check Python version
run: python --version
- name: Install graphviz
@ -55,41 +62,41 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
env:
PYTHONWARNINGS: ""
- name: Install Docutils ${{ matrix.docutils }}
run: python -m pip install --upgrade "docutils~=${{ matrix.docutils }}.0"
env:
PYTHONWARNINGS: ""
- name: Test with pytest
run: python -m pytest -vv --durations 25
env:
PYTHONWARNINGS: "error" # treat all warnings as errors
windows:
runs-on: windows-2019
name: Windows
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Check Python version
run: python --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
env:
PYTHONWARNINGS: ""
- name: Test with pytest
run: python -m pytest -vv --durations 25
env:
PYTHONWARNINGS: "error" # treat all warnings as errors
docutils-latest:
runs-on: ubuntu-latest
name: Docutils HEAD
steps:
- uses: actions/checkout@v3
- name: Set up Python 3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3"
@ -101,11 +108,61 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
env:
PYTHONWARNINGS: ""
- name: Install Docutils' HEAD
run: python -m pip install git+https://repo.or.cz/docutils.git\#subdirectory=docutils
env:
PYTHONWARNINGS: ""
- name: Test with pytest
run: python -m pytest -vv
env:
PYTHONWARNINGS: "error" # treat all warnings as errors
latex:
runs-on: ubuntu-latest
name: LaTeX
container:
image: ghcr.io/sphinx-doc/sphinx-ci
steps:
- uses: actions/checkout@v4
- name: Set up Python
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: Test with pytest
run: python -m pytest -vv --durations 25
env:
PYTHONWARNINGS: "error" # treat all warnings as errors
DO_EPUBCHECK: "1"
coverage:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository_owner == 'sphinx-doc'
steps:
- uses: actions/checkout@v4
- name: Set up Python
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] pytest-cov
- name: Test with pytest
run: python -m pytest -vv --cov . --cov-append --cov-config pyproject.toml
env:
PYTHONWARNINGS: "error" # treat all warnings as errors
VIRTUALENV_SYSTEM_SITE_PACKAGES: "1"
- name: codecov
uses: codecov/codecov-action@v3

View File

@ -1,6 +1,22 @@
name: CI (node.js)
on: [push, pull_request]
on:
push:
paths:
- ".github/workflows/main.yml"
- "sphinx/themes/**.js"
- "tests/js"
- "karma.conf.js"
- "package.json"
- "package-lock.json"
pull_request:
paths:
- ".github/workflows/main.yml"
- "sphinx/themes/**.js"
- "tests/js"
- "karma.conf.js"
- "package.json"
- "package-lock.json"
permissions:
contents: read
@ -16,7 +32,7 @@ jobs:
node-version: "16"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:

View File

@ -15,11 +15,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install transifex client
run: |
mkdir -p /tmp/tx_cli && cd $_
@ -44,11 +44,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
python-version: "3"
- name: Install transifex client
run: |
mkdir -p /tmp/tx_cli && cd $_

View File

@ -192,7 +192,7 @@ contents:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build HTML
uses: ammaraskar/sphinx-action@master
- name: Upload artifacts