10000 bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360) · python/cpython@8fa1489 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fa1489

Browse files
authored
bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360)
The new checks are only executed when one or more OpenSSL-related files are modified. The checks run a handful of networking and hashing test suites. All SSL checks are optional. This PR also introduces ccache to speed up compilation. In common cases it speeds up configure and compile time from about 90 seconds to less than 30 seconds. Signed-off-by: Christian Heimes <christian@python.org>
1 parent 30ed93b commit 8fa1489

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

.github/workflows/build.yml

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ jobs:
2323
runs-on: ubuntu-latest
2424
outputs:
2525
run_tests: ${{ steps.check.outputs.run_tests }}
26+
run_ssl_tests: ${{ steps.check.outputs.run_ssl_tests }}
2627
steps:
2728
- uses: actions/checkout@v2
2829
- name: Check for source changes
2930
id: check
3031
run: |
3132
if [ -z "$GITHUB_BASE_REF" ]; then
3233
echo '::set-output name=run_tests::true'
34+
echo '::set-output name=run_ssl_tests::true'
3335
else
3436
git fetch origin $GITHUB_BASE_REF --depth=1
3537
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
@@ -46,6 +48,7 @@ jobs:
4648
#
4749
# https://github.com/python/core-workflow/issues/373
4850
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
51+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)' && echo '::set-output name=run_ssl_tests::true' || true
4952
fi
5053
5154
check_generated_files:
@@ -138,6 +141,11 @@ jobs:
138141
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
139142
- name: Install Dependencies
140143
run: sudo ./.github/workflows/posix-deps-apt.sh
144+
- name: Configure OpenSSL env vars
145+
run: |
146+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
147+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
148+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
141149
- name: 'Restore OpenSSL build'
142150
id: cache-openssl
143151
uses: actions/cache@v2.1.4
@@ -146,12 +154,65 @@ jobs:
146154
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
147155
- name: Install OpenSSL
148156
if: steps.cache-openssl.outputs.cache-hit != 'true'
149-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
157+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
158+
- name: Add ccache to PATH
159+
run: |
160+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
161+
- name: Configure ccache action
162+
uses: hendrikmuhs/ccache-action@v1
150163
- name: Configure CPython
151-
run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
164+
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
152165
- name: Build CPython
153166
run: make -j4
154167
- name: Display build info
155168
run: make pythoninfo
156169
- name: Tests
157170
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
171+
172+
build_ubuntu_ssltests:
173+
name: 'Ubuntu SSL tests with OpenSSL ${{ matrix.openssl_ver }}'
174+
runs-on: ubuntu-20.04
175+
needs: check_source
176+
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_ssl_tests == 'true'
177+
strategy:
178+
fail-fast: false
179+
matrix:
180+
openssl_ver: [1.0.2u, 1.1.0l, 1.1.1k, 3.0.0-alpha14]
181+
env:
182+
OPENSSL_VER: ${{ matrix.openssl_ver }}
183+
MULTISSL_DIR: ${{ github.workspace }}/multissl
184+
OPENSSL_DIR: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}
185+
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
186+
steps:
187+
- uses: actions/checkout@v2
188+
- name: Register gcc problem matcher
189+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
190+
- name: Install Dependencies
191+
run: sudo ./.github/workflows/posix-deps-apt.sh
192+
- name: Configure OpenSSL env vars
193+
run: |
194+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
195+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
196+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
197+
- name: 'Restore OpenSSL build'
198+
id: cache-openssl
199+
uses: actions/cache@v2.1.4
200+
with:
201+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
202+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
203+
- name: Install OpenSSL
204+
if: steps.cache-openssl.outputs.cache-hit != 'true'
205+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
206+
- name: Add ccache to PATH
207+
run: |
208+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
209+
- name: Configure ccache action
210+
uses: hendrikmuhs/ccache-action@v1
211+
- name: Configure CPython
212+
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
213+
- name: Build CPython
214+
run: make -j4
215+
- name: Display build info
216+
run: make pythoninfo
217+
- name: SSL tests
218+
run: ./python Lib/test/ssltests.py

.github/workflows/posix-deps-apt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apt-get update
33

44
apt-get -yq install \
55
build-essential \
6+
ccache \
67
gdb \
78
lcov \
89
libbz2-dev \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Tests multiple OpenSSL versions on GitHub Actions. Use ccache to speed up
2+
testing.

0 commit comments

Comments
 (0)
0