diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 281cc11..5ea7fc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,32 +27,42 @@ jobs: run: sudo apt-get install libcurl4-openssl-dev - name: Install Poetry - uses: snok/install-poetry@v1.1.2 + uses: snok/install-poetry@v1.1.6 + with: + virtualenvs-create: true + virtualenvs-in-project: true - - name: Cache Poetry virtualenv - uses: actions/cache@v1 - id: cache + #---------------------------------------------- + # load cached venv if cache exists + #---------------------------------------------- + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v2 with: - path: ~/.virtualenvs - key: poetry-${{ hashFiles('**/poetry.lock') }} - restore-keys: | - poetry-${{ hashFiles('**/poetry.lock') }} + path: .venv + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + #---------------------------------------------- + # install dependencies if cache does not exist + #---------------------------------------------- + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root - - name: Set Poetry config - run: | - poetry config virtualenvs.in-project false - poetry config virtualenvs.path ~/.virtualenvs - - - name: Install Dependencies - run: | - poetry install - if: steps.cache.outputs.cache-hit != 'true' + #---------------------------------------------- + # install your root project, if required + #---------------------------------------------- + - name: Install library + run: poetry install --no-interaction - name: Code Quality - run: poetry run black . --check + run: | + source .venv/bin/activate + black . --check - name: Test with pytest - run: poetry run pytest -n 2 --cov . --cov-report=xml + run: | + source .venv/bin/activate + pytest -n 2 --cov . --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 @@ -63,4 +73,4 @@ jobs: name: codecov-umbrella fail_ci_if_error: true path_to_write_report: ./codecov_report.gz - verbose: true \ No newline at end of file + verbose: true