From 3747fe51dfb2cb236eaedb185b13e101573c0e38 Mon Sep 17 00:00:00 2001 From: Mathias Ertl Date: Mon, 9 Dec 2024 21:35:26 +0100 Subject: [PATCH] run test in github actions (and with pytest) --- .github/workflows/quality.yml | 7 ----- .github/workflows/tests.yml | 48 +++++++++++++++++++++++++++++++++++ dev-requirements.txt | 1 + 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index c496798..36570a3 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -10,7 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Acquire sources uses: actions/checkout@v4.1.1 @@ -25,12 +24,6 @@ jobs: python-version: "3.12" architecture: x64 - - name: Apply caching of dependencies - uses: actions/cache@v4.0.0 - with: - path: ~/.cache/pip - key: pip-${{ hashFiles('**/requirements-*.txt') }} - - name: Install dev dependencies run: uv pip install -r dev-requirements.txt diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d1b1fa7 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,48 @@ +name: Code quality +on: + push: +env: + UV_SYSTEM_PYTHON: 1 + +jobs: + + run: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.12" + + steps: + - name: Install APT dependencies + run: sudo apt-get install -y softhsm2 + + - name: Create SoftHSM token + run: softhsm2-util --init-token --free --label TEST --pin 1234 --so-pin 5678 + + - name: Acquire sources + uses: actions/checkout@v4.1.1 + + - name: Install uv + uses: astral-sh/setup-uv@v4 + with: + enable-cache: true + + - name: Setup Python + uses: actions/setup-python@v5.0.0 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + + - name: Install the project + run: uv sync --all-extras --dev + + - name: Install dev dependencies + run: uv pip install -r dev-requirements.txt + + - name: Run tests + run: uv run pytest -v \ No newline at end of file diff --git a/dev-requirements.txt b/dev-requirements.txt index 9b1cdb3..db6183b 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -5,6 +5,7 @@ setuptools_scm oscrypto cryptography parameterized +pytest==8.3.4 ruff==0.8.2 sphinx sphinx-rtd-theme \ No newline at end of file