Giter Site home page Giter Site logo

Caching doesn't work about install-poetry HOT 8 CLOSED

snok avatar snok commented on June 11, 2024
Caching doesn't work

from install-poetry.

Comments (8)

miigotu avatar miigotu commented on June 11, 2024 1

You should restore your cache before installing poetry
https://github.com/SickChill/SickChill/blob/develop/.github/workflows/upgrade_dependencies.yml

from install-poetry.

sondrelg avatar sondrelg commented on June 11, 2024

I've not changed working directory with Github actions before, so not sure exactly how it works, but is it possible that your venv is not located at .venv but instead at ../.venv?

from install-poetry.

maitham avatar maitham commented on June 11, 2024

Unfortunately not :(
image

from install-poetry.

maitham avatar maitham commented on June 11, 2024

Whats strange is running the following step, before source .venv/bin/activate works. But this just installs the dependencies again, which we're trying to avoid.

      #----------------------------------------------
      # install your root project, if required
      #----------------------------------------------
      - name: Install library
        run: poetry install --no-interaction

from install-poetry.

sondrelg avatar sondrelg commented on June 11, 2024

If you have the opportunity to create a demo project or some reproducible example that would help me a lot. Otherwise, maybe it would be helpful to sprinkle in a few ls statements to get a sense of where the venv is located relative to your working directory.

from install-poetry.

maitham avatar maitham commented on June 11, 2024

@sondrelg This still does not fix it!

from install-poetry.

maitham avatar maitham commented on June 11, 2024
on:
  push:
    branches-ignore:
      - main
name: Local Tests - Vital Background Pull
jobs:
  test-vital-background-pull:
    name: Local Tests - Vital Background Pull
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash
        working-directory: vital-background-pull
    steps:
      - uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v3
        with:
          python-version: 3.9
      - uses: harmon758/postgresql-action@v1
        with:
          postgresql version: "11"
          postgresql db: vital-test-db
          postgresql user: postgres
          postgresql password: local_password
      - name: Check running containers
        run: docker ps -a
      - name: Restore pip cache
        uses: actions/cache@v3
        with:
          path: $(python -m pip cache dir)
          key: ubuntu-latest-pip-3.9-${{ hashFiles('**/pyproject.toml') }}
          restore-keys: |
            ubuntu-latest-pip-3.9-
      #----------------------------------------------
      #  -----  install & configure poetry  -----
      #----------------------------------------------
      - name: Install Poetry
        uses: snok/install-poetry@v1
        with:
          version: 1.1.10
          virtualenvs-create: true
          virtualenvs-in-project: true
          installer-parallel: false
      - name: Restore poetry cache
        uses: actions/cache@v3
        with:
          path: $(poetry config cache-dir)
          key: ubuntu-latest-poetry-3.9-${{ hashFiles('**/pyproject.toml') }}
      - name: Restore virtualenv
        uses: actions/cache@v3
        id: cache-venv
        with:
          path: .venv
          key: ubuntu-latest-virtualenv-3.9-${{ hashFiles('**/pyproject.toml') }}
      #----------------------------------------------
      # install dependencies if cache does not exist
      #----------------------------------------------
      - name: Install dependencies
        if: steps.cache-venv.outputs.cache-hit != 'true'
        run: poetry install --no-interaction --no-root
      #----------------------------------------------
      #              run test suite
      #----------------------------------------------
      - name: Run tests
        run: |
          source .venv/bin/activate
          make check-format
          make mypy
          make lint
          make test

from install-poetry.

miigotu avatar miigotu commented on June 11, 2024

Can you use something like path: "$( poetry env list --full-path | grep Activated | cut -d' ' -f1 )" for the cache? Maybe you need the full path of the venv if your runner cwd is different. I haven't tested this command, but it should work I think.

from install-poetry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.