-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move main script to main.sh #70
Changes from all commits
ff04e81
da8d736
81ed015
194e7b3
336b9a7
46d7fcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Ensure git handles line endings correctly | ||
# Set the default behavior, in case core.autocrlf is not set. | ||
* text=auto | ||
|
||
# Ensure shell scripts are strictly linux-style | ||
*.sh text eol=lf |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,60 @@ | ||||||||||||||||||||
#!/usr/bin/env bash | ||||||||||||||||||||
|
||||||||||||||||||||
installation_script="$(mktemp)" | ||||||||||||||||||||
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/48339106eb0d403a3c66519317488c8185844b32/install-poetry.py --output "$installation_script" | ||||||||||||||||||||
|
||||||||||||||||||||
if [ "${RUNNER_OS}" == "Windows" ]; then | ||||||||||||||||||||
path="C:/Users/runneradmin/AppData/Roaming/Python/Scripts" | ||||||||||||||||||||
else | ||||||||||||||||||||
path="$HOME/.local/" | ||||||||||||||||||||
fi | ||||||||||||||||||||
|
||||||||||||||||||||
echo -e "\n\033[33mSetting Poetry installation path as $path\033[0m\n" | ||||||||||||||||||||
echo -e "\033[33mInstalling Poetry 👷\033[0m\n" | ||||||||||||||||||||
|
||||||||||||||||||||
if [ "${VERSION}" == "latest" ]; then | ||||||||||||||||||||
POETRY_HOME=$path python3 $installation_script --yes ${INSTALLATION_ARGUMENTS} | ||||||||||||||||||||
else | ||||||||||||||||||||
POETRY_HOME=$path python3 $installation_script --yes --version=${VERSION} ${INSTALLATION_ARGUMENTS} | ||||||||||||||||||||
fi | ||||||||||||||||||||
Comment on lines
+15
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming the condition becomes redundant if we use
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thought, I'm not so sure the version will be inferred by the installer. I can help test tomorrow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||
|
||||||||||||||||||||
echo "$path/bin" >>"$GITHUB_PATH" | ||||||||||||||||||||
export PATH="$path/bin:$PATH" | ||||||||||||||||||||
|
||||||||||||||||||||
if [ "${RUNNER_OS}" == "Windows" ]; then | ||||||||||||||||||||
poetry_="$path/bin/poetry.exe" | ||||||||||||||||||||
else | ||||||||||||||||||||
poetry_=poetry | ||||||||||||||||||||
fi | ||||||||||||||||||||
|
||||||||||||||||||||
# Expand any "~" in VIRTUALENVS_PATH | ||||||||||||||||||||
VIRTUALENVS_PATH="${VIRTUALENVS_PATH/#\~/$HOME}" | ||||||||||||||||||||
|
||||||||||||||||||||
$poetry_ config virtualenvs.create ${VIRTUALENVS_CREATE} | ||||||||||||||||||||
$poetry_ config virtualenvs.in-project ${VIRTUALENVS_IN_PROJECT} | ||||||||||||||||||||
$poetry_ config virtualenvs.path ${VIRTUALENVS_PATH} | ||||||||||||||||||||
|
||||||||||||||||||||
config="$($poetry_ config --list)" | ||||||||||||||||||||
|
||||||||||||||||||||
if echo "$config" | grep -q -c "installer.parallel"; then | ||||||||||||||||||||
$poetry_ config installer.parallel "${INSTALLER_PARALLEL}" | ||||||||||||||||||||
fi | ||||||||||||||||||||
|
||||||||||||||||||||
Comment on lines
+33
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming this all becomes redundant if we use
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While using ❯ /Users/sondrelg/.local/bin/poetry config --list
cache-dir = "/Users/sondrelg/Library/Caches/pypoetry"
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = true # <-- should be false
virtualenvs.in-project = null
virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/sondrelg/Library/Caches/pypoetry/virtualenvs I suppose these values are checked when running |
||||||||||||||||||||
if [ "${RUNNER_OS}" == "Windows" ]; then | ||||||||||||||||||||
act="source .venv/scripts/activate" | ||||||||||||||||||||
echo "VENV=.venv/scripts/activate" >>"$GITHUB_ENV" | ||||||||||||||||||||
else | ||||||||||||||||||||
act="source .venv/bin/activate" | ||||||||||||||||||||
echo "VENV=.venv/bin/activate" >>"$GITHUB_ENV" | ||||||||||||||||||||
fi | ||||||||||||||||||||
|
||||||||||||||||||||
echo -e "\n\033[33mInstallation completed. Configuring settings 🛠\033[0m" | ||||||||||||||||||||
echo -e "\n\033[33mDone ✅\033[0m" | ||||||||||||||||||||
|
||||||||||||||||||||
if [ "${VIRTUALENVS_CREATE}" == true ] || [ "${VIRTUALENVS_CREATE}" == "true" ]; then | ||||||||||||||||||||
echo -e "\n\033[33mIf you are creating a venv in your project, you can activate it by running '$act'. If you're running this in an OS matrix, you can use 'source \$VENV' instead, as an OS agnostic option\033[0m" | ||||||||||||||||||||
fi | ||||||||||||||||||||
if [ "${RUNNER_OS}" == "Windows" ]; then | ||||||||||||||||||||
echo -e "\n\033[33mMake sure to set your default shell to bash when on Windows.\033[0m" | ||||||||||||||||||||
echo -e "\n\033[33mSee the github action docs for more information and examples.\033[0m" | ||||||||||||||||||||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poetry supports environment variables for settings (docs). I wonder if we might be able to kill two birds with one stone here. Perhaps we can rename the env vars to
POETRY_*
and drop code like this from the shell script completelyNeeds testing, but unless I'm mistaken this should be inferred by Poetry if we do this, so the extra specification will become redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this works out, I think it might also be worth checking if a user can overwrite our env vars using the
env
tag when specifying the action, like this:It would be great if the
POETRY_VERSION
here would take precedence, but I'm guessing it wouldn't.