Skip to content

Commit

Permalink
Replace get-poetry script with install-poetry (get-poetry deprecated)
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrelg committed May 21, 2021
1 parent fe3362f commit 6e6adf6
Show file tree
Hide file tree
Showing 8 changed files with 1,731 additions and 23 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ 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,
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 @@ -170,3 +187,14 @@ jobs:
- run: |
source $VENV
pytest --version
# 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
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: 13 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ runs:
steps:
- name: Install and configure Poetry
run: |
get_poetry="$(mktemp)"
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py --output "$get_poetry"
python $get_poetry --yes --version=${{ inputs.version }}
installation_script="$(mktemp)"
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/48339106eb0d403a3c66519317488c8185844b32/install-poetry.py --output "$installation_script"
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
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"
install="$(mktemp)"
curl -sSL https://raw.githubusercontent.com/snok/install-poetry/main/scripts/v1.1/main.sh --output "$install"
chmod +x "$install"
$install ${{ runner.os }} ${{ inputs.virtualenvs-create }} ${{ inputs.virtualenvs-in-project }} ${{ inputs.virtualenvs-path }}
shell: bash
$config_script \
${{ runner.os }} \
${{ inputs.virtualenvs-create }} \
${{ inputs.virtualenvs-in-project }} \
${{ inputs.virtualenvs-path }} \
${{ inputs.version }} \
$installation_script
shell: bash
Loading

0 comments on commit 6e6adf6

Please sign in to comment.