Skip to content

Commit

Permalink
run test suite in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Dec 27, 2024
1 parent ca2c419 commit f6c1b64
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Tests
on:
push:
env:
PKCS11_MODULE: /home/runner/lib/softhsm/libsofthsm2.so
UV_PYTHON_PREFERENCE: only-system
PKCS11_TOKEN_LABEL: TEST
PKCS11_TOKEN_PIN: 1234
PKCS11_TOKEN_SO_PIN: 5678
jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.12"
- "3.13"

steps:
- name: Acquire sources
uses: actions/[email protected]

- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install dev dependencies
run: uv sync --all-extras

# Locally compile softhsmv2. For unknown reasons, the version installed by Ubuntu fails on
# Github Actions (while working e.g. in Docker).
- name: Install Softhsm
run: |
curl https://dist.opendnssec.org/source/softhsm-2.6.1.tar.gz | tar -zxv
(cd softhsm-2.6.1 && ./configure --prefix=$HOME --disable-p11-kit --disable-gost && make all install CC="gcc" CXX="g++")
echo "$HOME/bin" >> "$GITHUB_PATH"
echo "PKCS11_MODULE=$HOME/lib/softhsm/libsofthsm2.so" >> "$GITHUB_ENV"
- name: env test
run: |
env
softhsm2-util --version
- name: Initialize token
run: softhsm2-util --init-token --free --label $PKCS11_TOKEN_LABEL --pin $PKCS11_TOKEN_PIN --so-pin $PKCS11_TOKEN_SO_PIN

- name: Run tests
run: uv run pytest -v
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ include = ["pkcs11*"]
dev = [
"cryptography>=44.0.0",
"oscrypto>=1.3.0",
"parameterized>=0.9.0",
"pytest>=8.3.4",
"ruff>=0.8.3",
"setuptools>=75.6.0",
"setuptools-scm>=8.1.0",
"sphinx>=7.4.7",
"sphinx-rtd-theme>=3.0.2",
]
]
57 changes: 57 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f6c1b64

Please sign in to comment.