Skip to content

Commit d31c640

Browse files
committed
fix order of tasks to install dependencies first
1 parent 3356118 commit d31c640

File tree

1 file changed

+72
-88
lines changed

1 file changed

+72
-88
lines changed

.github/workflows/build.yml

Lines changed: 72 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: 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+
38
on:
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,64 @@ jobs:
12971
tk-devel \
13072
readline-devel \
13173
xz-devel \
132-
bzip2
74+
bzip2 \
75+
openssl \
76+
xvfb-run
77+
78+
- uses: actions/checkout@v4
79+
13380
- name: 'Restore OpenSSL build'
81+
if: matrix.task == 'build-and-test'
13482
id: cache-openssl
13583
uses: actions/cache@v4
13684
with:
13785
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
138-
# Updated key to be specific to the OS distribution
13986
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 ===
140120
- 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'
142122
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
143123
- name: Configure CPython
124+
if: matrix.task == 'build-and-test'
144125
run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
145126
- name: Build CPython
127+
if: matrix.task == 'build-and-test'
146128
run: make -j4
147129
- name: Display build info
130+
if: matrix.task == 'build-and-test'
148131
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

Comments
 (0)