snok / install-poetry

Github action for installing and configuring Poetry
MIT License
572 stars 53 forks source link

Respect $POETRY_HOME if set #128

Closed mahmoudhossam closed 1 year ago

mahmoudhossam commented 1 year ago

Closes #127

sondrelg commented 1 year ago

Have you tested this on your project @mahmoudhossam? If you replace snok/install-poetry@v1 with mahmoudhossam/install-poetry@44a56c8b4d9b7199fd3b34e1ec73b8679b4281c0 it should run from your fork.

Would be helpful to know before moving forward.

miigotu commented 1 year ago

This looks good to me.

mahmoudhossam commented 1 year ago

Have you tested this on your project @mahmoudhossam? If you replace snok/install-poetry@v1 with mahmoudhossam/install-poetry@44a56c8b4d9b7199fd3b34e1ec73b8679b4281c0 it should run from your fork.

Would be helpful to know before moving forward.

Good idea, I'll test it and get back to you next week.

mahmoudhossam commented 1 year ago

So it didn't work, trying it out in a private project and testing with act still doesn't work

Using the action like this:

- name: Install poetry
        uses: mahmoudhossam/install-poetry@44a56c8b4d9b7199fd3b34e1ec73b8679b4281c0
        env:
          POETRY_HOME: /usr

Results in this output:

[API/test] ⭐ Run Main Install poetry
[API/test]   🐳  docker cp src=/Users/mahmoud/.cache/act/mahmoudhossam-install-poetry@44a56c8b4d9b7199fd3b34e1ec73b8679b4281c0/ dst=/var/run/act/actions/mahmoudhossam-install-poetry@44a56c8b4d9b7199fd3b34e1ec73b8679b4281c0/
[API/test] ⭐ Run Main Install and configure Poetry
[API/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4-composite-0.sh] user= workdir=
|
| Setting Poetry installation path as /root/.local
|
| Installing Poetry 👷
|
| Retrieving Poetry metadata
|
| # Welcome to Poetry!
|
| This will download and install the latest version of Poetry,
| a dependency and package manager for Python.
|
| It will add the `poetry` command to Poetry's bin directory, located at:
|
| /root/.local/bin
|
| You can uninstall at any time by executing this script with the --uninstall option,
| and these changes will be reverted.
|
  Installing Poetry (1.5.1): Done
|
| Poetry (1.5.1) is installed now. Great!
|
| To get started you need Poetry's bin directory (/root/.local/bin) in your `PATH`
| environment variable.
|
| Add `export PATH="/root/.local/bin:$PATH"` to your shell configuration file.
|
| Alternatively, you can call Poetry explicitly with `/root/.local/bin/poetry`.
|
| You can test that everything is set up by executing:
|
| `poetry --version`
|
|
| Installation completed. Configuring settings 🛠
|
| Done ✅
|
| If you are creating a venv in your project, you can activate it by running 'source .venv/bin/activate'. If you're running this in an OS matrix, you can use 'source $VENV' instead, as an OS agnostic option
[API/test]   ✅  Success - Main Install and configure Poetry

Not sure how to debug this since my bash-fu isn't that great.

@sondrelg Any ideas?

sondrelg commented 1 year ago

Testing this locally:

# test.sh

INSTALL_PATH="${POETRY_HOME:-$HOME/.local}"

echo "$INSTALL_PATH"

that syntax seems to work on ubuntu

❯ POETRY_HOME=some_path ./test.sh
some_path

❯ ./test.sh                      
/home/sondrelg/.local
sondrelg commented 1 year ago

This looks good to me :+1: I'm unfortunately going away for two weeks for summer, so I'm a little hesitant to release this now in case it breaks anything. I'll be back to release in ~12 days.

In the meantime, if you @miigotu want to do it, feel free :slightly_smiling_face:

sondrelg commented 1 year ago

Sorry for the delay, and thanks for the contribution! I'll try to get this released shortly :partying_face: