1
1
name : Tests
2
2
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
+
3
8
on :
4
9
pull_request :
5
10
@@ -20,106 +25,43 @@ jobs:
20
25
echo "run_tests=true" >> "$GITHUB_OUTPUT"
21
26
else
22
27
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
25
28
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> "$GITHUB_OUTPUT" || true
26
29
fi
27
30
28
- check_abi_opensuse :
29
- name : ' Check ABI (openSUSE Leap)'
31
+ opensuse-tests :
32
+ name : ' ${{ matrix.name }} (openSUSE Leap)'
30
33
runs-on : ubuntu-latest
31
34
needs : check_source
32
35
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
62
36
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
68
38
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'
104
51
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
112
52
env :
113
53
OPENSSL_VER : 1.1.1u
54
+
114
55
steps :
115
- - uses : actions/checkout@v4
116
- - name : Install Dependencies
56
+ - name : Install All Dependencies
117
57
run : |
118
58
zypper --non-interactive install --auto-agree-with-licenses \
59
+ git \
60
+ tar \
119
61
gcc \
120
62
make \
121
- tar \
122
63
python3 \
64
+ libabigail-tools \
123
65
xorg-x11-server-Xvfb \
124
66
libffi-devel \
125
67
zlib-devel \
@@ -129,22 +71,64 @@ jobs:
129
71
tk-devel \
130
72
readline-devel \
131
73
xz-devel \
132
- bzip2
74
+ bzip2 \
75
+ openssl \
76
+ xvfb-run
77
+
78
+ - uses : actions/checkout@v4
79
+
133
80
- name : ' Restore OpenSSL build'
81
+ if : matrix.task == 'build-and-test'
134
82
id : cache-openssl
135
83
uses : actions/cache@v4
136
84
with :
137
85
path : ./multissl/openssl/${{ env.OPENSSL_VER }}
138
- # Updated key to be specific to the OS distribution
139
86
key : opensuse-leap-multissl-openssl-${{ env.OPENSSL_VER }}
87
+
88
+ # === Steps for ABI Check ===
89
+ - name : Build CPython for ABI Check
90
+ if : matrix.task == 'abi'
91
+ env :
92
+ CFLAGS : -g3 -O0
93
+ run : |
94
+ ./configure --enable-shared
95
+ make -j4
96
+ - name : Check for changes in the ABI
97
+ if : matrix.task == 'abi'
98
+ run : make check-abidump
99
+
100
+ # === Steps for Generated Files Check ===
101
+ - name : Build CPython for Generated Files Check
102
+ if : matrix.task == 'generated-files'
103
+ run : |
104
+ ./configure --with-pydebug
105
+ make -j4 regen-all
106
+ - name : Check for changes in generated files
107
+ if : matrix.task == 'generated-files'
108
+ run : |
109
+ if ! git diff --quiet; then
110
+ echo "Generated files are not up to date. Please run 'make regen-all' and commit the changes."
111
+ git status
112
+ git diff
113
+ exit 1
114
+ fi
115
+ - name : Check exported libpython symbols
116
+ if : matrix.task == 'generated-files'
117
+ run : make smelly
118
+
119
+ # === Steps for Full Build and Test ===
140
120
- name : Install OpenSSL
141
- if : steps.cache-openssl.outputs.cache-hit != 'true'
121
+ if : matrix.task == 'build-and-test' && steps.cache-openssl.outputs.cache-hit != 'true'
142
122
run : python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
143
123
- name : Configure CPython
124
+ if : matrix.task == 'build-and-test'
144
125
run : ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
145
126
- name : Build CPython
127
+ if : matrix.task == 'build-and-test'
146
128
run : make -j4
147
129
- name : Display build info
130
+ if : matrix.task == 'build-and-test'
148
131
run : make pythoninfo
149
- - name : Tests
150
- run : xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
132
+ - name : Run tests
133
+ if : matrix.task == 'build-and-test'
134
+ run : xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
0 commit comments