From 045335779ea5710c3d4ce60565ff89d61ebb611f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Lilleb=C3=B8=20Gundersen?= Date: Sun, 12 Feb 2023 00:16:36 +0100 Subject: [PATCH] chore: Remove old scripts This might break a couple of workflows (hope not), but it's been 18 months since we changed the workflow to not rely on these, and the readme-examples have always used `v1`, so think the likelihood of things breaking for people is sufficiently low to finally go ahead with this. --- .github/workflows/test.yml | 12 -------- scripts/README.md | 4 --- scripts/v1.1/main.sh | 45 --------------------------- scripts/v1.2/main.sh | 63 -------------------------------------- 4 files changed, 124 deletions(-) delete mode 100644 scripts/README.md delete mode 100755 scripts/v1.1/main.sh delete mode 100644 scripts/v1.2/main.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b2abb690..7388b0ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -103,15 +103,3 @@ jobs: - uses: snok/install-poetry@v1 - uses: snok/install-poetry@v1.1 - uses: snok/install-poetry@v1.2 - - # Legacy: make sure old scripts are not deleted - # The scripts folder contains scripts that are fetched by older versions of the - # action. They're unfortunately fetched from the main branch. - # If we delete these scripts, those versions of the action will fail. - test-scripts-exist: - runs-on: ubuntu-latest - steps: - # v1.1 script loaded in < 1.1.4 - - uses: snok/install-poetry@v1.1.4 - # v1.2 script loaded in > 1.1.4 - - uses: snok/install-poetry@v1.1.6 diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index eb305387..00000000 --- a/scripts/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The scripts in the scripts folder should not ever change. - -Previous versions of the action would curl scripts from the repos main branch, -meaning that if we remove them, old pinned versions of the action will break. diff --git a/scripts/v1.1/main.sh b/scripts/v1.1/main.sh deleted file mode 100755 index 2a7eb90b..00000000 --- a/scripts/v1.1/main.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# Give inputs sensible names -os=$1 -venv_create=$2 -venv_in_project=$3 -venv_path=$4 - -# Define OS specific help text -if [ "$os" == "Windows" ]; then - conf="\033[33mConfiguring Poetry for Windows!\033[0m" - act="source .venv/scripts/activate" - echo "VENV=.venv/scripts/activate" >>"$GITHUB_ENV" -else - conf="\033[33mConfiguring Poetry!\033[0m" - act="source .venv/bin/activate" - echo "VENV=.venv/bin/activate" >>"$GITHUB_ENV" -fi - -# Echo help texts -echo -e "\n\n-------------------------------------------------------------------------------\n\n$conf 🎉" -if [ "$venv_create" == true ] || [ "$venv_create" == "true" ]; then - # If user is creating a venv in-project we tell them how to activate venv - echo -e "\n\n\033[33mIf you are creating a venv in your project, you can activate it by running '$act'\033[0m" - echo -e "\n\033[33mIf you're running this in an OS matrix, use 'source \$VENV'\033[0m" -fi -if [ "$os" == "Windows" ]; then - # If $SHELL isn't some variation of bash, output a yellow-texted warning - echo -e "\n\n\033[33mMake sure to set your default shell to bash when on Windows.\033[0m" - echo -e "\n\033[33mSee the package docs for more information and examples.\033[0m" -fi -echo -e '\n-------------------------------------------------------------------------------\n' - -# Configure Poetry -if [ "$os" == "Windows" ]; then - ln -s "$HOME/.poetry/bin/poetry.bat" "poetry" - "$HOME/.poetry/bin/poetry.bat" config virtualenvs.create "$venv_create" - "$HOME/.poetry/bin/poetry.bat" config virtualenvs.in-project "$venv_in_project" - "$HOME/.poetry/bin/poetry.bat" config virtualenvs.path "$venv_path" -else - source "$HOME"/.poetry/env - poetry config virtualenvs.create "$venv_create" - poetry config virtualenvs.in-project "$venv_in_project" - poetry config virtualenvs.path "$venv_path" -fi diff --git a/scripts/v1.2/main.sh b/scripts/v1.2/main.sh deleted file mode 100644 index 37ee2cd4..00000000 --- a/scripts/v1.2/main.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# Give inputs sensible names -os=$1 -venv_create=$2 -venv_in_project=$3 -venv_path=$4 -version=$5 -installation_script=$6 - -# Set path for each OS - done because Poetry inference is inconsistent -# on mac-runners, and we need to know the install path so we can add it to $GITHUB_PATH -if [ "$os" == "Windows" ]; then - path="C:/Users/runneradmin/AppData/Roaming/Python/Scripts/" -else - path="$HOME/.local/" -fi - -# Install Poetry -POETRY_HOME=$path python3 $installation_script --yes --version=$version - -# Add to path -echo "$path/bin" >>$GITHUB_PATH -export PATH="$path/bin:$PATH" - -# Configure Poetry -if [ "$os" == "Windows" ]; then - # Adding to path on windows doesn't immediately take effect - # so calling the executable directly here - should be available - # in next steps regardless. - "$path/bin/poetry.exe" config virtualenvs.create "$venv_create" - "$path/bin/poetry.exe" config virtualenvs.in-project "$venv_in_project" - "$path/bin/poetry.exe" config virtualenvs.path "$venv_path" -else - poetry config virtualenvs.create "$venv_create" - poetry config virtualenvs.in-project "$venv_in_project" - poetry config virtualenvs.path "$venv_path" -fi - -# Define OS specific help texts -if [ "$os" == "Windows" ]; then - conf="\033[33mConfiguring Poetry for Windows!\033[0m" - act="source .venv/scripts/activate" - echo "VENV=.venv/scripts/activate" >>"$GITHUB_ENV" -else - conf="\033[33mConfiguring Poetry!\033[0m" - act="source .venv/bin/activate" - echo "VENV=.venv/bin/activate" >>"$GITHUB_ENV" -fi - -# Output help texts -echo -e "\n\n-------------------------------------------------------------------------------\n\n$conf 🎉" -if [ "$venv_create" == true ] || [ "$venv_create" == "true" ]; then - # If user is creating a venv in-project we tell them how to activate venv - echo -e "\n\n\033[33mIf you are creating a venv in your project, you can activate it by running '$act'\033[0m" - echo -e "\n\033[33mIf you're running this in an OS matrix, use 'source \$VENV'\033[0m" -fi -if [ "$os" == "Windows" ]; then - # If $SHELL isn't some variation of bash, output a yellow-texted warning - echo -e "\n\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 -echo -e '\n-------------------------------------------------------------------------------\n'