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

Skip to content

Commit a607815

Browse files
[3.8] bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360) (GH-25392)
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> (cherry picked from commit 8fa1489) Co-authored-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran
1 parent 47a894d commit a607815

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
@@ -16,13 +16,15 @@ jobs:
1616
runs-on: ubuntu-latest
1717
outputs:
1818
run_tests: ${{ steps.check.outputs.run_tests }}
19+
run_ssl_tests: ${{ steps.check.outputs.run_ssl_tests }}
1920
steps:
2021
- uses: actions/checkout@v2
2122
- name: Check for source changes
2223
id: check
2324
run: |
2425
if [ -z "$GITHUB_BASE_REF" ]; then
2526
echo '::set-output name=run_tests::true'
27+
echo '::set-output name=run_ssl_tests::true'
2628
else
2729
git fetch origin $GITHUB_BASE_REF --depth=1
2830
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
@@ -39,6 +41,7 @@ jobs:
3941
#
4042
# https://github.com/python/core-workflow/issues/373
4143
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
44+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)' && echo '::set-output name=run_ssl_tests::true' || true
4245
fi
4346
4447
check_abi:
@@ -145,6 +148,11 @@ jobs:
145148
- uses: actions/checkout@v2
146149
- name: Install Dependencies
147150
run: sudo ./.github/workflows/posix-deps-apt.sh
151+
- name: Configure OpenSSL env vars
152+
run: |
153+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
154+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
155+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
148156
- name: 'Restore OpenSSL build'
149157
id: cache-openssl
150158
uses: actions/cache@v2.1.3
@@ -153,12 +161,63 @@ jobs:
153161
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
154162
- name: Install OpenSSL
155163
if: steps.cache-openssl.outputs.cache-hit != 'true'
156-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
164+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
165+
- name: Add ccache to PATH
166+
run: |
167+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
168+
- name: Configure ccache action
169+
uses: hendrikmuhs/ccache-action@v1
157170
- name: Configure CPython
158-
run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
171+
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
159172
- name: Build CPython
160173
run: make -j4
161174
- name: Display build info
162175
run: make pythoninfo
163176
- name: Tests
164177
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
178+
179+
build_ubuntu_ssltests:
180+
name: 'Ubuntu SSL tests with OpenSSL ${{ matrix.openssl_ver }}'
181+
runs-on: ubuntu-20.04
182+
needs: check_source
183+
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_ssl_tests == 'true'
184+
strategy:
185+
fail-fast: false
186+
matrix:
187+
openssl_ver: [1.0.2u, 1.1.0l, 1.1.1k, 3.0.0-alpha14]
188+
env:
189+
OPENSSL_VER: ${{ matrix.openssl_ver }}
190+
MULTISSL_DIR: ${{ github.workspace }}/multissl
191+
OPENSSL_DIR: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}
192+
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
193+
steps:
194+
- uses: actions/checkout@v2
195+
- name: Install Dependencies
196+
run: sudo ./.github/workflows/posix-deps-apt.sh
197+
- name: Configure OpenSSL env vars
198+
run: |
199+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
200+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
201+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
202+
- name: 'Restore OpenSSL build'
203+
id: cache-openssl
204+
uses: actions/cache@v2.1.4
205+
with:
206+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
207+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
208+
- name: Install OpenSSL
209+
if: steps.cache-openssl.outputs.cache-hit != 'true'
210+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
211+
- name: Add ccache to PATH
212+
run: |
213+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
214+
- name: Configure ccache action
215+
uses: hendrikmuhs/ccache-action@v1
216+
- name: Configure CPython
217+
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
218+
- name: Build CPython
219+
run: make -j4
220+
- name: Display build info
221+
run: make pythoninfo
222+
- name: SSL tests
223+
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