Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual environment created in wrong location #145

Open
rushilsrivastava opened this issue Jan 12, 2024 · 0 comments
Open

Virtual environment created in wrong location #145

rushilsrivastava opened this issue Jan 12, 2024 · 0 comments

Comments

@rushilsrivastava
Copy link

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/install-poetry@v1.3.4
              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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant