Skip to content

Commit

Permalink
ci: try using pipx for poetry install
Browse files Browse the repository at this point in the history
  • Loading branch information
mariugul committed Sep 3, 2024
1 parent d1d16f4 commit aaadca3
Showing 1 changed file with 6 additions and 52 deletions.
58 changes: 6 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,61 +71,15 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Cache Poetry Install
id: cache-poetry
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
.venv
${{ runner.os == 'windows-latest' && 'C:\\opt\\poetry' || (runner.os == 'macos-latest' && '$HOME/.poetry') || '/opt/poetry' }}
key: ${{ matrix.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/pyproject.toml')
}}

- name: Install Poetry on macOS
if: steps.cache-poetry.outputs.cache-hit != 'true' && runner.os == 'macOS'
run: |
export POETRY_HOME=$HOME/.poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
shell: bash

- name: Install Poetry on Linux/macOS
if: steps.cache-poetry.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
if [ $RUNNER_OS = 'macOS' ]; then
export POETRY_HOME=$HOME/.poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
else
export POETRY_HOME=/opt/poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
fi
- name: Install Poetry on Windows
if: steps.cache-poetry.outputs.cache-hit != 'true' && runner.os == 'Windows'
shell: pwsh
run: |
curl -sSL https://install.python-poetry.org | python -
- name: Add Poetry to PATH
if: runner.os == 'Linux' || runner.os == 'macOS'
- name: Install pipx
run: |
if [ $RUNNER_OS = 'Linux' ]; then
echo "/opt/poetry/bin" >> $GITHUB_PATH
elif [ $RUNNER_OS = 'macOS' ]; then
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
fi
python3 -m pip install --upgrade pip
python3 -m pip install pipx
python3 -m pipx ensurepath
- name: Add Poetry to PATH
if: runner.os == 'Windows'
- name: Install Poetry
run: |
echo "C:\\opt\\poetry\\Scripts" >> $GITHUB_PATH
echo "$env:USERPROFILE\\.poetry\\bin" >> $env:GITHUB_PATH
pipx install poetry
- name: Install Package
run: poetry install --no-interaction --no-ansi
Expand Down

0 comments on commit aaadca3

Please sign in to comment.