Skip to content

Commit

Permalink
Upgrade version to 1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrelg committed May 21, 2021
1 parent 9a715c7 commit f0e6185
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 63 deletions.
84 changes: 51 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on: pull_request

env:
# JSON variables (used in our strategy/matrix)
SUPPORTED_POETRY_VERSIONS: '\"poetry-version\":[\"1.1.0\", \"1.1.2\", \"1.1.4\", \"1.1.5\", \"1.1.6\", \"1.2.0a1\"]'
SUPPORTED_POETRY_VERSIONS: '\"poetry-version\":[\"1.1.0\", \"1.1.2\", \"1.1.4\", \"1.1.5\", \"1.1.6\"]'
SUPPORTED_PYTHON_VERSIONS: '\"python-version\":[\"3.7\", \"3.8\", \"3.9\"]'
SUPPORTED_OPERATING_SYSTEMS: '\"os\":[\"ubuntu-latest\", \"macos-latest\", \"windows-latest\"]'

Expand Down Expand Up @@ -40,35 +40,35 @@ jobs:
# matrix:
# - os: [ubuntu-latest, ...]
steps:
- id: set-matrix-vars
run: |
echo "::set-output name=full-matrix::{${{ env.SUPPORTED_POETRY_VERSIONS }},${{ env.SUPPORTED_PYTHON_VERSIONS }},${{ env.SUPPORTED_OPERATING_SYSTEMS }}}"
echo "::set-output name=py-os-matrix::{${{ env.SUPPORTED_PYTHON_VERSIONS }},${{ env.SUPPORTED_OPERATING_SYSTEMS }}}"
echo "::set-output name=os-matrix::{${{ env.SUPPORTED_OPERATING_SYSTEMS }}}"
- id: set-matrix-vars
run: |
echo "::set-output name=full-matrix::{${{ env.SUPPORTED_POETRY_VERSIONS }},${{ env.SUPPORTED_PYTHON_VERSIONS }},${{ env.SUPPORTED_OPERATING_SYSTEMS }}}"
echo "::set-output name=py-os-matrix::{${{ env.SUPPORTED_PYTHON_VERSIONS }},${{ env.SUPPORTED_OPERATING_SYSTEMS }}}"
echo "::set-output name=os-matrix::{${{ env.SUPPORTED_OPERATING_SYSTEMS }}}"
# This job makes sure that the install-poetry action works,
# using the default settings, on all combinations of Python versions,
# Poetry versions, and operating systems that we want to test
test-supported-os-python-poetry:
needs: set-env
strategy:
fail-fast: true
matrix: ${{fromJson(needs.set-env.outputs.full-matrix)}}
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: ./
with:
version: ${{ matrix.poetry-version }}
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: poetry install --no-root --no-interaction
- run: poetry install --no-interaction
- run: poetry run pytest --version
# # This job makes sure that the install-poetry action works,
# # using the default settings, on all combinations of Python versions,
# # Poetry versions, and operating systems that we want to test
# test-supported-os-python-poetry:
# needs: set-env
# strategy:
# fail-fast: true
# matrix: ${{fromJson(needs.set-env.outputs.full-matrix)}}
# defaults:
# run:
# shell: bash
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v2
# - uses: ./
# with:
# version: ${{ matrix.poetry-version }}
# - uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# - run: poetry install --no-root --no-interaction
# - run: poetry install --no-interaction
# - run: poetry run pytest --version

# Makes sure not creating a venv works
test-create-venv-false:
Expand Down Expand Up @@ -146,6 +146,23 @@ jobs:
source $VENV
pytest --version
# Makes sure caching works (this is sort of redundant)
temp:
needs: set-env
strategy:
fail-fast: false
matrix: ${{fromJson(needs.set-env.outputs.os-matrix)}}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install poetry
uses: ./
with:
virtualenvs-create: true
virtualenvs-in-project: true
- run: poetry --version

# Makes sure all operating system combinations can activate venvs
# using the custom install-poetry $VENV environment variable
test-venv-env-var:
Expand All @@ -171,12 +188,13 @@ jobs:
source $VENV
pytest --version
# Makes sure scripts are not deleted.
# If we deleted the script by accident, old versions of the action would fail
test-v11-script:
# Make sure scripts are not deleted.
# If we deleted the scripts folder (or subfolders) by accident,
# different versions of the action would 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.5
# - uses: snok/install-poetry@v1.1.5
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ If all you need is default Poetry, simply add this to your workflow:

```yaml
- name: Install Poetry
uses: snok/install-poetry@v1.1.4
uses: snok/install-poetry@v1.1.5
```
If you want to set Poetry config settings, or install a specific version, you can specify inputs
```yaml
- name: Install and configure Poetry
uses: snok/install-poetry@v1.1.4
uses: snok/install-poetry@v1.1.5
with:
version: 1.1.6
virtualenvs-create: true
Expand All @@ -49,7 +49,7 @@ or just to make changes to the Poetry config *after* invoking the action -
you can do so in a subsequent step, like this

```yaml
- uses: snok/install-poetry@v1.1.4
- uses: snok/install-poetry@v1.1.5
- run: poetry config experimental.new-installer false
```

Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.4
uses: snok/install-poetry@v1.1.5
with:
virtualenvs-create: true
virtualenvs-in-project: true
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.4
uses: snok/install-poetry@v1.1.5
with:
virtualenvs-create: true
virtualenvs-in-project: true
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.4
uses: snok/install-poetry@v1.1.5
with:
virtualenvs-create: true
virtualenvs-in-project: true
Expand Down Expand Up @@ -360,7 +360,7 @@ jobs:
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1.1.4
uses: snok/install-poetry@v1.1.5
with:
virtualenvs-create: true
virtualenvs-in-project: true
Expand Down Expand Up @@ -395,7 +395,7 @@ All of the examples we've added use these Poetry settings

```yaml
- name: Install Poetry
uses: snok/install-poetry@v1.1.4
uses: snok/install-poetry@v1.1.5
with:
virtualenvs-create: true
virtualenvs-in-project: true
Expand Down
22 changes: 14 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ runs:
steps:
- name: Install and configure Poetry
run: |
install_poetry="$(mktemp)"
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/48339106eb0d403a3c66519317488c8185844b32/install-poetry.py --output "$install_poetry"
python3 $install_poetry --yes --version=${{ inputs.version }}
installation_script="$(mktemp)"
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/48339106eb0d403a3c66519317488c8185844b32/install-poetry.py --output "$installation_script"
install="$(mktemp)"
curl -sSL https://raw.githubusercontent.com/snok/install-poetry/v1.2/scripts/v1.2/main.sh --output "$install"
chmod +x "$install"
$install ${{ runner.os }} ${{ inputs.virtualenvs-create }} ${{ inputs.virtualenvs-in-project }} ${{ inputs.virtualenvs-path }}
shell: bash
config_script="$(mktemp)"
curl -sSL https://raw.githubusercontent.com/snok/install-poetry/v1.2/scripts/v1.2/main.sh --output "$config_script"
chmod +x "$config_script"
$config_script \
${{ runner.os }} \
${{ inputs.virtualenvs-create }} \
${{ inputs.virtualenvs-in-project }} \
${{ inputs.virtualenvs-path }} \
${{ inputs.version }} \
$installation_script
shell: bash
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "install-poetry"
version = "1.1.4"
version = "1.1.5"
description = ""
authors = ["Sondre Lillebø Gundersen <sondrelg@live.no.com>"]
maintainers = ["Jonas Krüger Svensson <jonasks@hotmail.com>"]
Expand Down
32 changes: 19 additions & 13 deletions scripts/v1.2/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ os=$1
venv_create=$2
venv_in_project=$3
venv_path=$4
version=$5
installation_script=$6

# 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"
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"
echo "VENV=.venv/bin/activate" >>"$GITHUB_ENV"
fi

# Echo help texts
Expand All @@ -32,22 +34,26 @@ fi
echo -e '\n-------------------------------------------------------------------------------\n'

if [ "$os" == "Windows" ]; then
# Define path
path="C:/Users/runneradmin/AppData/Roaming/Python/Scripts/poetry.exe"
path="C:/Users/runneradmin/AppData/Roaming/Python/Scripts/"
else
path="$HOME/.local/"
fi

# Configure Poetry
poetry config virtualenvs.create "$venv_create"
poetry config virtualenvs.in-project "$venv_in_project"
poetry config virtualenvs.path "$venv_path"
POETRY_HOME=$path python3 $installation_script --yes --version=$version

echo "$path/bin" >>$GITHUB_PATH
export PATH="$path/bin:$PATH"

# Add system path, so the executable is made available in the next workflow steps
echo "C:/Users/runneradmin/AppData/Roaming/Python/Scripts/" >> $GITHUB_PATH
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
PATH="$HOME/.local/bin:$PATH"
poetry config virtualenvs.create "$venv_create"
poetry config virtualenvs.in-project "$venv_in_project"
poetry config virtualenvs.path "$venv_path"
echo "$HOME/.local/bin" >> $GITHUB_PATH
fi


0 comments on commit f0e6185

Please sign in to comment.