Skip to content

Commit 8869883

Browse files
Put multilib tests in their own job
1 parent e6570a5 commit 8869883

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed

.github/actions/test-setup/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ outputs:
2727
module:
2828
description: Path to PKCS#11 module
2929
value: ${{ steps.install-result.outputs.module }}
30+
module2:
31+
description: Path to alternative PKCS#11 module ('multi' only)
32+
value: ${{ steps.install-result.outputs.module2 }}
3033
runs:
3134
using: "composite"
3235
steps:
@@ -35,7 +38,7 @@ runs:
3538
with:
3639
python-version: ${{ inputs.python-version }}
3740
- uses: ./.github/actions/install-softhsm
38-
if: inputs.pkcs11-platform == 'softhsm'
41+
if: inputs.pkcs11-platform == 'softhsm' || inputs.pkcs11-platform == 'multi'
3942
id: softhsm
4043
with:
4144
os: ${{ inputs.os }}
@@ -45,7 +48,7 @@ runs:
4548
- uses: ./.github/actions/install-opencryptoki
4649
# only run opencryptoki tests on ubuntu
4750
# (macos and windows don't seem to be supported)
48-
if: inputs.pkcs11-platform == 'opencryptoki'
51+
if: inputs.pkcs11-platform == 'opencryptoki' || inputs.pkcs11-platform == 'multi'
4952
id: opencryptoki
5053
with:
5154
os: ${{ inputs.os }}
@@ -60,6 +63,9 @@ runs:
6063
echo "module=${{ steps.opencryptoki.outputs.module }}" >> "$GITHUB_OUTPUT"
6164
elif [[ "$PLATFORM" == 'softhsm' ]]; then
6265
echo "module=${{ steps.softhsm.outputs.module }}" >> "$GITHUB_OUTPUT"
66+
elif [[ "$PLATFORM" == 'multi' ]]; then
67+
echo "module=${{ steps.softhsm.outputs.module }}" >> "$GITHUB_OUTPUT"
68+
echo "module2=${{ steps.opencryptoki.outputs.module }}" >> "$GITHUB_OUTPUT"
6369
else
6470
echo "$PLATFORM is not a valid PKCS#11 platform choice"
6571
exit 1

.github/workflows/coverage.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,31 @@ jobs:
5050
with:
5151
name: coverage-${{ strategy.job-index }}
5252
path: "*-coverage.xml"
53+
pytest-coverage-multilib:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Acquire sources
57+
uses: actions/checkout@v4
58+
- uses: ./.github/actions/test-setup
59+
id: setup
60+
with:
61+
os: ubuntu-latest
62+
pkcs11-platform: multi
63+
token-label: ${{ env.PKCS11_TOKEN_LABEL }}
64+
token-so-pin: ${{ env.PKCS11_TOKEN_SO_PIN }}
65+
token-user-pin: ${{ env.PKCS11_TOKEN_PIN }}
66+
python-version: "3.12"
67+
dependency-group: coverage
68+
- name: Run tests
69+
run: uv run pytest -v --cov=pkcs11 --cov-branch --cov-report=xml:multilib-coverage.xml tests/test_multilib.py
70+
env:
71+
PKCS11_MODULE: ${{ steps.setup.outputs.module }}
72+
PKCS11_MODULE2: ${{ steps.setup.outputs.module2 }}
73+
- name: Stash coverage report
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: coverage-multilib
77+
path: "*-coverage.xml"
5378
codecov-upload:
5479
permissions:
5580
actions: write
@@ -71,4 +96,4 @@ jobs:
7196
directory: ./reports/
7297
flags: unittests
7398
env_vars: OS,PYTHON
74-
name: codecov-umbrella
99+
name: codecov-umbrella

.github/workflows/tests.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111
PKCS11_TOKEN_PIN: "1234"
1212
PKCS11_TOKEN_SO_PIN: "5678"
1313
jobs:
14-
run:
14+
tests:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
# Our test suite is pretty fast, so fail-fast: false allows for better troubleshooting.
@@ -54,3 +54,32 @@ jobs:
5454
run: uv run pytest -v
5555
env:
5656
PKCS11_MODULE: ${{ steps.setup.outputs.module }}
57+
multilib-tests:
58+
runs-on: ubuntu-latest
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
python-version:
63+
- "3.9"
64+
- "3.10"
65+
- "3.11"
66+
- "3.12"
67+
- "3.13"
68+
steps:
69+
- name: Acquire sources
70+
uses: actions/checkout@v4
71+
- uses: ./.github/actions/test-setup
72+
id: setup
73+
with:
74+
os: ubuntu-latest
75+
pkcs11-platform: multi
76+
token-label: ${{ env.PKCS11_TOKEN_LABEL }}
77+
token-so-pin: ${{ env.PKCS11_TOKEN_SO_PIN }}
78+
token-user-pin: ${{ env.PKCS11_TOKEN_PIN }}
79+
python-version: ${{ matrix.python-version }}
80+
dependency-group: testing
81+
- name: Run tests
82+
run: uv run pytest -v tests/test_multilib.py
83+
env:
84+
PKCS11_MODULE: ${{ steps.setup.outputs.module }}
85+
PKCS11_MODULE2: ${{ steps.setup.outputs.module2 }}

0 commit comments

Comments
 (0)