2019-12-16 18:35:22 +00:00
|
|
|
name: Docs
|
|
|
|
|
|
|
|
on:
|
2023-05-28 15:21:29 +00:00
|
|
|
workflow_call:
|
2021-10-21 20:34:18 +00:00
|
|
|
workflow_dispatch:
|
2019-12-16 18:35:22 +00:00
|
|
|
|
2022-05-21 07:55:21 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-10-08 19:21:38 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2024-08-31 14:15:44 +00:00
|
|
|
env:
|
|
|
|
FORCE_COLOR: 1
|
|
|
|
|
2019-12-16 18:35:22 +00:00
|
|
|
jobs:
|
|
|
|
build_doc:
|
|
|
|
name: 'Docs'
|
|
|
|
runs-on: ubuntu-latest
|
2023-04-14 09:01:10 +00:00
|
|
|
timeout-minutes: 60
|
2023-08-19 00:43:28 +00:00
|
|
|
env:
|
|
|
|
branch_base: 'origin/${{ github.event.pull_request.base.ref }}'
|
|
|
|
branch_pr: 'origin/${{ github.event.pull_request.head.ref }}'
|
|
|
|
refspec_base: '+${{ github.event.pull_request.base.sha }}:remotes/origin/${{ github.event.pull_request.base.ref }}'
|
|
|
|
refspec_pr: '+${{ github.event.pull_request.head.sha }}:remotes/origin/${{ github.event.pull_request.head.ref }}'
|
2019-12-16 18:35:22 +00:00
|
|
|
steps:
|
2023-08-19 00:43:28 +00:00
|
|
|
- name: 'Check out latest PR branch commit'
|
2023-09-04 20:36:16 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-08-19 00:43:28 +00:00
|
|
|
with:
|
2024-08-14 12:05:39 +00:00
|
|
|
ref: >-
|
|
|
|
${{
|
|
|
|
github.event_name == 'pull_request'
|
|
|
|
&& github.event.pull_request.head.sha
|
|
|
|
|| ''
|
|
|
|
}}
|
2023-08-19 00:43:28 +00:00
|
|
|
# Adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
|
|
|
|
- name: 'Fetch commits to get branch diff'
|
2024-08-14 12:05:39 +00:00
|
|
|
if: github.event_name == 'pull_request'
|
2023-08-19 00:43:28 +00:00
|
|
|
run: |
|
|
|
|
# Fetch enough history to find a common ancestor commit (aka merge-base):
|
|
|
|
git fetch origin ${{ env.refspec_pr }} --depth=$(( ${{ github.event.pull_request.commits }} + 1 )) \
|
|
|
|
--no-tags --prune --no-recurse-submodules
|
|
|
|
|
|
|
|
# This should get the oldest commit in the local fetched history (which may not be the commit the PR branched from):
|
|
|
|
COMMON_ANCESTOR=$( git rev-list --first-parent --max-parents=0 --max-count=1 ${{ env.branch_pr }} )
|
|
|
|
DATE=$( git log --date=iso8601 --format=%cd "${COMMON_ANCESTOR}" )
|
|
|
|
|
|
|
|
# Get all commits since that commit date from the base branch (eg: master or main):
|
|
|
|
git fetch origin ${{ env.refspec_base }} --shallow-since="${DATE}" \
|
|
|
|
--no-tags --prune --no-recurse-submodules
|
2022-06-15 07:56:16 +00:00
|
|
|
- name: 'Set up Python'
|
2024-01-01 09:25:58 +00:00
|
|
|
uses: actions/setup-python@v5
|
2022-06-15 07:56:16 +00:00
|
|
|
with:
|
|
|
|
python-version: '3'
|
|
|
|
cache: 'pip'
|
|
|
|
cache-dependency-path: 'Doc/requirements.txt'
|
|
|
|
- name: 'Install build dependencies'
|
|
|
|
run: make -C Doc/ venv
|
|
|
|
|
2023-07-22 08:12:43 +00:00
|
|
|
# To annotate PRs with Sphinx nitpicks (missing references)
|
|
|
|
- name: 'Build HTML documentation'
|
2023-03-24 11:23:35 +00:00
|
|
|
continue-on-error: true
|
|
|
|
run: |
|
2023-06-21 10:42:59 +00:00
|
|
|
set -Eeuo pipefail
|
2023-07-22 08:12:43 +00:00
|
|
|
# Build docs with the '-n' (nit-picky) option; write warnings to file
|
2024-04-29 19:41:59 +00:00
|
|
|
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going -w sphinx-warnings.txt" html
|
2023-07-22 08:12:43 +00:00
|
|
|
- name: 'Check warnings'
|
|
|
|
if: github.event_name == 'pull_request'
|
2023-03-24 11:23:35 +00:00
|
|
|
run: |
|
2023-07-22 08:12:43 +00:00
|
|
|
python Doc/tools/check-warnings.py \
|
2023-08-19 00:43:28 +00:00
|
|
|
--annotate-diff '${{ env.branch_base }}' '${{ env.branch_pr }}' \
|
2023-07-22 08:12:43 +00:00
|
|
|
--fail-if-regression \
|
2024-05-20 19:31:38 +00:00
|
|
|
--fail-if-improved \
|
|
|
|
--fail-if-new-news-nit
|
2023-03-24 11:23:35 +00:00
|
|
|
|
2023-04-27 18:27:38 +00:00
|
|
|
# This build doesn't use problem matchers or check annotations
|
|
|
|
build_doc_oldest_supported_sphinx:
|
|
|
|
name: 'Docs (Oldest Sphinx)'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
2023-09-04 20:36:16 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-27 18:27:38 +00:00
|
|
|
- name: 'Set up Python'
|
2024-01-01 09:25:58 +00:00
|
|
|
uses: actions/setup-python@v5
|
2023-04-27 18:27:38 +00:00
|
|
|
with:
|
2024-04-26 10:10:16 +00:00
|
|
|
python-version: '3.12' # known to work with Sphinx 6.2.1
|
2023-04-27 18:27:38 +00:00
|
|
|
cache: 'pip'
|
|
|
|
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
|
|
|
|
- name: 'Install build dependencies'
|
|
|
|
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
|
|
|
|
- name: 'Build HTML documentation'
|
|
|
|
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
|
|
|
|
|
2022-06-15 07:56:16 +00:00
|
|
|
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
|
|
|
|
doctest:
|
|
|
|
name: 'Doctest'
|
|
|
|
runs-on: ubuntu-latest
|
2023-04-14 09:01:10 +00:00
|
|
|
timeout-minutes: 60
|
2022-06-15 07:56:16 +00:00
|
|
|
steps:
|
2023-09-04 20:36:16 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-02-01 10:49:07 +00:00
|
|
|
- uses: actions/cache@v4
|
2022-06-15 07:56:16 +00:00
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: ubuntu-doc-${{ hashFiles('Doc/requirements.txt') }}
|
|
|
|
restore-keys: |
|
|
|
|
ubuntu-doc-
|
2020-01-17 23:44:38 +00:00
|
|
|
- name: 'Install Dependencies'
|
|
|
|
run: sudo ./.github/workflows/posix-deps-apt.sh && sudo apt-get install wamerican
|
|
|
|
- name: 'Configure CPython'
|
|
|
|
run: ./configure --with-pydebug
|
|
|
|
- name: 'Build CPython'
|
2020-02-26 19:21:41 +00:00
|
|
|
run: make -j4
|
2019-12-16 18:35:22 +00:00
|
|
|
- name: 'Install build dependencies'
|
2020-01-17 23:44:38 +00:00
|
|
|
run: make -C Doc/ PYTHON=../python venv
|
2021-12-09 23:02:20 +00:00
|
|
|
# Use "xvfb-run" since some doctest tests open GUI windows
|
|
|
|
- name: 'Run documentation doctest'
|
2022-07-30 22:21:08 +00:00
|
|
|
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="-W --keep-going" doctest
|