11name : Tests
22
3+ # Cancel in-progress runs for the same PR.
4+ concurrency :
5+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
6+ cancel-in-progress : true
7+
38on :
49 pull_request :
510
@@ -20,106 +25,43 @@ jobs:
2025 echo "run_tests=true" >> "$GITHUB_OUTPUT"
2126 else
2227 git fetch origin $GITHUB_BASE_REF --depth=1
23- # git diff using 2 dots should be enough on GitHub.
24- # See https://github.com/python/core-workflow/issues/373
2528 git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> "$GITHUB_OUTPUT" || true
2629 fi
2730
28- check_abi_opensuse :
29- name : ' Check ABI (openSUSE Leap)'
31+ opensuse-tests :
32+ name : ' ${{ matrix.name }} (openSUSE Leap)'
3033 runs-on : ubuntu-latest
3134 needs : check_source
3235 if : needs.check_source.outputs.run_tests == 'true'
33- container :
34- image : opensuse/leap:latest
35- steps :
36- - uses : actions/checkout@v4
37- - name : Install Dependencies
38- run : |
39- zypper --non-interactive install --auto-agree-with-licenses \
40- gcc \
41- make \
42- libabigail-tools \
43- libffi-devel \
44- zlib-devel \
45- ncurses-devel \
46- gdbm-devel \
47- sqlite3-devel \
48- tk-devel \
49- readline-devel \
50- xz-devel \
51- bzip2 \
52- openssl
53- - name : Build CPython
54- env :
55- CFLAGS : -g3 -O0
56- run : |
57- # Build Python with the libpython dynamic library
58- ./configure --enable-shared
59- make -j4
60- - name : Check for changes in the ABI
61- run : make check-abidump
6236
63- check_generated_files_opensuse :
64- name : ' Check generated files (openSUSE Leap)'
65- runs-on : ubuntu-latest
66- needs : check_source
67- if : needs.check_source.outputs.run_tests == 'true'
37+ # Use a specific image version for reproducible builds
6838 container :
69- image : opensuse/leap:latest
70- steps :
71- - uses : actions/checkout@v4
72- - name : Install Dependencies
73- run : |
74- zypper --non-interactive install --auto-agree-with-licenses \
75- gcc \
76- make \
77- tar \
78- libffi-devel \
79- zlib-devel \
80- ncurses-devel \
81- gdbm-devel \
82- sqlite3-devel \
83- tk-devel \
84- readline-devel \
85- xz-devel \
86- bzip2 \
87- openssl
88- - name : Build CPython
89- run : |
90- ./configure --with-pydebug
91- make -j4 regen-all
92- - name : Check for changes
93- run : |
94- changes=$(git status --porcelain)
95- # Check for changes in regenerated files
96- if ! test -z "$changes"
97- then
98- echo "Generated files not up to date. Perhaps you forgot to run make regen-all ;)"
99- echo "$changes"
100- exit 1
101- fi
102- - name : Check exported libpython symbols
103- run : make smelly
39+ image : opensuse/leap:15.5
40+
41+ strategy :
42+ fail-fast : false
43+ matrix :
44+ include :
45+ - name : ' Check ABI'
46+ task : ' abi'
47+ - name : ' Check Generated Files'
48+ task : ' generated-files'
49+ - name : ' Build and Test'
50+ task : ' build-and-test'
10451
105- build_opensuse :
106- name : ' Build and Test (openSUSE Leap)'
107- runs-on : ubuntu-latest # The host runner is still Ubuntu
108- needs : check_source
109- if : needs.check_source.outputs.run_tests == 'true'
110- container :
111- image : opensuse/leap:latest # But steps run inside this container
11252 env :
11353 OPENSSL_VER : 1.1.1u
54+
11455 steps :
115- - uses : actions/checkout@v4
116- - name : Install Dependencies
56+ - name : Install All Dependencies
11757 run : |
11858 zypper --non-interactive install --auto-agree-with-licenses \
59+ git \
60+ tar \
11961 gcc \
12062 make \
121- tar \
12263 python3 \
64+ libabigail-tools \
12365 xorg-x11-server-Xvfb \
12466 libffi-devel \
12567 zlib-devel \
@@ -129,22 +71,63 @@ jobs:
12971 tk-devel \
13072 readline-devel \
13173 xz-devel \
132- bzip2
74+ bzip2 \
75+ openssl
76+
77+ - uses : actions/checkout@v4
78+
13379 - name : ' Restore OpenSSL build'
80+ if : matrix.task == 'build-and-test'
13481 id : cache-openssl
13582 uses : actions/cache@v4
13683 with :
13784 path : ./multissl/openssl/${{ env.OPENSSL_VER }}
138- # Updated key to be specific to the OS distribution
13985 key : opensuse-leap-multissl-openssl-${{ env.OPENSSL_VER }}
86+
87+ # === Steps for ABI Check ===
88+ - name : Build CPython for ABI Check
89+ if : matrix.task == 'abi'
90+ env :
91+ CFLAGS : -g3 -O0
92+ run : |
93+ ./configure --enable-shared
94+ make -j4
95+ - name : Check for changes in the ABI
96+ if : matrix.task == 'abi'
97+ run : make check-abidump
98+
99+ # === Steps for Generated Files Check ===
100+ - name : Build CPython for Generated Files Check
101+ if : matrix.task == 'generated-files'
102+ run : |
103+ ./configure --with-pydebug
104+ make -j4 regen-all
105+ - name : Check for changes in generated files
106+ if : matrix.task == 'generated-files'
107+ run : |
108+ if ! git diff --quiet; then
109+ echo "Generated files are not up to date. Please run 'make regen-all' and commit the changes."
110+ git status
111+ git diff
112+ exit 1
113+ fi
114+ - name : Check exported libpython symbols
115+ if : matrix.task == 'generated-files'
116+ run : make smelly
117+
118+ # === Steps for Full Build and Test ===
140119 - name : Install OpenSSL
141- if : steps.cache-openssl.outputs.cache-hit != 'true'
120+ if : matrix.task == 'build-and-test' && steps.cache-openssl.outputs.cache-hit != 'true'
142121 run : python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
143122 - name : Configure CPython
123+ if : matrix.task == 'build-and-test'
144124 run : ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
145125 - name : Build CPython
126+ if : matrix.task == 'build-and-test'
146127 run : make -j4
147128 - name : Display build info
129+ if : matrix.task == 'build-and-test'
148130 run : make pythoninfo
149- - name : Tests
150- run : xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
131+ - name : Run tests
132+ if : matrix.task == 'build-and-test'
133+ run : xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
0 commit comments