Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f4e950

Browse files
committed
Catch up with main
2 parents cdf8b1d + 624ace5 commit 5f4e950

267 files changed

Lines changed: 21539 additions & 2981 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 47 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ on:
1313
- '3.10'
1414
- '3.9'
1515
- '3.8'
16-
- '3.7'
1716
pull_request:
1817
branches:
1918
- 'main'
@@ -22,7 +21,6 @@ on:
2221
- '3.10'
2322
- '3.9'
2423
- '3.8'
25-
- '3.7'
2624

2725
permissions:
2826
contents: read
@@ -128,14 +126,14 @@ jobs:
128126
if: needs.check_source.outputs.run_tests == 'true'
129127
steps:
130128
- uses: actions/checkout@v4
129+
- uses: actions/setup-python@v4
130+
with:
131+
python-version: '3.x'
131132
- name: Restore config.cache
132133
uses: actions/cache@v3
133134
with:
134135
path: config.cache
135-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
136-
- uses: actions/setup-python@v4
137-
with:
138-
python-version: '3.x'
136+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
139137
- name: Install Dependencies
140138
run: sudo ./.github/workflows/posix-deps-apt.sh
141139
- name: Add ccache to PATH
@@ -180,159 +178,63 @@ jobs:
180178
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
181179
run: make check-c-globals
182180

183-
build_win32:
184-
name: 'Windows (x86)'
185-
runs-on: windows-latest
186-
timeout-minutes: 60
181+
build_windows:
182+
name: 'Windows'
187183
needs: check_source
188184
if: needs.check_source.outputs.run_tests == 'true'
189-
env:
190-
IncludeUwp: 'true'
191-
steps:
192-
- uses: actions/checkout@v4
193-
- name: Build CPython
194-
run: .\PCbuild\build.bat -e -d -p Win32
195-
- name: Display build info
196-
run: .\python.bat -m test.pythoninfo
197-
- name: Tests
198-
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci
185+
uses: ./.github/workflows/reusable-build-windows.yml
199186

200-
build_win_amd64:
201-
name: 'Windows (x64)'
202-
runs-on: windows-latest
203-
timeout-minutes: 60
187+
build_windows_free_threaded:
188+
name: 'Windows (free-threaded)'
204189
needs: check_source
205-
if: needs.check_source.outputs.run_tests == 'true'
206-
env:
207-
IncludeUwp: 'true'
208-
steps:
209-
- uses: actions/checkout@v4
210-
- name: Register MSVC problem matcher
211-
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
212-
- name: Build CPython
213-
run: .\PCbuild\build.bat -e -d -p x64
214-
- name: Display build info
215-
run: .\python.bat -m test.pythoninfo
216-
- name: Tests
217-
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci
218-
219-
build_win_arm64:
220-
name: 'Windows (arm64)'
221-
runs-on: windows-latest
222-
timeout-minutes: 60
223-
needs: check_source
224-
if: needs.check_source.outputs.run_tests == 'true'
225-
env:
226-
IncludeUwp: 'true'
227-
steps:
228-
- uses: actions/checkout@v4
229-
- name: Register MSVC problem matcher
230-
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
231-
- name: Build CPython
232-
run: .\PCbuild\build.bat -e -d -p arm64
190+
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
191+
uses: ./.github/workflows/reusable-build-windows.yml
192+
with:
193+
free-threaded: true
233194

234195
build_macos:
235196
name: 'macOS'
236-
runs-on: macos-latest
237-
timeout-minutes: 60
238197
needs: check_source
239198
if: needs.check_source.outputs.run_tests == 'true'
240-
env:
241-
HOMEBREW_NO_ANALYTICS: 1
242-
HOMEBREW_NO_AUTO_UPDATE: 1
243-
HOMEBREW_NO_INSTALL_CLEANUP: 1
244-
PYTHONSTRICTEXTENSIONBUILD: 1
245-
steps:
246-
- uses: actions/checkout@v4
247-
- name: Restore config.cache
248-
uses: actions/cache@v3
249-
with:
250-
path: config.cache
251-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
252-
- name: Install Homebrew dependencies
253-
run: brew install pkg-config [email protected] xz gdbm tcl-tk
254-
- name: Configure CPython
255-
run: |
256-
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
257-
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
258-
./configure \
259-
--config-cache \
260-
--with-pydebug \
261-
--prefix=/opt/python-dev \
262-
--with-openssl="$(brew --prefix [email protected])"
263-
- name: Build CPython
264-
run: make -j4
265-
- name: Display build info
266-
run: make pythoninfo
267-
- name: Tests
268-
run: make test
199+
uses: ./.github/workflows/reusable-build-macos.yml
200+
with:
201+
config_hash: ${{ needs.check_source.outputs.config_hash }}
202+
203+
build_macos_free_threaded:
204+
name: 'macOS (free-threaded)'
205+
needs: check_source
206+
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
207+
uses: ./.github/workflows/reusable-build-macos.yml
208+
with:
209+
config_hash: ${{ needs.check_source.outputs.config_hash }}
210+
free-threaded: true
269211

270212
build_ubuntu:
271213
name: 'Ubuntu'
272-
runs-on: ubuntu-20.04
273-
timeout-minutes: 60
274214
needs: check_source
275215
if: needs.check_source.outputs.run_tests == 'true'
276-
env:
277-
OPENSSL_VER: 3.0.11
278-
PYTHONSTRICTEXTENSIONBUILD: 1
279-
steps:
280-
- uses: actions/checkout@v4
281-
- name: Register gcc problem matcher
282-
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
283-
- name: Install Dependencies
284-
run: sudo ./.github/workflows/posix-deps-apt.sh
285-
- name: Configure OpenSSL env vars
286-
run: |
287-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
288-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
289-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
290-
- name: 'Restore OpenSSL build'
291-
id: cache-openssl
292-
uses: actions/cache@v3
293-
with:
294-
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
295-
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
296-
- name: Install OpenSSL
297-
if: steps.cache-openssl.outputs.cache-hit != 'true'
298-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
299-
- name: Add ccache to PATH
300-
run: |
301-
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
302-
- name: Configure ccache action
303-
uses: hendrikmuhs/[email protected]
304-
- name: Setup directory envs for out-of-tree builds
305-
run: |
306-
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
307-
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
308-
- name: Create directories for read-only out-of-tree builds
309-
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
310-
- name: Bind mount sources read-only
311-
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
312-
- name: Restore config.cache
313-
uses: actions/cache@v3
314-
with:
315-
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
316-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
317-
- name: Configure CPython out-of-tree
318-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
319-
run: |
216+
uses: ./.github/workflows/reusable-build-ubuntu.yml
217+
with:
218+
config_hash: ${{ needs.check_source.outputs.config_hash }}
219+
options: |
320220
../cpython-ro-srcdir/configure \
321221
--config-cache \
322222
--with-pydebug \
323223
--with-openssl=$OPENSSL_DIR
324-
- name: Build CPython out-of-tree
325-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
326-
run: make -j4
327-
- name: Display build info
328-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
329-
run: make pythoninfo
330-
- name: Remount sources writable for tests
331-
# some tests write to srcdir, lack of pyc files slows down testing
332-
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
333-
- name: Tests
334-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
335-
run: xvfb-run make test
224+
225+
build_ubuntu_free_threaded:
226+
name: 'Ubuntu (free-threaded)'
227+
needs: check_source
228+
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
229+
uses: ./.github/workflows/reusable-build-ubuntu.yml
230+
with:
231+
config_hash: ${{ needs.check_source.outputs.config_hash }}
232+
options: |
233+
../cpython-ro-srcdir/configure \
234+
--config-cache \
235+
--with-pydebug \
236+
--with-openssl=$OPENSSL_DIR \
237+
--disable-gil
336238
337239
build_ubuntu_ssltests:
338240
name: 'Ubuntu SSL tests with OpenSSL'
@@ -598,11 +500,10 @@ jobs:
598500
- check_source # Transitive dependency, needed to access `run_tests` value
599501
- check-docs
600502
- check_generated_files
601-
- build_win32
602-
- build_win_amd64
603-
- build_win_arm64
503+
- build_windows
604504
- build_macos
605505
- build_ubuntu
506+
- build_ubuntu_free_threaded
606507
- build_ubuntu_ssltests
607508
- test_hypothesis
608509
- build_asan
@@ -616,6 +517,7 @@ jobs:
616517
with:
617518
allowed-failures: >-
618519
build_macos,
520+
build_ubuntu_free_threaded,
619521
build_ubuntu_ssltests,
620522
build_win32,
621523
build_win_arm64,
@@ -638,6 +540,7 @@ jobs:
638540
build_win_arm64,
639541
build_macos,
640542
build_ubuntu,
543+
build_ubuntu_free_threaded,
641544
build_ubuntu_ssltests,
642545
build_asan,
643546
'
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
config_hash:
5+
required: true
6+
type: string
7+
free-threaded:
8+
required: false
9+
type: boolean
10+
default: false
11+
12+
jobs:
13+
build_macos:
14+
name: 'build and test'
15+
runs-on: macos-latest
16+
timeout-minutes: 60
17+
env:
18+
HOMEBREW_NO_ANALYTICS: 1
19+
HOMEBREW_NO_AUTO_UPDATE: 1
20+
HOMEBREW_NO_INSTALL_CLEANUP: 1
21+
PYTHONSTRICTEXTENSIONBUILD: 1
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Restore config.cache
25+
uses: actions/cache@v3
26+
with:
27+
path: config.cache
28+
key: ${{ github.job }}-${{ runner.os }}-${{ inputs.config_hash }}
29+
- name: Install Homebrew dependencies
30+
run: brew install pkg-config [email protected] xz gdbm tcl-tk
31+
- name: Configure CPython
32+
run: |
33+
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
34+
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
35+
./configure \
36+
--config-cache \
37+
--with-pydebug \
38+
${{ inputs.free-threaded && '--disable-gil' || '' }} \
39+
--prefix=/opt/python-dev \
40+
--with-openssl="$(brew --prefix [email protected])"
41+
- name: Build CPython
42+
run: make -j4
43+
- name: Display build info
44+
run: make pythoninfo
45+
- name: Tests
46+
run: make test
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
config_hash:
5+
required: true
6+
type: string
7+
options:
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build_ubuntu_reusable:
13+
name: 'build and test'
14+
timeout-minutes: 60
15+
runs-on: ubuntu-20.04
16+
env:
17+
OPENSSL_VER: 3.0.11
18+
PYTHONSTRICTEXTENSIONBUILD: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Register gcc problem matcher
22+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
23+
- name: Install dependencies
24+
run: sudo ./.github/workflows/posix-deps-apt.sh
25+
- name: Configure OpenSSL env vars
26+
run: |
27+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
28+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
29+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
30+
- name: 'Restore OpenSSL build'
31+
id: cache-openssl
32+
uses: actions/cache@v3
33+
with:
34+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
35+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
36+
- name: Install OpenSSL
37+
if: steps.cache-openssl.outputs.cache-hit != 'true'
38+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
39+
- name: Add ccache to PATH
40+
run: |
41+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
42+
- name: Configure ccache action
43+
uses: hendrikmuhs/[email protected]
44+
- name: Setup directory envs for out-of-tree builds
45+
run: |
46+
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
47+
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
48+
- name: Create directories for read-only out-of-tree builds
49+
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
50+
- name: Bind mount sources read-only
51+
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
52+
- name: Restore config.cache
53+
uses: actions/cache@v3
54+
with:
55+
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
56+
key: ${{ github.job }}-${{ runner.os }}-${{ inputs.config_hash }}
57+
- name: Configure CPython out-of-tree
58+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
59+
run: ${{ inputs.options }}
60+
- name: Build CPython out-of-tree
61+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
62+
run: make -j4
63+
- name: Display build info
64+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
65+
run: make pythoninfo
66+
- name: Remount sources writable for tests
67+
# some tests write to srcdir, lack of pyc files slows down testing
68+
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
69+
- name: Tests
70+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
71+
run: xvfb-run make test

0 commit comments

Comments
 (0)