Skip to content

Build Python source and docs artifacts #1

Build Python source and docs artifacts

Build Python source and docs artifacts #1

on:
workflow_dispatch:
inputs:
git_remote:
type: choice
description: "Git remote to checkout"
options:
- python
- Yhg1s
- pablogsal
- ambv
git_commit:
type: string
description: "Git commit to target for the release. Must use the full commit SHA, not the short ID"
cpython_release:
type: string
description: "CPython release number (ie '3.11.5', note without the 'v' prefix)"
name: "Build Python source and docs artifacts"
jobs:
source-and-docs:
runs-on: ubuntu-22.04
steps:
- name: "Checkout python/release-tools"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: "Checkout ${{ inputs.git_remote }}/cpython"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: "${{ inputs.git_remote }}/cpython"
ref: "v${{ inputs.cpython_release }}"
path: "cpython"
- name: "Verify CPython commit matches tag"
run: |
if [[ "${{ inputs.git_commit }}" != "$(cd cpython && git rev-parse HEAD)" ]]; then
echo "expected git commit ('${{ inputs.git_commit }}') didn't match tagged commit ('$(git rev-parse HEAD)')"
exit 1
fi
- name: "Setup Python"
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.11
- name: "Install source dependencies"
run: |
python -m pip install --no-deps \
-r requirements.txt
- name: "Install docs dependencies"
# Docs aren't built for alpha or beta releases.
if: ${{ !(contains(inputs.cpython_release, 'a') || contains(inputs.cpython_release, 'b')) }}
run: |
python -m pip install \
-r cpython/Doc/requirements.txt
sudo apt-get update
sudo apt-get install --yes --no-install-recommends \
latexmk texlive-xetex xindy texinfo texlive-latex-base \
texlive-fonts-recommended texlive-fonts-extra \
texlive-full
- name: "Build Python release artifacts"
run: |
cd cpython
python ../release.py --export ${{ inputs.cpython_release }}
- name: "Test Python source tarballs"
run: |
mkdir -p ./tmp/installation/
cp cpython/${{ inputs.cpython_release }}/src/Python-${{ inputs.cpython_release }}.tgz ./tmp/
cd tmp/
tar xvf Python-${{ inputs.cpython_release }}.tgz
cd Python-${{ inputs.cpython_release }}
./configure --prefix=$(realpath '../installation/')
make -j
make install -j
cd ../installation
./bin/python3 -m test -uall
- name: "Upload the source artifacts"
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: source
path: |
cpython/${{ inputs.cpython_release }}/src
- name: "Upload the docs artifacts"
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
# Conditionally run this step if there is a 'docs/' directory.
# Docs aren't built for alpha or beta releases.
if: ${{ hashFiles('cpython/${{ inputs.cpython_release }}/docs') != '' }}
with:
name: docs
path: |
cpython/${{ inputs.cpython_release }}/docs