2019-12-16 14:35:22 -04:00
|
|
|
name: Docs
|
|
|
|
|
|
|
|
on:
|
2023-05-28 12:21:29 -03:00
|
|
|
workflow_call:
|
2021-10-21 17:34:18 -03:00
|
|
|
workflow_dispatch:
|
2019-12-16 14:35:22 -04:00
|
|
|
|
2022-05-21 04:55:21 -03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-10-08 16:21:38 -03:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2019-12-16 14:35:22 -04:00
|
|
|
jobs:
|
|
|
|
build_doc:
|
|
|
|
name: 'Docs'
|
|
|
|
runs-on: ubuntu-latest
|
2023-04-14 06:01:10 -03:00
|
|
|
timeout-minutes: 60
|
2023-08-18 21:43:28 -03: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 14:35:22 -04:00
|
|
|
steps:
|
2023-08-18 21:43:28 -03:00
|
|
|
- name: 'Check out latest PR branch commit'
|
2023-09-04 17:36:16 -03:00
|
|
|
uses: actions/checkout@v4
|
2023-08-18 21:43:28 -03:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
# Adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
|
|
|
|
- name: 'Fetch commits to get branch diff'
|
|
|
|
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 04:56:16 -03:00
|
|
|
- name: 'Set up Python'
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3'
|
|
|
|
cache: 'pip'
|
|
|
|
cache-dependency-path: 'Doc/requirements.txt'
|
|
|
|
- name: 'Install build dependencies'
|
|
|
|
run: make -C Doc/ venv
|
|
|
|
|
2023-07-22 05:12:43 -03:00
|
|
|
# To annotate PRs with Sphinx nitpicks (missing references)
|
|
|
|
- name: 'Build HTML documentation'
|
2023-03-24 08:23:35 -03:00
|
|
|
continue-on-error: true
|
|
|
|
run: |
|
2023-06-21 07:42:59 -03:00
|
|
|
set -Eeuo pipefail
|
2023-07-22 05:12:43 -03:00
|
|
|
# Build docs with the '-n' (nit-picky) option; write warnings to file
|
|
|
|
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going -w sphinx-warnings.txt" html
|
|
|
|
- name: 'Check warnings'
|
|
|
|
if: github.event_name == 'pull_request'
|
2023-03-24 08:23:35 -03:00
|
|
|
run: |
|
2023-07-22 05:12:43 -03:00
|
|
|
python Doc/tools/check-warnings.py \
|
2023-08-18 21:43:28 -03:00
|
|
|
--annotate-diff '${{ env.branch_base }}' '${{ env.branch_pr }}' \
|
2023-07-22 05:12:43 -03:00
|
|
|
--fail-if-regression \
|
|
|
|
--fail-if-improved
|
2023-03-24 08:23:35 -03:00
|
|
|
|
2023-04-27 15:27:38 -03: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 17:36:16 -03:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-27 15:27:38 -03:00
|
|
|
- name: 'Set up Python'
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
2023-09-21 03:06:36 -03:00
|
|
|
python-version: '3.11' # known to work with Sphinx 4.2
|
2023-04-27 15:27:38 -03: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 04:56:16 -03: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 06:01:10 -03:00
|
|
|
timeout-minutes: 60
|
2022-06-15 04:56:16 -03:00
|
|
|
steps:
|
2023-09-04 17:36:16 -03:00
|
|
|
- uses: actions/checkout@v4
|
2022-06-15 04:56:16 -03:00
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: ubuntu-doc-${{ hashFiles('Doc/requirements.txt') }}
|
|
|
|
restore-keys: |
|
|
|
|
ubuntu-doc-
|
2020-01-17 19:44:38 -04: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 15:21:41 -04:00
|
|
|
run: make -j4
|
2019-12-16 14:35:22 -04:00
|
|
|
- name: 'Install build dependencies'
|
2020-01-17 19:44:38 -04:00
|
|
|
run: make -C Doc/ PYTHON=../python venv
|
2021-12-09 19:02:20 -04:00
|
|
|
# Use "xvfb-run" since some doctest tests open GUI windows
|
|
|
|
- name: 'Run documentation doctest'
|
2022-07-30 19:21:08 -03:00
|
|
|
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="-W --keep-going" doctest
|