1- # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
41name : build
52
63on :
1916 strategy :
2017 fail-fast : false
2118 matrix :
22- python-version : ["3.7","3. 8", "3.9","3.10"]
19+ python-version : [ "3.8", "3.9","3.10" ]
2320
2421 steps :
2522 - uses : actions/checkout@v3
@@ -28,27 +25,34 @@ jobs:
2825 with :
2926 python-version : ${{ matrix.python-version }}
3027
31- - name : Create virtual environment
32- run : python -m venv venv
28+ - uses : snok/install-poetry@v1
29+ with :
30+ version : 1.3.1
31+ virtualenvs-create : true
32+ virtualenvs-in-project : true
33+ installer-parallel : true
34+
35+ - name : Load cached venv
36+ id : cached-poetry-dependencies
37+ uses : actions/cache@v3
38+ with :
39+ path : .venv
40+ key : venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
3341
34- - name : Activate virtual environment
42+ - name : Install dependencies
43+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
3544 run : |
36- ls
37- source ./venv/bin/activate
45+ poetry install --with dev --all-extras
3846
39- - name : Install dependencies
47+ - name : Check linting
4048 run : |
41- python -m pip install --upgrade pip
42- python -m pip install flake8 pytest
43- if [ -f .github/workflows/requirements.txt ]; then pip install -r .github/workflows/requirements.txt; fi
49+ poetry run task lint
4450
45- - name : Lint with flake8
51+ - name : Check formatting
4652 run : |
47- # stop the build if there are Python syntax errors or undefined names
48- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=venv
49- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
50- flake8 . --count --exit-zero --exclude=venv --max-complexity=10 --max-line-length=127 --statistics
53+ poetry run task is-formatted
54+
5155 - name : Test with pytest
5256 run : |
53- python -m spacy download en_core_web_sm
54- pytest
57+ poetry run task force-cpu-torch
58+ poetry run task test
0 commit comments