-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (46 loc) · 1.58 KB
/
run-unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Unit tests
on:
push:
workflow_call:
jobs:
container_job:
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
pydantic-version: ['lockfile']
fastapi-version: ['0.103.2', 'lockfile']
fail-fast: false
container: python:${{ matrix.python-version }}-slim
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update
apt install curl git build-essential libpq-dev libffi-dev -y
python -m pip install --upgrade pip
pip install flit
flit install --deps develop
if [ "${{ matrix.pydantic-version }}" != "lockfile" ]; then
pip install pydantic[email]~=${{ matrix.pydantic-version }}
fi
if [ "${{ matrix.fastapi-version }}" != "lockfile" ]; then
pip install fastapi~=${{ matrix.fastapi-version }}
else
flit install --extras fastapi
fi
env:
FLIT_ROOT_INSTALL: 1
- name: Run Unit tests
run: pytest tests/unit_tests --cov-branch --cov=pydantic_forms --ignore=tests --cov-report=xml
env:
COVERAGE_FILE: reports/.coverage.${{ matrix.python-version }}
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage.xml