8000 [3.11] gh-111062: CI: Move OS test jobs to reusable workflows (gh-111… · python/cpython@cdfef0c · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

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 cdfef0c

Browse files
hugovkcorona10
andauthored
[3.11] gh-111062: CI: Move OS test jobs to reusable workflows (gh-111570)
CI: Move OS test jobs to reusable workflows Co-authored-by: Donghee Na <donghee.na@python.org>
1 parent e2421a3 commit cdfef0c

File tree

4 files changed

+184
-147
lines changed

4 files changed

+184
-147
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
steps:
100100
- uses: actions/checkout@v4
101101
- uses: actions/setup-python@v4
102-
- name: Install Dependencies
102+
- name: Install dependencies
103103
run: |
104104
sudo ./.github/workflows/posix-deps-apt.sh
105105
sudo apt-get install -yq abigail-tools
@@ -115,7 +115,7 @@ jobs:
115115
run: |
116116
if ! make check-abidump; then
117117
echo "Generated ABI file is not up to date."
118-
echo "Please, add the release manager of this branch as a reviewer of this PR."
118+
echo "Please add the release manager of this branch as a reviewer of this PR."
119119
echo ""
120120
echo "The up to date ABI file should be attached to this build as an artifact."
121121
echo ""
@@ -194,159 +194,32 @@ jobs:
194194
- name: Check limited ABI symbols
195195
run: make check-limited-abi
196196

197-
build_win32:
198-
name: 'Windows (x86)'
199-
runs-on: windows-latest
200-
timeout-minutes: 60
201-
needs: check_source
202-
if: needs.check_source.outputs.run_tests == 'true'
203-
env:
204-
IncludeUwp: 'true'
205-
steps:
206-
- uses: actions/checkout@v4
207-
- name: Build CPython
208-
run: .\PCbuild\build.bat -e -d -p Win32
209-
- name: Display build info
210-
run: .\python.bat -m test.pythoninfo
211-
- name: Tests
212-
run: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
213-
214-
build_win_amd64:
215-
name: 'Windows (x64)'
216-
runs-on: windows-latest
217-
timeout-minutes: 60
197+
build_windows:
198+
name: 'Windows'
218199
needs: check_source
219200
if: needs.check_source.outputs.run_tests == 'true'
220-
env:
221-
IncludeUwp: 'true'
222-
steps:
223-
- uses: actions/checkout@v4
224-
- name: Register MSVC problem matcher
225-
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
226-
- name: Build CPython
227-
run: .\PCbuild\build.bat -e -d -p x64
228-
- name: Display build info
229-
run: .\python.bat -m test.pythoninfo
230-
- name: Tests
231-
run: .\PCbuild\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
232-
233-
build_win_arm64:
234-
name: 'Windows (arm64)'
235-
runs-on: windows-latest
236-
timeout-minutes: 60
237-
needs: check_source
238-
if: needs.check_source.outputs.run_tests == 'true'
239-
env:
240-
IncludeUwp: 'true'
241-
steps:
242-
- uses: actions/checkout@v4
243-
- name: Register MSVC problem matcher
244-
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
245-
- name: Build CPython
246-
run: .\PCbuild\build.bat -e -d -p arm64
201+
uses: ./.github/workflows/reusable-windows.yml
247202

248203
build_macos:
249204
name: 'macOS'
250-
runs-on: macos-latest
251-
timeout-minutes: 60
252205
needs: check_source
253206
if: needs.check_source.outputs.run_tests == 'true'
254-
env:
255-
HOMEBREW_NO_ANALYTICS: 1
256-
HOMEBREW_NO_AUTO_UPDATE: 1
257-
HOMEBREW_NO_INSTALL_CLEANUP: 1
258-
PYTHONSTRICTEXTENSIONBUILD: 1
259-
steps:
260-
- uses: actions/checkout@v4
261-
- name: Restore config.cache
262-
uses: actions/cache@v3
263-
with:
264-
path: config.cache
265-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
266-
- name: Install Homebrew dependencies
267-
run: brew install pkg-config openssl@3.0 xz gdbm tcl-tk
268-
- name: Configure CPython
269-
run: |
270-
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
271-
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
272-
./configure \
273-
--config-cache \
274-
--with-pydebug \
275-
--prefix=/opt/python-dev \
276-
--with-openssl="$(brew --prefix openssl@3.0)"
277-
- name: Build CPython
278-
run: make -j4
279-
- name: Display build info
280-
run: make pythoninfo
281-
- name: Tests
282-
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
207+
uses: ./.github/workflows/reusable-macos.yml
208+
with:
209+
config_hash: ${{ needs.check_source.outputs.config_hash }}
283210

284211
build_ubuntu:
285212
name: 'Ubuntu'
286-
runs-on: ubuntu-20.04
287-
timeout-minutes: 60
288213
needs: check_source
289214
if: needs.check_source.outputs.run_tests == 'true'
290-
env:
291-
OPENSSL_VER: 3.0.11
292-
PYTHONSTRICTEXTENSIONBUILD: 1
293-
steps:
294-
- uses: actions/checkout@v4
295-
- name: Register gcc problem matcher
296-
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
297-
- name: Install dependencies
298-
run: sudo ./.github/workflows/posix-deps-apt.sh
299-
- name: Configure OpenSSL env vars
300-
run: |
301-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
302-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
303-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
304-
- name: 'Restore OpenSSL build'
305-
id: cache-openssl
306-
uses: actions/cache@v3
307-
with:
308-
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
309-
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
310-
- name: Install OpenSSL
311-
if: steps.cache-openssl.outputs.cache-hit != 'true'
312-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
313-
- name: Add ccache to PATH
314-
run: |
315-
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
316-
- name: Configure ccache action
317-
uses: hendrikmuhs/ccache-action@v1.2
318-
- name: Setup directory envs for out-of-tree builds
319-
run: |
320-
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
321-
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
322-
- name: Create directories for read-only out-of-tree builds
323-
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
324-
- name: Bind mount sources read-only
325-
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
326-
- name: Restore config.cache
327-
uses: actions/cache@v3
328-
with:
329-
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
330-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
331-
- name: Configure CPython out-of-tree
332-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
333-
run: |
215+
uses: ./.github/workflows/reusable-ubuntu.yml
216+
with:
217+
config_hash: ${{ needs.check_source.outputs.config_hash }}
218+
options: |
334219
../cpython-ro-srcdir/configure \
335220
--config-cache \
336221
--with-pydebug \
337222
--with-openssl=$OPENSSL_DIR
338-
- name: Build CPython out-of-tree
339-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
340-
run: make -j4
341-
- name: Display build info
342-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
343-
run: make pythoninfo
344-
- name: Remount sources writable for tests
345-
# some tests write to srcdir, lack of pyc files slows down testing
346-
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
347-
- name: Tests
348-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
349-
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
350223
351224
build_ubuntu_ssltests:
352225
name: 'Ubuntu SSL tests with OpenSSL'
@@ -463,12 +336,10 @@ jobs:
463336
- check_source # Transitive dependency, needed to access `run_tests` value
464337
- check-docs
465338
- check_generated_files
466-
- build_win32
467-
- build_win_amd64
468-
- build_win_arm64
469339
- build_macos
470340
- build_ubuntu
471341
- build_ubuntu_ssltests
342+
- build_windows
472343
- build_asan
473344

474345
runs-on: ubuntu-latest
@@ -480,8 +351,6 @@ jobs:
480351
allowed-failures: >-
481352
build_macos,
482353
build_ubuntu_ssltests,
483-
build_win32,
484-
build_win_arm64,
485354
allowed-skips: >-
486355
${{
487356
!fromJSON(needs.check_source.outputs.run-docs)
@@ -494,12 +363,10 @@ jobs:
494363
needs.check_source.outputs.run_tests != 'true'
495364
&& '
496365
check_generated_files,
497-
build_win32,
498-
build_win_amd64,
499-
build_win_arm64,
500366
build_macos,
501367
build_ubuntu,
502368
build_ubuntu_ssltests,
369+
build_windows,
503370
build_asan,
504371
'
505372
|| ''

.github/workflows/reusable-macos.yml

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 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

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/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"
Lines 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