Skip to content

Commit

Permalink
Don't use pipx
Browse files Browse the repository at this point in the history
  • Loading branch information
KapJI committed Sep 12, 2024
1 parent de53abc commit 7bfa8bd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 43 deletions.
28 changes: 6 additions & 22 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,19 @@ runs:
shell: bash
if: runner.os != 'Windows'
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
PYTHON_USER_BASE="$(python3 -m site --user-base)"
PYTHON_USER_BASE="$(python -m site --user-base)"
echo "$PYTHON_USER_BASE/bin" >> $GITHUB_PATH
echo "python-user-base=$PYTHON_USER_BASE" >> $GITHUB_OUTPUT
echo "pipx-home=$PIPX_HOME" >> $GITHUB_OUTPUT
echo "pip-cache=$PYTHON_USER_BASE" >> $GITHUB_OUTPUT
- name: Setup environment in pwsh (Windows)
id: env-pwsh
shell: pwsh
if: runner.os == 'Windows'
run: |
$PIPX_HOME = "$env:USERPROFILE\.pipx"
$PIPX_BIN_DIR = "$PIPX_HOME\bin"
echo "PIPX_HOME=$PIPX_HOME" | Out-File -Append -FilePath $env:GITHUB_ENV
echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | Out-File -Append -FilePath $env:GITHUB_ENV
echo "$PIPX_BIN_DIR" | Out-File -Append -FilePath $env:GITHUB_PATH
$PYTHON_USER_BASE = (python -m site --user-base)
echo "$PYTHON_USER_BASE\Scripts" | Out-File -Append -FilePath $env:GITHUB_PATH
echo "python-user-base=$PYTHON_USER_BASE" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
echo "pipx-home=$PIPX_HOME" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
echo "$PYTHON_USER_BASE\Scripts" >> $env:GITHUB_PATH
echo "pip-cache=$PYTHON_USER_BASE" >> $env:GITHUB_OUTPUT
outputs:
python-user-base:
description: "The Python user base path"
value: ${{ steps.env-bash.outputs.python-user-base || steps.env-pwsh.outputs.python-user-base }}
pipx-home:
description: "Home directory of pipx"
value: ${{ steps.env-bash.outputs.pipx-home || steps.env-pwsh.outputs.pipx-home }}
pip-cache:
value: ${{ steps.env-bash.outputs.pip-cache || steps.env-pwsh.outputs.pip-cache }}
34 changes: 13 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,34 @@ jobs:
uses: ./.github/actions/setup-environment
id: environment

- name: Get pipx and poetry latest versions
- name: Get poetry latest version
id: latest-versions
shell: bash
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
echo "PIP_USER: $PIP_USER"
- uses: actions/cache@v4
name: Cache pipx
with:
path: ${{ steps.environment.outputs.python-user-base }}
key: >
${{ format('pip-user-{0}-{1}-{2}',
matrix.os,
matrix.python-version,
steps.latest-versions.outputs.pipx
) }}
echo "Python user base: $(python -m site --user-base)"
- uses: actions/cache@v4
name: Cache Poetry
with:
path: ${{ steps.environment.outputs.pipx-home }}
path: ${{ steps.environment.outputs.pip-cache }}
key: >
${{ format('pipx-home-{0}-{1}-{2}',
${{ format('pip-cache-{0}-{1}-{2}',
matrix.os,
matrix.python-version,
steps.latest-versions.outputs.poetry
) }}
- name: Install pipx
run: pip install --user --verbose pipx

- name: Install or update Poetry
run: pipx install poetry==${{ steps.latest-versions.outputs.poetry }}
run: |
pip install --user poetry==${{ steps.latest-versions.outputs.poetry }}
pip show poetry
- name: Log poetry paths
if: runner.os == 'Windows'
run: |
(Get-Command poetry).Source
- name: Use local virtual environment
run: |
Expand All @@ -86,6 +77,7 @@ jobs:
run: |
poetry env use python3
poetry install
poetry env info
- name: Check if package builds
run: |
Expand Down

0 comments on commit 7bfa8bd

Please sign in to comment.