blob: dec17aba33ffa5e59f80534198c802c43fee2449 [file]
name: Unit Tests
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.10", "3.11"]
poetry-version: ["1.8.3"]
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0 # need all versions to be able to access server tree commit logs
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: python3-dev libldap2-dev libsasl2-dev
version: 1.0
- name: Load cached Poetry Binary
id: cached-poetry-binary
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}
- name: Install Poetry
if: steps.cached-poetry-binary.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
shell: bash
run: poetry install --no-interaction --no-root ${{ inputs.install-args }}
- name: Test with pytest
run: |
poetry run python3 -m pytest tests/*.py