From ec62f29888960a76394b7fe2fccbabc5417ce587 Mon Sep 17 00:00:00 2001 From: Andrea Duina Date: Fri, 20 Dec 2024 14:39:57 +0100 Subject: [PATCH] fix cache --- .github/workflows/main.yml | 62 ++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e62d8e7..7588e9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,12 +25,10 @@ jobs: with: python-version: '3.12' - - name: Cache Poetry and Virtual Environment + - name: Cache dependencies uses: actions/cache@v3 with: - path: | - ~/.poetry - .venv + path: .venv key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} restore-keys: | poetry-${{ runner.os }}- @@ -40,20 +38,14 @@ jobs: curl -sSL https://install.python-poetry.org | python3 - echo "$HOME/.poetry/bin" >> $GITHUB_PATH + - name: Configure Poetry to use in-project virtualenv + run: | + poetry config virtualenvs.in-project true + - name: Install dependencies with Poetry run: | poetry install --sync --no-interaction - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: | - ~/.poetry - .venv - key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} - restore-keys: | - poetry-${{ runner.os }}- - check-formatting: runs-on: ubuntu-latest needs: setup-environment # Waits for setup-environment to finish @@ -67,21 +59,23 @@ jobs: with: python-version: '3.12' - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | python3 - - echo "$HOME/.poetry/bin" >> $GITHUB_PATH - - - name: Restore cached Poetry and Virtual Environment + - name: Cache dependencies uses: actions/cache@v3 with: - path: | - ~/.poetry - .venv + path: .venv key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} restore-keys: | poetry-${{ runner.os }}- + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + echo "$HOME/.poetry/bin" >> $GITHUB_PATH + + - name: Configure Poetry to use in-project virtualenv + run: | + poetry config virtualenvs.in-project true + - name: Check code formatting with Black run: | poetry run black --check . @@ -109,21 +103,23 @@ jobs: with: python-version: '3.12' - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | python3 - - echo "$HOME/.poetry/bin" >> $GITHUB_PATH - - - name: Restore cached Poetry and Virtual Environment + - name: Cache dependencies uses: actions/cache@v3 with: - path: | - ~/.poetry - .venv + path: .venv key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} restore-keys: | poetry-${{ runner.os }}- + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + echo "$HOME/.poetry/bin" >> $GITHUB_PATH + + - name: Configure Poetry to use in-project virtualenv + run: | + poetry config virtualenvs.in-project true + - name: Run tests with pytest run: | - poetry run pytest --maxfail=1 --disable-warnings -q + poetry run pytest --maxfail=1 --disable-warnings -q \ No newline at end of file