1414 # seems to lead to segfaults in Python 3.13 -> TODO: investigate
1515 pytest-coverage :
1616 runs-on : ubuntu-latest
17+ strategy :
18+ matrix :
19+ pkcs11-platform :
20+ - softhsm
21+ - opencryptoki
1722 steps :
1823 - name : Acquire sources
1924 uses : actions/checkout@v4
@@ -23,50 +28,27 @@ jobs:
2328 # Doing it here is still better than introducing a non-declarative setup.py into the
2429 # build again.
2530 run : sed -i 's/#coverage#cython/#cython/g' pkcs11/*.pyx
26- - name : Setup Python
27- uses : actions/setup-python@v5
28- with :
29- python-version : 3.12
30- - uses : ./.github/actions/install-softhsm
31- id : softhsm
32- with :
33- os : ubuntu-latest
34- token-label : ${{ env.PKCS11_TOKEN_LABEL }}
35- token-so-pin : ${{ env.PKCS11_TOKEN_SO_PIN }}
36- token-user-pin : ${{ env.PKCS11_TOKEN_PIN }}
37- - uses : ./.github/actions/install-opencryptoki
38- # only run opencryptoki tests on ubuntu
39- # (macos and windows don't seem to be supported)
40- id : opencryptoki
31+ - uses : ./.github/actions/test-setup
32+ id : setup
4133 with :
4234 os : ubuntu-latest
35+ python-version : " 3.12"
36+ dependency-group : coverage
4337 token-label : ${{ env.PKCS11_TOKEN_LABEL }}
4438 token-so-pin : ${{ env.PKCS11_TOKEN_SO_PIN }}
4539 token-user-pin : ${{ env.PKCS11_TOKEN_PIN }}
46- - name : Install uv
47- uses : astral-sh/setup-uv@v4
48- with :
49- enable-cache : true
50- python-version : 3.12
51- - name : Install testing dependencies
52- run : uv sync --no-dev --exact --group coverage
40+ pkcs11-platform : ${{ matrix.pkcs11-platform }}
5341 env :
5442 CFLAGS : " -DCYTHON_TRACE_NOGIL=1"
5543 EXT_BUILD_DEBUG : " 1"
56- - name : Run tests with SoftHSM
57- run : uv run pytest -v --cov=pkcs11 --cov-branch --cov-report=xml:python-softhsm-coverage.xml
58- env :
59- PKCS11_MODULE : ${{ steps.softhsm.outputs.module }}
60- - name : Run tests with opencryptoki
61- run : uv run pytest -v --cov=pkcs11 --cov-branch --cov-report=xml:python-opencryptoki-coverage.xml
44+ - name : Run tests
45+ run : uv run pytest -v --cov=pkcs11 --cov-branch --cov-report=xml:${{ matrix.pkcs11-platform }}-coverage.xml
6246 env :
63- PKCS11_MODULE : ${{ steps.opencryptoki.outputs.module }}
64- # For testing logic around swapping PKCS#11 libs
65- PKCS11_MODULE2 : ${{ steps.softhsm.outputs.module }}
47+ PKCS11_MODULE : ${{ steps.setup.outputs.module }}
6648 - name : Stash coverage report
6749 uses : actions/upload-artifact@v4
6850 with :
69- name : coverage
51+ name : coverage-${{ strategy.job-index }}
7052 path : " *-coverage.xml"
7153 codecov-upload :
7254 permissions :
8062 - name : Retrieve coverage reports
8163 uses : actions/download-artifact@v4
8264 with :
83- name : coverage
65+ pattern : coverage-*
8466 path : ./reports/
8567 - name : Upload all coverage reports to Codecov
8668 uses : codecov/codecov-action@v5
0 commit comments