install-poetry
install-poetry copied to clipboard
Virtual environment created in wrong location
Here's my GitHub Action file:
name: Run tests
on:
push:
branches:
- develop
defaults:
run:
working-directory: ./services/flask
jobs:
tests:
runs-on: 'ubuntu-latest'
timeout-minutes: 5
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python 3.11.7
uses: actions/setup-python@v4
with:
python-version: 3.11.7
- name: Install and configure Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install poetry dependencies
run: poetry install --all-extras --no-interaction
- name: Run tests
run: |
source .venv/bin/activate
pytest tests/
Despite virtualenvs-in-project
being set to True, the virtual environment is created in /home/runner/.cache/pypoetry/virtualenvs
. Consequently, all my actions are now failing with error .venv/bin/activate: No such file or directory
.
Strangely, this action worked previously without any modifications.