8000 bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360) · miss-islington/cpython@65655ca · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 65655ca

Browse files
tiranmiss-islington
authored andcommitted
bpo-43811: Test multiple OpenSSL versions on GHA (pythonGH-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> (cherry picked from commit 8fa1489) Co-authored-by: Christian Heimes <christian@python.org>
1 parent 47a894d commit 65655ca

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
@@ -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,65 @@ 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: Register gcc problem matcher
196+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
197+
- name: Install Dependencies
198+
run: sudo ./.github/workflows/posix-deps-apt.sh
199+
- name: Configure OpenSSL env vars
200+
run: |
201+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
202+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
203+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
204+
- name: 'Restore OpenSSL build'
205+
id: cache-openssl
206+
uses: actions/cache@v2.1.4
207+
with:
208+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
209+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
210+
- name: Install OpenSSL
211+
if: steps.cache-openssl.outputs.cache-hit != 'true'
212+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
213+
- name: Add ccache to PATH
214+
run: |
215+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
216+
- name: Configure ccache action
217+
uses: hendrikmuhs/ccache-action@v1
218+
- name: Configure CPython
219+
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
220+
- name: Build CPython
221+
run: make -j4
222+
- name: Display build info
223+
run: make pythoninfo
224+
- name: SSL tests
225+
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