From 9ed244d7701e87cbf1f8ad926aad585007b6cf23 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 | 11 +------- .github/workflows/tests.yml | 50 +++++++++++++++++++++++++++++++++++ dev-requirements.txt | 1 + 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index c496798..7b6195b 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,16 +24,8 @@ 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 - name: Run ruff - run: | - ruff format --diff . - ruff check --diff . \ No newline at end of file + run: uv run pytest -v \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..5983fe2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,50 @@ +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 ruff + run: | + ruff format --diff . + ruff check --diff . \ 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