-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 2.67 KB
/
ci.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: CI Pipeline
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
pipeline:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: abatilo/actions-poetry@v4
- name: Configure Poetry virtual environments
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Cache Poetry virtual environment
uses: actions/cache@v4
id: cached-poetry-dependencies
with:
path: |
.venv
~/.cache/pypoetry
key: poetry-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock', 'pyproject.toml') }}
restore-keys: |
poetry-${{ runner.os }}-py${{ matrix.python-version }}-
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install Poetry dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install project
run: poetry install --no-interaction
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run test suite with coverage
run: poetry run pytest tests/ -v --cov=anyparser_langchain --cov-report=term-missing --cov-fail-under=100
#----------------------------------------------
# format checking
#----------------------------------------------
- name: Check code formatting with Black
run: poetry run black ./ --check