Skip to content

Commit 9e4e51c

Browse files
authored
Test running "Build Python source and docs artifacts" workflow
1 parent 2a0f332 commit 9e4e51c

File tree

1 file changed

+47
-21
lines changed

1 file changed

+47
-21
lines changed

.github/workflows/source-and-docs-release.yml

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
on:
2+
push:
3+
paths-ignore:
4+
- ".github/dependabot.yml"
5+
- ".github/workflows/lint.yml"
6+
- ".github/workflows/test.yml"
7+
- ".pre-commit-config.yaml"
8+
- ".ruff.toml"
9+
- "README.md"
10+
- "tests/**"
11+
pull_request:
12+
paths-ignore:
13+
- ".github/dependabot.yml"
14+
- ".github/workflows/lint.yml"
15+
- ".github/workflows/test.yml"
16+
- ".pre-commit-config.yaml"
17+
- ".ruff.toml"
18+
- "README.md"
19+
- "tests/**"
220
workflow_dispatch:
321
inputs:
422
git_remote:
@@ -18,27 +36,36 @@ on:
1836

1937
name: "Build Python source and docs artifacts"
2038

39+
# Set from inputs for workflow_dispatch, or set defaults to test push/PR events
40+
env:
41+
GIT_REMOTE: ${{ github.event.inputs.git_remote || 'python' }}
42+
GIT_COMMIT: ${{ github.event.inputs.git_commit || 'f6650f9ad73359051f3e558c2431a109bc016664' }}
43+
CPYTHON_RELEASE: ${{ github.event.inputs.cpython_release || '3.12.3' }}
44+
2145
jobs:
2246
verify-input:
2347
runs-on: ubuntu-22.04
48+
outputs:
49+
# Needed because env vars are not available in the build-docs check below
50+
cpython_release: ${{ env.CPYTHON_RELEASE }}
2451
steps:
2552
- name: "Workflow run information"
2653
run: |
27-
echo "git_remote: ${{ inputs.git_remote }}"
28-
echo "git_commit: ${{ inputs.git_commit }}"
29-
echo "cpython_release: ${{ inputs.cpython_release }}"
54+
echo "git_remote: $GIT_REMOTE"
55+
echo "git_commit: $GIT_COMMIT"
56+
echo "cpython_release: $CPYTHON_RELEASE"
3057
31-
- name: "Checkout ${{ inputs.git_remote }}/cpython"
58+
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
3259
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3360
with:
34-
repository: "${{ inputs.git_remote }}/cpython"
35-
ref: "v${{ inputs.cpython_release }}"
61+
repository: "${{ env.GIT_REMOTE }}/cpython"
62+
ref: "v${{ env.CPYTHON_RELEASE }}"
3663
path: "cpython"
3764

3865
- name: "Verify CPython commit matches tag"
3966
run: |
40-
if [[ "${{ inputs.git_commit }}" != "$(cd cpython && git rev-parse HEAD)" ]]; then
41-
echo "expected git commit ('${{ inputs.git_commit }}') didn't match tagged commit ('$(git rev-parse HEAD)')"
67+
if [[ "$GIT_COMMIT" != "$(cd cpython && git rev-parse HEAD)" ]]; then
68+
echo "expected git commit ('$GIT_COMMIT') didn't match tagged commit ('$(git rev-parse HEAD)')"
4269
exit 1
4370
fi
4471
@@ -50,11 +77,11 @@ jobs:
5077
- name: "Checkout python/release-tools"
5178
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
5279

53-
- name: "Checkout ${{ inputs.git_remote }}/cpython"
80+
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
5481
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
5582
with:
56-
repository: "${{ inputs.git_remote }}/cpython"
57-
ref: "v${{ inputs.cpython_release }}"
83+
repository: "${{ env.GIT_REMOTE }}/cpython"
84+
ref: "v${{ env.CPYTHON_RELEASE }}"
5885
path: "cpython"
5986

6087
- name: "Setup Python"
@@ -70,29 +97,28 @@ jobs:
7097
- name: "Build Python release artifacts"
7198
run: |
7299
cd cpython
73-
python ../release.py --export ${{ inputs.cpython_release }} --skip-docs
100+
python ../release.py --export "$CPYTHON_RELEASE" --skip-docs
74101
75102
- name: "Upload the source artifacts"
76103
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
77104
with:
78105
name: source
79106
path: |
80-
cpython/${{ inputs.cpython_release }}/src
107+
cpython/${{ env.CPYTHON_RELEASE }}/src
81108
82109
build-docs:
83110
runs-on: ubuntu-22.04
84111
needs:
85112
- verify-input
86113

87114
# Docs aren't built for alpha or beta releases.
88-
if: ${{ !(contains(inputs.cpython_release, 'a') || contains(inputs.cpython_release, 'b')) }}
89-
115+
if: (!(contains(needs.verify-input.outputs.cpython_release, 'a') || contains(needs.verify-input.outputs.cpython_release, 'b')))
90116
steps:
91-
- name: "Checkout ${{ inputs.git_remote }}/cpython"
117+
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
92118
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
93119
with:
94-
repository: "${{ inputs.git_remote }}/cpython"
95-
ref: "v${{ inputs.cpython_release }}"
120+
repository: "${{ env.GIT_REMOTE }}/cpython"
121+
ref: "v${{ env.CPYTHON_RELEASE }}"
96122

97123
- name: "Setup Python"
98124
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
@@ -135,10 +161,10 @@ jobs:
135161
- name: "Test Python source tarballs"
136162
run: |
137163
mkdir -p ./tmp/installation/
138-
cp Python-${{ inputs.cpython_release }}.tgz ./tmp/
164+
cp "Python-$CPYTHON_RELEASE.tgz" ./tmp/
139165
cd tmp/
140-
tar xvf Python-${{ inputs.cpython_release }}.tgz
141-
cd Python-${{ inputs.cpython_release }}
166+
tar xvf "Python-$CPYTHON_RELEASE.tgz"
167+
cd "Python-$CPYTHON_RELEASE"
142168
143169
./configure "--prefix=$(realpath '../installation/')"
144170
make -j

0 commit comments

Comments
 (0)