Skip to content

Commit ad59fc7

Browse files
committed
run test suite in github actions
1 parent ca2c419 commit ad59fc7

File tree

3 files changed

+119
-1
lines changed

3 files changed

+119
-1
lines changed

.github/workflows/tests.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Tests
2+
on:
3+
push:
4+
env:
5+
PKCS11_MODULE: /home/runner/lib/softhsm/libsofthsm2.so
6+
UV_PYTHON_PREFERENCE: only-system
7+
PKCS11_TOKEN_LABEL: TEST
8+
PKCS11_TOKEN_PIN: 1234
9+
PKCS11_TOKEN_SO_PIN: 5678
10+
jobs:
11+
run:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version:
16+
- "3.9"
17+
- "3.10"
18+
- "3.11"
19+
- "3.12"
20+
- "3.12"
21+
- "3.13"
22+
23+
steps:
24+
- name: Acquire sources
25+
uses: actions/[email protected]
26+
27+
- name: Setup Python
28+
uses: actions/[email protected]
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
architecture: x64
32+
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v4
35+
with:
36+
enable-cache: true
37+
python-version: ${{ matrix.python-version }}
38+
39+
- name: Install dev dependencies
40+
run: uv sync --all-extras
41+
42+
# Locally compile softhsmv2. For unknown reasons, the version installed by Ubuntu fails on
43+
# Github Actions (while working e.g. in Docker).
44+
- name: Install Softhsm
45+
run: |
46+
curl https://dist.opendnssec.org/source/softhsm-2.6.1.tar.gz | tar -zxv
47+
(cd softhsm-2.6.1 && ./configure --prefix=$HOME --disable-p11-kit --disable-gost && make all install CC="gcc" CXX="g++")
48+
echo "$HOME/bin" >> "$GITHUB_PATH"
49+
50+
- name: env test
51+
run: |
52+
echo $PATH
53+
softhsm2-util --version
54+
55+
- name: Initialize token
56+
run: softhsm2-util --init-token --free --label $PKCS11_TOKEN_LABEL --pin $PKCS11_TOKEN_PIN --so-pin $PKCS11_TOKEN_SO_PIN
57+
58+
- name: Run tests
59+
run: uv run pytest -v

pyproject.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ include = ["pkcs11*"]
6060
dev = [
6161
"cryptography>=44.0.0",
6262
"oscrypto>=1.3.0",
63+
"parameterized>=0.9.0",
64+
"pytest>=8.3.4",
6365
"ruff>=0.8.3",
6466
"setuptools>=75.6.0",
6567
"setuptools-scm>=8.1.0",
6668
"sphinx>=7.4.7",
6769
"sphinx-rtd-theme>=3.0.2",
68-
]
70+
]

uv.lock

+57
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)