Skip to content

Commit 1bee779

Browse files
committed
run test suite in github actions
1 parent 82a6b78 commit 1bee779

File tree

3 files changed

+106
-1
lines changed

3 files changed

+106
-1
lines changed

.github/workflows/tests.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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: Install uv
28+
uses: astral-sh/setup-uv@v4
29+
with:
30+
enable-cache: true
31+
32+
- name: Setup Python
33+
uses: actions/[email protected]
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
architecture: x64
37+
38+
- name: Install dev dependencies
39+
run: uv sync --all-extras
40+
41+
# Locally compile softhsmv2. For unknown reasons, the version installed by Ubuntu fails on
42+
# Github Actions (while working e.g. in Docker).
43+
- name: Install Softhsm
44+
run: |
45+
curl https://dist.opendnssec.org/source/softhsm-2.6.1.tar.gz | tar -zxv
46+
(cd softhsm-2.6.1 && ./configure --prefix=$HOME --disable-p11-kit --disable-gost && make all install CC="gcc" CXX="g++")
47+
echo "$HOME/bin" >> "$GITHUB_PATH"
48+
49+
- name: env test
50+
run: |
51+
echo $PATH
52+
softhsm2-util --version
53+
54+
- name: Initialize token
55+
run: softhsm2-util --init-token --free --label $PKCS11_TOKEN_LABEL --pin $PKCS11_TOKEN_PIN --so-pin $PKCS11_TOKEN_SO_PIN
56+
57+
- name: Run tests
58+
run: uv run pytest -v

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ include = ["pkcs11*"]
6060
dev = [
6161
"cryptography>=44.0.0",
6262
"oscrypto>=1.3.0",
63+
"pytest>=8.3.4",
6364
"ruff>=0.8.3",
6465
"setuptools>=75.6.0",
6566
"setuptools-scm>=8.1.0",
6667
"sphinx>=7.4.7",
6768
"sphinx-rtd-theme>=3.0.2",
68-
]
69+
]

uv.lock

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

0 commit comments

Comments
 (0)