Skip to content

Commit 359a4fe

Browse files
committed
Consolidate wheel smoketest into reusable action
1 parent bf26a93 commit 359a4fe

File tree

2 files changed

+60
-20
lines changed

2 files changed

+60
-20
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Wheel Smoketest
2+
description: Tests a built cryptography wheel by installing it and verifying basic functionality
3+
4+
inputs:
5+
python-path:
6+
description: 'Optional path to a specific Python interpreter to use for creating the venv'
7+
required: false
8+
default: ''
9+
build-requirements-path:
10+
description: 'Path to the build requirements file'
11+
required: true
12+
13+
runs:
14+
using: "composite"
15+
16+
steps:
17+
- name: Create virtual environment
18+
run: |
19+
if [ -n "${{ inputs.python-path }}" ]; then
20+
uv venv --python="${{ inputs.python-path }}"
21+
else
22+
uv venv
23+
fi
24+
shell: bash
25+
26+
- name: Install build requirements
27+
run: uv pip install --require-hashes -r "${{ inputs.build-requirements-path }}"
28+
shell: bash
29+
30+
- name: Install cryptography wheel
31+
run: uv pip install cryptography --no-index -f wheelhouse/
32+
shell: bash
33+
34+
- name: Show the wheel's minimum macOS SDK and architectures
35+
if: runner.os == 'macOS'
36+
run: |
37+
find .venv/lib/*/site-packages/cryptography/hazmat/bindings -name '*.so' -exec vtool -show {} \;
38+
shell: bash
39+
40+
- name: Verify cryptography installation and OpenSSL version
41+
run: |
42+
uv run - <<'EOF'
43+
from cryptography.hazmat.backends.openssl.backend import backend
44+
print(f"Loaded: {backend.openssl_version_text()}")
45+
print(f"Linked Against: {backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii')}")
46+
EOF
47+
shell: bash

.github/workflows/wheel-builder.yml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ jobs:
162162
exit 0
163163
fi
164164
165-
- run: uv venv --python=/opt/python/${{ matrix.PYTHON.VERSION }}/bin/python
166-
- run: uv pip install --require-hashes -r $BUILD_REQUIREMENTS_PATH
167-
- run: uv pip install cryptography --no-index -f wheelhouse/
168-
- run: |
169-
echo "from cryptography.hazmat.backends.openssl.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))" | uv run -
165+
- name: Smoketest
166+
uses: ./.github/actions/wheel-smoketest
167+
with:
168+
python-path: /opt/python/${{ matrix.PYTHON.VERSION }}/bin/python
169+
build-requirements-path: ${{ env.BUILD_REQUIREMENTS_PATH }}
170170

171171
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
172172
with:
@@ -291,14 +291,10 @@ jobs:
291291
ARCHFLAGS: ${{ matrix.PYTHON.ARCHFLAGS }}
292292
_PYTHON_HOST_PLATFORM: ${{ matrix.PYTHON._PYTHON_HOST_PLATFORM }}
293293

294-
- run: uv venv
295-
- run: uv pip install --require-hashes -r $BUILD_REQUIREMENTS_PATH
296-
- run: uv pip install cryptography --no-index -f wheelhouse/
297-
- name: Show the wheel's minimum macOS SDK and architectures
298-
run: |
299-
find .venv/lib/*/site-packages/cryptography/hazmat/bindings -name '*.so' -exec vtool -show {} \;
300-
- run: |
301-
echo "from cryptography.hazmat.backends.openssl.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))" | uv run -
294+
- name: Smoketest
295+
uses: ./.github/actions/wheel-smoketest
296+
with:
297+
build-requirements-path: ${{ env.BUILD_REQUIREMENTS_PATH }}
302298

303299
- run: |
304300
echo "CRYPTOGRAPHY_WHEEL_NAME=$(basename $(ls wheelhouse/cryptography*.whl))" >> $GITHUB_ENV
@@ -383,13 +379,10 @@ jobs:
383379
uv build --wheel --require-hashes --build-constraint=$BUILD_REQUIREMENTS_PATH cryptography*.tar.gz $PY_LIMITED_API -o wheelhouse/
384380
shell: bash
385381
386-
- run: uv venv
387-
- run: uv pip install --require-hashes -r "${BUILD_REQUIREMENTS_PATH}"
388-
shell: bash
389-
- run: uv pip install cryptography --no-index -f wheelhouse/
390-
- name: Print the OpenSSL we built and linked against
391-
run: |
392-
echo "from cryptography.hazmat.backends.openssl.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))" | uv run -
382+
- name: Smoketest
383+
uses: ./.github/actions/wheel-smoketest
384+
with:
385+
build-requirements-path: ${{ env.BUILD_REQUIREMENTS_PATH }}
393386

394387
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
395388
with:

0 commit comments

Comments
 (0)