From 5b8e466bf60cdbe96bea443a3509369f4611ceca Mon Sep 17 00:00:00 2001 From: Ruslan Sayfutdinov Date: Wed, 11 Sep 2024 17:12:25 +0200 Subject: [PATCH] Don't install pipx again --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a58abe5..a591e43 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,8 +27,40 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Setup environtment + shell: bash + run: | + PIPX_HOME="$HOME/.pipx" + PIPX_BIN_DIR="$PIPX_HOME/bin" + echo "PIPX_HOME=$PIPX_HOME" >> $GITHUB_ENV + echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" >> $GITHUB_ENV + echo "$PIPX_BIN_DIR" >> $GITHUB_PATH + echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH + + - name: Get pipx and poetry latest versions + id: latest-versions + run: | + pipx_version=$(curl -s https://pypi.org/pypi/pipx/json | jq -r .info.version) + poetry_version=$(curl -s https://pypi.org/pypi/poetry/json | jq -r .info.version) + echo "pipx=$pipx_version" >> $GITHUB_OUTPUT + echo "poetry=$poetry_version" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + name: Cache Poetry + with: + path: ~/.pipx/ + key: > + ${{ format('pipx-{0}-{1}-{2}', + matrix.os, + matrix.python-version, + steps.latest-versions.outputs.poetry, + ) }} + + - name: Install pipx + run: pip install --user pipx + - name: Install Poetry - uses: abatilo/actions-poetry@v3 + run: pipx install poetry - name: Use local virtual environment run: | @@ -45,9 +77,10 @@ jobs: venv-${{ matrix.os }}-${{ matrix.python-version }}- - name: Install dependencies with Poetry - if: steps.cache-poetry-deps.outputs.cache-hit != 'true' - run: poetry install + run: | + poetry env use python3 + poetry install - - name: Test package building + - name: Check if package builds run: | poetry build