Skip to content

Commit aac14af

Browse files
author
David Robertson
authored
Allow specifying extras (#3)
1 parent 1a7066c commit aac14af

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

action.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ inputs:
99
description: Poetry version to install via pip.
1010
required: false
1111
default: "1.1.12"
12+
extras:
13+
description: >
14+
If present, a space separated list of extras to pass to
15+
`poetry install --extra ...`. Either way, dev-dependencies
16+
will be installed.
17+
# If https://github.com/python-poetry/poetry/issues/3413 get solved, I think
18+
# we should make this action install all extras by default.
19+
required: false
20+
default: ""
1221
runs:
1322
using: composite
1423
steps:
@@ -58,7 +67,7 @@ runs:
5867
uses: actions/cache@v2
5968
with:
6069
path: ${{ steps.poetry-venvs.outputs.dir }}
61-
key: poetry-venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
70+
key: poetry-venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ inputs.extras }}
6271

6372
- name: Check that the poetry lockfile is up to date
6473
# This is rather hacky. We look for the warning message in poetry's
@@ -70,11 +79,16 @@ runs:
7079
(echo pyproject.toml was updated without running \`poetry lock --no-update\`. && false)
7180
shell: bash
7281

73-
- name: Install dependencies
74-
if: "${{ steps.poetry-venv-cache.outputs.cache-hit != 'true' }}"
82+
- name: Install base dependencies only
83+
if: steps.poetry-venv-cache.outputs.cache-hit != 'true' && inputs.extras == ''
7584
run: poetry install --no-interaction --no-root
7685
shell: bash
7786

87+
- name: Install poetry with --extras=${{ inputs.extras }}
88+
if: steps.poetry-venv-cache.outputs.cache-hit != 'true' && inputs.extras != ''
89+
run: poetry install --no-interaction --no-root --extras="${{ inputs.extras }}"
90+
shell: bash
91+
7892
# (Not sure if this is needed if there's a cache hit?)
7993
- name: Install project
8094
run: poetry install --no-interaction

0 commit comments

Comments
 (0)