@@ -42,32 +42,46 @@ jobs:
4242 python-version : 3.7
4343
4444 - name : Install Poetry
45- uses : snok/install-poetry@v1.1.2
46-
47- - name : Cache Poetry virtualenv
48- uses : actions/cache@v1
49- id : cache
45+ uses : snok/install-poetry@v1.1.6
5046 with :
51- path : ~/.virtualenvs
52- key : poetry-${{ hashFiles('**/poetry.lock') }}
53- restore-keys : |
54- poetry-${{ hashFiles('**/poetry.lock') }}
55-
56- - name : Set Poetry config
57- run : |
58- poetry config virtualenvs.in-project false
59- poetry config virtualenvs.path ~/.virtualenvs
60-
61- - name : Install Dependencies
62- run : |
63- poetry install
64- if : steps.cache.outputs.cache-hit != 'true'
47+ virtualenvs-create : true
48+ virtualenvs-in-project : true
49+
50+ # ----------------------------------------------
51+ # load cached venv if cache exists
52+ # ----------------------------------------------
53+ - name : Load cached venv
54+ id : cached-poetry-dependencies
55+ uses : actions/cache@v2
56+ with :
57+ path : .venv
58+ key : venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
59+ # ----------------------------------------------
60+ # install dependencies if cache does not exist
61+ # ----------------------------------------------
62+ - name : Install dependencies
63+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
64+ run : poetry install --no-interaction --no-root
65+
66+ # ----------------------------------------------
67+ # install your root project, if required
68+ # ----------------------------------------------
69+ - name : Install library
70+ run : poetry install --no-interaction
71+
72+ # ----------------------------------------------
73+ # Activate Env
74+ # ----------------------------------------------
6575
6676 - name : Code Quality
67- run : poetry run black . --check
77+ run : |
78+ source .venv/bin/activate
79+ black . --check
6880
6981 - name : Test with pytest
70- run : poetry run pytest -n 2 --cov . --cov-report=xml
82+ run : |
83+ source .venv/bin/activate
84+ pytest -n 2 --cov . --cov-report=xml
7185
7286 - name : Upload coverage to Codecov
7387 uses : codecov/codecov-action@v1
0 commit comments