-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathaction.yml
More file actions
100 lines (87 loc) · 3.08 KB
/
Copy pathaction.yml
File metadata and controls
100 lines (87 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
name: FPF/Poetry
description: Install Python and setup a local Poetry environment
inputs:
python-version:
description: Version of Python to install
default: '3.11'
required: false
poetry-directory:
description: Path to the root of the Poetry project
default: '.'
required: false
poetry-requirements:
description: Path to the requirements.txt to use for installing Poetry
required: false
default: ''
root:
description: Whether to install the root package dependencies
required: false
default: 'true'
groups:
description: List of Poetry groups to install
required: false
default: ''
extras:
description: List of package extras to install
required: false
default: ''
outputs:
poetry-venv-path:
description: Path to the Poetry configured virtual environment
value: ${{ steps.configure-poetry-path.outputs.poetry-venv-path }}
runs:
using: composite
steps:
- name: Install python ${{ inputs.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Configure Job Cache
uses: actions/cache@v5
with:
path: |
~/.cache/pip
~/.cache/pypoetry/cache
~/.poetry
key: ${{ runner.os }}-py${{ inputs.python-version }}-${{ hashFiles(format('{0}/poetry.lock', inputs.poetry-directory)) }} # yamllint disable-line rule:line-length
- name: Install Poetry
shell: bash
env:
POETRY_REQUIREMENTS: ${{ inputs.poetry-requirements || format('{0}/requirements-poetry.txt', github.action_path) }} # yamllint disable-line rule:line-length
# yamllint disable rule:line-length
run: |
mkdir --parents /home/runner/.local/share/poetry-runtime
which python
python --version
python -m venv /home/runner/.local/share/poetry-runtime
/home/runner/.local/share/poetry-runtime/bin/pip install \
--requirement="$POETRY_REQUIREMENTS" \
--disable-pip-version-check \
--require-hashes \
--no-color
echo "Successfully installed $(~/.local/share/poetry-runtime/bin/poetry --version --no-color)"
echo "/home/runner/.local/share/poetry-runtime/bin" >> $GITHUB_PATH
/home/runner/.local/share/poetry-runtime/bin/python --version
# yamllint enable rule:line-length
- name: Install Poetry groups
shell: bash
if: ${{ inputs.root == 'true' || inputs.groups || inputs.extras }}
working-directory: ${{ inputs.poetry-directory }}
env:
POETRY_EXTRAS: ${{ inputs.extras }}
POETRY_GROUPS: ${{ inputs.groups }}
run: >-
poetry install
${{ inputs.root != 'true' && '--no-root' || ' ' }}
${{ inputs.root == 'true' && '--only=main' || ' ' }}
${{ inputs.extras == '' && ' ' || '--extras="$POETRY_EXTRAS"' }}
${{ inputs.groups == '' && ' ' || '--only="$POETRY_GROUPS"' }}
--no-ansi
--no-interaction
- name: Export Poetry path
shell: bash
id: configure-poetry-path
working-directory: ${{ inputs.poetry-directory }}
run: |
echo "poetry-venv-path=$(poetry env info --path)/bin" >> $GITHUB_OUTPUT