Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 427cf61

Browse filesBrowse files
hugovkcorona10
andauthored
[3.12] gh-111062: CI: Move OS test jobs to reusable workflows (gh-111568)
CI: Move OS test jobs to reusable workflows Co-authored-by: Donghee Na <donghee.na@python.org>
1 parent 77f59bf commit 427cf61
Copy full SHA for 427cf61

File tree

4 files changed

+184
-147
lines changed
Filter options

4 files changed

+184
-147
lines changed

‎.github/workflows/build.yml

Copy file name to clipboardExpand all lines: .github/workflows/build.yml
+14-147Lines changed: 14 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
needs: check_source
109109
if: needs.check_source.outputs.run_tests == 'true'
110110
steps:
111-
- uses: actions/checkout@v3
111+
- uses: actions/checkout@v4
112112
- uses: actions/setup-python@v4
113113
- name: Install dependencies
114114
run: |
@@ -208,159 +208,32 @@ jobs:
208208
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
209209
run: make check-c-globals
210210

211-
build_win32:
212-
name: 'Windows (x86)'
213-
runs-on: windows-latest
214-
timeout-minutes: 60
211+
build_windows:
212+
name: 'Windows'
215213
needs: check_source
216214
if: needs.check_source.outputs.run_tests == 'true'
217-
env:
218-
IncludeUwp: 'true'
219-
steps:
220-
- uses: actions/checkout@v4
221-
- name: Build CPython
222-
run: .\PCbuild\build.bat -e -d -p Win32
223-
- name: Display build info
224-
run: .\python.bat -m test.pythoninfo
225-
- name: Tests
226-
run: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
227-
228-
build_win_amd64:
229-
name: 'Windows (x64)'
230-
runs-on: windows-latest
231-
timeout-minutes: 60
232-
needs: check_source
233-
if: needs.check_source.outputs.run_tests == 'true'
234-
env:
235-
IncludeUwp: 'true'
236-
steps:
237-
- uses: actions/checkout@v4
238-
- name: Register MSVC problem matcher
239-
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
240-
- name: Build CPython
241-
run: .\PCbuild\build.bat -e -d -p x64
242-
- name: Display build info
243-
run: .\python.bat -m test.pythoninfo
244-
- name: Tests
245-
run: .\PCbuild\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
246-
247-
build_win_arm64:
248-
name: 'Windows (arm64)'
249-
runs-on: windows-latest
250-
timeout-minutes: 60
251-
needs: check_source
252-
if: needs.check_source.outputs.run_tests == 'true'
253-
env:
254-
IncludeUwp: 'true'
255-
steps:
256-
- uses: actions/checkout@v4
257-
- name: Register MSVC problem matcher
258-
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
259-
- name: Build CPython
260-
run: .\PCbuild\build.bat -e -d -p arm64
215+
uses: ./.github/workflows/reusable-windows.yml
261216

262217
build_macos:
263218
name: 'macOS'
264-
runs-on: macos-latest
265-
timeout-minutes: 60
266219
needs: check_source
267220
if: needs.check_source.outputs.run_tests == 'true'
268-
env:
269-
HOMEBREW_NO_ANALYTICS: 1
270-
HOMEBREW_NO_AUTO_UPDATE: 1
271-
HOMEBREW_NO_INSTALL_CLEANUP: 1
272-
PYTHONSTRICTEXTENSIONBUILD: 1
273-
steps:
274-
- uses: actions/checkout@v4
275-
- name: Restore config.cache
276-
uses: actions/cache@v3
277-
with:
278-
path: config.cache
279-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
280-
- name: Install Homebrew dependencies
281-
run: brew install pkg-config openssl@3.0 xz gdbm tcl-tk
282-
- name: Configure CPython
283-
run: |
284-
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
285-
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
286-
./configure \
287-
--config-cache \
288-
--with-pydebug \
289-
--prefix=/opt/python-dev \
290-
--with-openssl="$(brew --prefix openssl@3.0)"
291-
- name: Build CPython
292-
run: make -j4
293-
- name: Display build info
294-
run: make pythoninfo
295-
- name: Tests
296-
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
221+
uses: ./.github/workflows/reusable-macos.yml
222+
with:
223+
config_hash: ${{ needs.check_source.outputs.config_hash }}
297224

298225
build_ubuntu:
299226
name: 'Ubuntu'
300-
runs-on: ubuntu-20.04
301-
timeout-minutes: 60
302227
needs: check_source
303228
if: needs.check_source.outputs.run_tests == 'true'
304-
env:
305-
OPENSSL_VER: 3.0.11
306-
PYTHONSTRICTEXTENSIONBUILD: 1
307-
steps:
308-
- uses: actions/checkout@v4
309-
- name: Register gcc problem matcher
310-
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
311-
- name: Install dependencies
312-
run: sudo ./.github/workflows/posix-deps-apt.sh
313-
- name: Configure OpenSSL env vars
314-
run: |
315-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
316-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
317-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
318-
- name: 'Restore OpenSSL build'
319-
id: cache-openssl
320-
uses: actions/cache@v3
321-
with:
322-
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
323-
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
324-
- name: Install OpenSSL
325-
if: steps.cache-openssl.outputs.cache-hit != 'true'
326-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
327-
- name: Add ccache to PATH
328-
run: |
329-
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
330-
- name: Configure ccache action
331-
uses: hendrikmuhs/ccache-action@v1.2
332-
- name: Setup directory envs for out-of-tree builds
333-
run: |
334-
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
335-
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
336-
- name: Create directories for read-only out-of-tree builds
337-
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
338-
- name: Bind mount sources read-only
339-
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
340-
- name: Restore config.cache
341-
uses: actions/cache@v3
342-
with:
343-
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
344-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
345-
- name: Configure CPython out-of-tree
346-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
347-
run: |
229+
uses: ./.github/workflows/reusable-ubuntu.yml
230+
with:
231+
config_hash: ${{ needs.check_source.outputs.config_hash }}
232+
options: |
348233
../cpython-ro-srcdir/configure \
349234
--config-cache \
350235
--with-pydebug \
351236
--with-openssl=$OPENSSL_DIR
352-
- name: Build CPython out-of-tree
353-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
354-
run: make -j4
355-
- name: Display build info
356-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
357-
run: make pythoninfo
358-
- name: Remount sources writable for tests
359-
# some tests write to srcdir, lack of pyc files slows down testing
360-
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
361-
- name: Tests
362-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
363-
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
364237
365238
build_ubuntu_ssltests:
366239
name: 'Ubuntu SSL tests with OpenSSL'
@@ -429,7 +302,7 @@ jobs:
429302
- uses: actions/checkout@v4
430303
- name: Register gcc problem matcher
431304
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
432-
- name: Install Dependencies
305+
- name: Install dependencies
433306
run: sudo ./.github/workflows/posix-deps-apt.sh
434307
- name: Configure OpenSSL env vars
435308
run: |
@@ -586,12 +459,10 @@ jobs:
586459
- check_source # Transitive dependency, needed to access `run_tests` value
587460
- check-docs
588461
- check_generated_files
589-
- build_win32
590-
- build_win_amd64
591-
- build_win_arm64
592462
- build_macos
593463
- build_ubuntu
594464
- build_ubuntu_ssltests
465+
- build_windows
595466
- test_hypothesis
596467
- build_asan
597468

@@ -604,8 +475,6 @@ jobs:
604475
allowed-failures: >-
605476
build_macos,
606477
build_ubuntu_ssltests,
607-
build_win32,
608-
build_win_arm64,
609478
test_hypothesis,
610479
allowed-skips: >-
611480
${{
@@ -619,12 +488,10 @@ jobs:
619488
needs.check_source.outputs.run_tests != 'true'
620489
&& '
621490
check_generated_files,
622-
build_win32,
623-
build_win_amd64,
624-
build_win_arm64,
625491
build_macos,
626492
build_ubuntu,
627493
build_ubuntu_ssltests,
494+
build_windows,
628495
build_asan,
629496
'
630497
|| ''

‎.github/workflows/reusable-macos.yml

Copy file name to clipboard
+46Lines 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 openssl@3.0 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 openssl@3.0)"
41+
- name: Build CPython
42+
run: make -j4
43+
- name: Display build info
44+
run: make pythoninfo
45+
- name: Tests
46+
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"

‎.github/workflows/reusable-ubuntu.yml

Copy file name to clipboard
+71Lines 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/ccache-action@v1.2
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 buildbottest TESTOPTS="-j4 -uall,-cpu"
+53Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
free-threaded:
5+
required: false
6+
type: boolean
7+
default: false
8+
9+
jobs:
10+
build_win32:
11+
name: 'build and test (x86)'
12+
runs-on: windows-latest
13+
timeout-minutes: 60
14+
env:
15+
IncludeUwp: 'true'
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Build CPython
19+
run: .\PCbuild\build.bat -e -d -p Win32 ${{ inputs.free-threaded && '--disable-gil' || '' }}
20+
- name: Display build info
21+
run: .\python.bat -m test.pythoninfo
22+
- name: Tests
23+
run: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
24+
25+
build_win_amd64:
26+
name: 'build and test (x64)'
27+
runs-on: windows-latest
28+
timeout-minutes: 60
29+
env:
30+
IncludeUwp: 'true'
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Register MSVC problem matcher
34+
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
35+
- name: Build CPython
36+
run: .\PCbuild\build.bat -e -d -p x64 ${{ inputs.free-threaded && '--disable-gil' || '' }}
37+
- name: Display build info
38+
run: .\python.bat -m test.pythoninfo
39+
- name: Tests
40+
run: .\PCbuild\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
41+
42+
build_win_arm64:
43+
name: 'build (arm64)'
44+
runs-on: windows-latest
45+
timeout-minutes: 60
46+
env:
47+
IncludeUwp: 'true'
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Register MSVC problem matcher
51+
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
52+
- name: Build CPython
53+
run: .\PCbuild\build.bat -e -d -p arm64 ${{ inputs.free-threaded && '--disable-gil' || '' }}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.