-
-
Notifications
You must be signed in to change notification settings - Fork 33
180 lines (158 loc) · 5.55 KB
/
source-and-docs-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
on:
push:
paths-ignore:
- ".github/dependabot.yml"
- ".github/workflows/lint.yml"
- ".github/workflows/test.yml"
- ".pre-commit-config.yaml"
- ".ruff.toml"
- "README.md"
- "tests/**"
pull_request:
paths-ignore:
- ".github/dependabot.yml"
- ".github/workflows/lint.yml"
- ".github/workflows/test.yml"
- ".pre-commit-config.yaml"
- ".ruff.toml"
- "README.md"
- "tests/**"
workflow_dispatch:
inputs:
git_remote:
type: choice
description: "Git remote to checkout"
options:
- python
- hugovk
- 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"
# Set from inputs for workflow_dispatch, or set defaults to test push/PR events
env:
GIT_REMOTE: ${{ github.event.inputs.git_remote || 'python' }}
GIT_COMMIT: ${{ github.event.inputs.git_commit || 'f6650f9ad73359051f3e558c2431a109bc016664' }}
CPYTHON_RELEASE: ${{ github.event.inputs.cpython_release || '3.12.3' }}
jobs:
verify-input:
runs-on: ubuntu-24.04
outputs:
# Needed because env vars are not available in the build-docs check below
cpython_release: ${{ env.CPYTHON_RELEASE }}
steps:
- name: "Workflow run information"
run: |
echo "git_remote: $GIT_REMOTE"
echo "git_commit: $GIT_COMMIT"
echo "cpython_release: $CPYTHON_RELEASE"
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
repository: "${{ env.GIT_REMOTE }}/cpython"
ref: "v${{ env.CPYTHON_RELEASE }}"
path: "cpython"
- name: "Verify CPython commit matches tag"
run: |
if [[ "$GIT_COMMIT" != "$(cd cpython && git rev-parse HEAD)" ]]; then
echo "expected git commit ('$GIT_COMMIT') didn't match tagged commit ('$(git rev-parse HEAD)')"
exit 1
fi
build-source:
runs-on: ubuntu-24.04
needs:
- verify-input
steps:
- name: "Checkout python/release-tools"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
repository: "${{ env.GIT_REMOTE }}/cpython"
ref: "v${{ env.CPYTHON_RELEASE }}"
path: "cpython"
- name: "Setup Python"
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12
- name: "Install source dependencies"
run: |
python -m pip install --no-deps \
-r requirements.txt
- name: "Build Python release artifacts"
run: |
cd cpython
python ../release.py --export "$CPYTHON_RELEASE" --skip-docs
- name: "Upload the source artifacts"
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: source
path: |
cpython/${{ env.CPYTHON_RELEASE }}/src
build-docs:
runs-on: ubuntu-24.04
needs:
- verify-input
# Docs aren't built for alpha or beta releases.
if: (!(contains(needs.verify-input.outputs.cpython_release, 'a') || contains(needs.verify-input.outputs.cpython_release, 'b')))
steps:
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
repository: "${{ env.GIT_REMOTE }}/cpython"
ref: "v${{ env.CPYTHON_RELEASE }}"
- name: "Setup Python"
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12
- name: "Install docs dependencies"
run: |
python -m pip install \
-r 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 docs"
run: |
cd Doc
SPHINXOPTS="-j10" make dist
- name: "Upload the docs artifacts"
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: docs
path: |
Doc/dist/
test-source:
runs-on: ubuntu-24.04
needs:
- build-source
steps:
- name: "Download the source artifacts"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: source
- name: "Test Python source tarballs"
run: |
mkdir -p ./tmp/installation/
cp "Python-$CPYTHON_RELEASE.tgz" ./tmp/
cd tmp/
tar xvf "Python-$CPYTHON_RELEASE.tgz"
cd "Python-$CPYTHON_RELEASE"
./configure "--prefix=$(realpath '../installation/')"
make -j
make install -j
cd ../installation
./bin/python3 -m test -uall