Skip to content

Commit 5ce227f

Browse files
[3.9] bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360) (GH-25391)
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 <[email protected]> (cherry picked from commit 8fa1489) Co-authored-by: Christian Heimes <[email protected]> Automerge-Triggered-By: GH:tiran
1 parent 15ad30d commit 5ce227f

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

.github/workflows/build.yml

Lines changed: 61 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_abi:
@@ -152,6 +155,11 @@ jobs:
152155
- uses: actions/checkout@v2
153156
- name: Install Dependencies
154157
run: sudo ./.github/workflows/posix-deps-apt.sh
158+
- name: Configure OpenSSL env vars
159+
run: |
160+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
161+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
162+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
155163
- name: 'Restore OpenSSL build'
156164
id: cache-openssl
157165
uses: actions/[email protected]
@@ -160,12 +168,63 @@ jobs:
160168
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
161169
- name: Install OpenSSL
162170
if: steps.cache-openssl.outputs.cache-hit != 'true'
163-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
171+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
172+
- name: Add ccache to PATH
173+
run: |
174+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
175+
- name: Configure ccache action
176+
uses: hendrikmuhs/ccache-action@v1
164177
- name: Configure CPython
165-
run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
178+
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
166179
- name: Build CPython
167180
run: make -j4
168181
- name: Display build info
169182
run: make pythoninfo
170183
- name: Tests
171184
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
185+
186+
build_ubuntu_ssltests:
187+
name: 'Ubuntu SSL tests with OpenSSL ${{ matrix.openssl_ver }}'
188+
runs-on: ubuntu-20.04
189+
needs: check_source
190+
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_ssl_tests == 'true'
191+
strategy:
192+
fail-fast: false
193+
matrix:
194+
openssl_ver: [1.0.2u, 1.1.0l, 1.1.1k, 3.0.0-alpha14]
195+
env:
196+
OPENSSL_VER: ${{ matrix.openssl_ver }}
197+
MULTISSL_DIR: ${{ github.workspace }}/multissl
198+
OPENSSL_DIR: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}
199+
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
200+
steps:
201+
- uses: actions/checkout@v2
202+
- name: Install Dependencies
203+
run: sudo ./.github/workflows/posix-deps-apt.sh
204+
- name: Configure OpenSSL env vars
205+
run: |
206+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
207+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
208+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
209+
- name: 'Restore OpenSSL build'
210+
id: cache-openssl
211+
uses: actions/[email protected]
212+
with:
213+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
214+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
215+
- name: Install OpenSSL
216+
if: steps.cache-openssl.outputs.cache-hit != 'true'
217+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
218+
- name: Add ccache to PATH
219+
run: |
220+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
221+
- name: Configure ccache action
222+
uses: hendrikmuhs/ccache-action@v1
223+
- name: Configure CPython
224+
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
225+
- name: Build CPython
226+
run: make -j4
227+
- name: Display build info
228+
run: make pythoninfo
229+
- name: SSL tests
230+
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)