Skip to content

Expand ATTRIBUTE_TYPES for GOSTR support. #27

Expand ATTRIBUTE_TYPES for GOSTR support.

Expand ATTRIBUTE_TYPES for GOSTR support. #27

Workflow file for this run

name: Coverage
on:
pull_request: {}
workflow_dispatch: {}
env:
UV_PYTHON_PREFERENCE: only-system
UV_NO_SYNC: "1"
PKCS11_TOKEN_LABEL: "TEST"
PKCS11_TOKEN_PIN: "1234"
PKCS11_TOKEN_SO_PIN: "5678"
jobs:
# For now, we run the coverage as a separate job.
# At the time of writing, the latest version of Cython's line tracing
# seems to lead to segfaults in Python 3.13 -> TODO: investigate
pytest-coverage:
runs-on: ubuntu-latest
strategy:
matrix:
pkcs11-platform:
- softhsm
- opencryptoki
steps:
- name: Acquire sources
uses: actions/checkout@v4
- name: Arm coverage-only compiler directives
# Unfortunately, it doesn't seem to be possible to pass directives
# to Cython through environment variables: https://github.com/cython/cython/issues/3930
# Doing it here is still better than introducing a non-declarative setup.py into the
# build again.
run: sed -i 's/#coverage#cython/#cython/g' pkcs11/*.pyx
- uses: ./.github/actions/test-setup
id: setup
with:
os: ubuntu-latest
python-version: "3.12"
dependency-group: coverage
token-label: ${{ env.PKCS11_TOKEN_LABEL }}
token-so-pin: ${{ env.PKCS11_TOKEN_SO_PIN }}
token-user-pin: ${{ env.PKCS11_TOKEN_PIN }}
pkcs11-platform: ${{ matrix.pkcs11-platform }}
env:
CFLAGS: "-DCYTHON_TRACE_NOGIL=1"
EXT_BUILD_DEBUG: "1"
- name: Run tests
run: uv run pytest -v --cov=pkcs11 --cov-branch --cov-report=xml:${{ matrix.pkcs11-platform }}-coverage.xml
env:
PKCS11_MODULE: ${{ steps.setup.outputs.module }}
- name: Stash coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-${{ strategy.job-index }}
path: "*-coverage.xml"
pytest-coverage-multilib:
runs-on: ubuntu-latest
steps:
- name: Acquire sources
uses: actions/checkout@v4
- uses: ./.github/actions/test-setup
id: setup
with:
os: ubuntu-latest
pkcs11-platform: multi
token-label: ${{ env.PKCS11_TOKEN_LABEL }}
token-so-pin: ${{ env.PKCS11_TOKEN_SO_PIN }}
token-user-pin: ${{ env.PKCS11_TOKEN_PIN }}
python-version: "3.12"
dependency-group: coverage
- name: Run tests
run: uv run pytest -v --cov=pkcs11 --cov-branch --cov-report=xml:multilib-coverage.xml tests/test_multilib.py
env:
PKCS11_MODULE: ${{ steps.setup.outputs.module }}
PKCS11_MODULE2: ${{ steps.setup.outputs.module2 }}
- name: Stash coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-multilib
path: "*-coverage.xml"
codecov-upload:
permissions:
actions: write
contents: read
runs-on: ubuntu-latest
needs: [pytest-coverage]
steps:
# checkout necessary to ensure the uploaded report contains the correct paths
- uses: actions/checkout@v4
- name: Retrieve coverage reports
uses: actions/download-artifact@v4
with:
pattern: coverage-*
path: ./reports/
- name: Upload all coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./reports/
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella