File tree Expand file tree Collapse file tree 4 files changed +55
-81
lines changed
actions/setup-python-poetry Expand file tree Collapse file tree 4 files changed +55
-81
lines changed Original file line number Diff line number Diff line change 1+ name : Set up Python and Poetry
2+ inputs :
3+ python-version :
4+ default : 3.11.9
5+ poetry-version :
6+ default : 1.8.2
7+ outputs :
8+ python-path :
9+ value : ${{ steps.setup-python.outputs.python-path }}
10+ python-version :
11+ value : ${{ steps.setup-python.outputs.python-version }}
12+ runs :
13+ using : composite
14+ steps :
15+ - name : Set up Python
16+ uses : actions/setup-python@v5
17+ id : setup-python
18+ with :
19+ python-version : ${{ inputs.python-version }}
20+ # The default pipx paths on GitHub-hosted runners are locations that actions/cache cannot
21+ # write to, like /opt/pipx and "C:\Program Files (x86)\pipx". See
22+ # https://github.com/pypa/pipx/discussions/1051 for more info.
23+ - name : Set pipx paths
24+ id : set-pipx-paths
25+ run : |
26+ echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV"
27+ echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV"
28+ echo "$HOME/.local/bin" >> "$GITHUB_PATH"
29+ echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT"
30+ echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT"
31+ # Use bash so that $HOME is evaluated properly.
32+ shell : bash
33+ - name : Cache pipx
34+ id : cache-pipx
35+ uses : actions/cache@v4
36+ with :
37+ path : |
38+ ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }}
39+ ${{ steps.set-pipx-paths.outputs.pipx-home }}
40+ key : pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ inputs.poetry-version }}
41+ - name : Set up Poetry
42+ if : steps.cache-pipx.outputs.cache-hit != 'true'
43+ run : pipx install poetry==${{ inputs.poetry-version }} --python '${{ steps.setup-python.outputs.python-path }}'
Original file line number Diff line number Diff line change 44 workflow_call :
55 workflow_dispatch :
66
7- env :
8- POETRY_VERSION : 1.8.2
9- PYTHON_VERSION : 3.11.9
10-
117jobs :
128 check_docs :
139 name : Check docs
1410 runs-on : ubuntu-latest
1511 steps :
1612 - name : Check out repo
1713 uses : actions/checkout@v4
18- - name : Set up Python
19- uses : actions/setup-python@v5
20- id : setup-python
21- with :
22- python-version : ${{ env.PYTHON_VERSION }}
23- - name : Set pipx paths
24- id : set-pipx-paths
25- run : |
26- echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV"
27- echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV"
28- echo "$HOME/.local/bin" >> "$GITHUB_PATH"
29- echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT"
30- echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT"
31- shell : bash
32- - name : Cache pipx
33- uses : actions/cache@v4
34- with :
35- path : |
36- ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }}
37- ${{ steps.set-pipx-paths.outputs.pipx-home }}
38- key : pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }}
39- - name : Set up Poetry
40- run : pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}'
14+ - name : Set up Python and Poetry
15+ id : setup-python-poetry
16+ uses : /.github/actions/setup-python-poetry
4117 - name : Check for lock changes
4218 run : poetry check --lock
4319 - name : Cache virtualenv (with docs)
4420 uses : actions/cache@v4
4521 with :
4622 path : .venv
47- key : nitypes-with-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
23+ key : nitypes-with-docs-${{ runner.os }}-py${{ steps.setup-python-poetry .outputs.python-version }}-${{ hashFiles('poetry.lock') }}
4824 - name : Install nitypes (with docs)
4925 run : poetry install -v --only main,docs
5026 - name : Generate docs
Original file line number Diff line number Diff line change 44 workflow_call :
55 workflow_dispatch :
66
7- env :
8- POETRY_VERSION : 1.8.2
9- PYTHON_VERSION : 3.11.9
10-
117jobs :
128 check_nitypes :
139 name : Check nitypes
1410 runs-on : ubuntu-latest
1511 steps :
1612 - name : Check out repo
1713 uses : actions/checkout@v4
18- - name : Set up Python
19- uses : actions/setup-python@v5
20- id : setup-python
21- with :
22- python-version : ${{ env.PYTHON_VERSION }}
23- - name : Set pipx paths
24- id : set-pipx-paths
25- run : |
26- echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV"
27- echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV"
28- echo "$HOME/.local/bin" >> "$GITHUB_PATH"
29- echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT"
30- echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT"
31- shell : bash
32- - name : Cache pipx
33- uses : actions/cache@v4
34- with :
35- path : |
36- ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }}
37- ${{ steps.set-pipx-paths.outputs.pipx-home }}
38- key : pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }}
39- - name : Set up Poetry
40- run : pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}'
14+ - name : Set up Python and Poetry
15+ id : setup-python-poetry
16+ uses : /.github/actions/setup-python-poetry
4117 - name : Check for lock changes
4218 run : poetry check --lock
4319 - name : Cache virtualenv
4420 uses : actions/cache@v4
4521 with :
4622 path : .venv
47- key : nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
23+ key : nitypes-${{ runner.os }}-py${{ steps.setup-python-poetry .outputs.python-version }}-${{ hashFiles('poetry.lock') }}
4824 - name : Install nitypes
4925 run : poetry install -v
5026 - name : Lint
Original file line number Diff line number Diff line change 44 workflow_call :
55 workflow_dispatch :
66
7- env :
8- POETRY_VERSION : 1.8.2
9-
107jobs :
118 run_unit_tests :
129 name : Run unit tests
@@ -21,34 +18,16 @@ jobs:
2118 steps :
2219 - name : Check out repo
2320 uses : actions/checkout@v4
24- - name : Set up Python
25- uses : actions/ setup-python@v5
26- id : setup-python
21+ - name : Set up Python and Poetry
22+ id : setup-python-poetry
23+ uses : /.github/actions/ setup-python-poetry
2724 with :
2825 python-version : ${{ matrix.python-version }}
29- - name : Set pipx paths
30- id : set-pipx-paths
31- run : |
32- echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV"
33- echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV"
34- echo "$HOME/.local/bin" >> "$GITHUB_PATH"
35- echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT"
36- echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT"
37- shell : bash
38- - name : Cache pipx
39- uses : actions/cache@v4
40- with :
41- path : |
42- ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }}
43- ${{ steps.set-pipx-paths.outputs.pipx-home }}
44- key : pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }}
45- - name : Set up Poetry
46- run : pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}'
4726 - name : Cache virtualenv
4827 uses : actions/cache@v4
4928 with :
5029 path : .venv
51- key : nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
30+ key : nitypes-${{ runner.os }}-py${{ steps.setup-python-poetry .outputs.python-version }}-${{ hashFiles('poetry.lock') }}
5231 - name : Install nitypes
5332 run : poetry install -v
5433 - name : Run unit tests and code coverage
You can’t perform that action at this time.
0 commit comments