This action can be used to set up the Poetry Environment. The action tries to load the environment from the cache. If the cache does not exist, the fresh environment is installed and saved to the cache.
The following key syntax is used to check if the cache exists:
key: "${{ runner.os }}-poetry-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('./poetry.lock') }}${{ inputs.cache-version }}"
- Typically, the value of the first variable is
Linux
- The second variable contains the python version. The value
3.9.7
is the example that can be used. - The third variable calculates the hash of the
poetry.lock
file. If thepoetry.lock
is updated, then the hash is different, which means that the key is different. - The last variable is the value of the input variable.
The following is the example of the key:
Linux-poetry-3.9.7-3c5d9aa2fd2aec48fd6a7de22cde35e3d3193e2141961270823edbdf12c104ed
If the key is changed, then this action invalidates the cache and creates a new environment. The new environment is then saved to the cache.
python-version
: Defines the python version which will be deployed on the system. Example values are:3.6
,3.7
,3.8
,3.9
. Defaults to3.11
.cache-version
: Can be used to specify the different version of the cache. This string is appended to the key. Defaults to empty string.poetry-version
: Defines the poetry version which will be deployed on the system. Default ofNone
or""
installs the latest version.poetry-install-options
: Specifies any additional options pass to Poetry when installing dependencies. Defaults to--only dev
.
cache-used
: ReturnsTrue
if the environment was loaded from the cache, or empty string if the fresh environment is installed.python-version
: Returns the exact version installed. For example:3.6.15
,3.7.12
,3.8.12
,3.9.7