Skip to content

Commit 9a42b04

Browse files
committed
Add python3 ssl tests to wolfprovider CI
1 parent 739e502 commit 9a42b04

File tree

1 file changed

+149
-0
lines changed

1 file changed

+149
-0
lines changed

.github/workflows/python3-ssl.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Python SSL Tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ 'master', 'main', 'release/**' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
build_wolfprovider:
17+
uses: ./.github/workflows/build-wolfprovider.yml
18+
with:
19+
wolfssl_ref: ${{ matrix.wolfssl_ref }}
20+
openssl_ref: ${{ matrix.openssl_ref }}
21+
replace_default: ${{ matrix.replace_default }}
22+
strategy:
23+
matrix:
24+
wolfssl_ref: [ 'v5.8.2-stable' ]
25+
openssl_ref: [ 'openssl-3.5.2' ]
26+
replace_default: [ true ]
27+
fips: [ false ]
28+
29+
test_python_ssl:
30+
runs-on: ubuntu-22.04
31+
needs: build_wolfprovider
32+
# Python build and SSL tests can take time
33+
timeout-minutes: 60
34+
container:
35+
image: debian:bookworm
36+
options: --user root
37+
env:
38+
DEBIAN_FRONTEND: noninteractive
39+
WOLFSSL_PACKAGES_PATH: /tmp/wolfssl-packages
40+
OPENSSL_PACKAGES_PATH: /tmp/openssl-packages
41+
WOLFPROV_PACKAGES_PATH: /tmp/wolfprov-packages
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
python_version: [ '3.13.7' ]
46+
wolfssl_ref: [ 'v5.8.2-stable' ]
47+
openssl_ref: [ 'openssl-3.5.2' ]
48+
replace_default: [ true ]
49+
fips: [ false ]
50+
force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ]
51+
steps:
52+
- name: Checkout wolfProvider
53+
uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 1
56+
57+
- name: Checking OpenSSL/wolfProvider packages in cache
58+
uses: actions/cache/restore@v4
59+
id: wolfprov-cache-restore
60+
with:
61+
path: |
62+
${{ env.WOLFSSL_PACKAGES_PATH }}
63+
${{ env.OPENSSL_PACKAGES_PATH }}
64+
${{ env.WOLFPROV_PACKAGES_PATH }}
65+
key: openssl-wolfprov-debian-packages-${{ github.sha }}${{ matrix.replace_default && '-replace-default' || '' }}
66+
fail-on-cache-miss: true
67+
68+
- name: Install wolfSSL/OpenSSL/wolfprov packages
69+
run: |
70+
printf "Installing OpenSSL/wolfProvider packages:\n"
71+
ls -la ${{ env.WOLFSSL_PACKAGES_PATH }}
72+
ls -la ${{ env.OPENSSL_PACKAGES_PATH }}
73+
ls -la ${{ env.WOLFPROV_PACKAGES_PATH }}
74+
75+
apt install --reinstall -y \
76+
${{ env.WOLFSSL_PACKAGES_PATH }}/libwolfssl_*.deb
77+
78+
apt install --reinstall -y \
79+
${{ env.OPENSSL_PACKAGES_PATH }}/openssl_*.deb \
80+
${{ env.OPENSSL_PACKAGES_PATH }}/libssl3_*.deb \
81+
${{ env.OPENSSL_PACKAGES_PATH }}/libssl-dev_*.deb
82+
83+
apt install --reinstall -y \
84+
${{ env.WOLFPROV_PACKAGES_PATH }}/libwolfprov_*.deb
85+
86+
- name: Verify wolfProvider is properly installed
87+
run: |
88+
$GITHUB_WORKSPACE/scripts/verify-install.sh ${{ matrix.replace_default && '--replace-default' || '' }} ${{ matrix.fips && '--fips' || '' }}
89+
90+
- name: Install Python build dependencies
91+
run: |
92+
apt-get update
93+
apt-get install -y build-essential wget curl patch git \
94+
zlib1g-dev libbz2-dev libreadline-dev \
95+
libsqlite3-dev libncurses5-dev libgdbm-dev \
96+
libnss3-dev libffi-dev liblzma-dev \
97+
uuid-dev tk-dev libgdbm-compat-dev
98+
99+
- name: Download Python ${{ matrix.python_version }}
100+
run: |
101+
cd /tmp
102+
wget https://www.python.org/ftp/python/${{ matrix.python_version }}/Python-${{ matrix.python_version }}.tgz
103+
tar -xzf Python-${{ matrix.python_version }}.tgz
104+
105+
- name: Checkout OSP
106+
uses: actions/checkout@v4
107+
with:
108+
repository: wolfSSL/osp
109+
path: osp
110+
fetch-depth: 1
111+
- run: |
112+
cd /tmp/Python-${{ matrix.python_version }}
113+
patch -p1 < $GITHUB_WORKSPACE/osp/wolfProvider/python3/python3-${{ matrix.python_version }}-wolfprov.patch
114+
115+
- name: Build Python ${{ matrix.python_version }}
116+
working-directory: /tmp/Python-${{ matrix.python_version }}
117+
run: |
118+
# Configure Python to use the system OpenSSL (which has wolfProvider)
119+
./configure \
120+
--prefix=/opt/python${{ matrix.python_version }} \
121+
--with-openssl=/usr \
122+
--with-openssl-rpath=auto \
123+
--enable-optimizations
124+
125+
# Build Python
126+
make -j$(nproc)
127+
make install
128+
129+
- name: Run Python SSL tests with wolfProvider
130+
working-directory: /tmp/Python-${{ matrix.python_version }}
131+
shell: bash
132+
run: |
133+
export ${{ matrix.force_fail }}
134+
135+
# Show Python and OpenSSL info
136+
echo "Python version:"
137+
/opt/python${{ matrix.python_version }}/bin/python3 --version
138+
139+
echo "Python OpenSSL version:"
140+
/opt/python${{ matrix.python_version }}/bin/python3 -c "import ssl; print(ssl.OPENSSL_VERSION)"
141+
142+
echo "OpenSSL providers:"
143+
openssl list -providers
144+
145+
# Run Python SSL test suite
146+
/opt/python${{ matrix.python_version }}/bin/python3 -m test test_ssl -v 2>&1 | tee python-ssl-test.log
147+
TEST_RESULT=${PIPESTATUS[0]}
148+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} python-ssl
149+

0 commit comments

Comments
 (0)