Add pytest with GitHub Action workflow

This commit is contained in:
2024-11-09 13:21:50 -06:00
parent db260ecfa3
commit 818c3cb7bc
6 changed files with 156 additions and 1 deletions

40
.github/workflows/test.yaml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Pytest
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.12.7"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v4
with:
path: ~/.cache
key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: cd backend && poetry install --no-interaction --no-root
- name: Install library
run: cd backend && poetry install --no-interaction
- run: |
source $VENV
pytest --version