74 lines
2.0 KiB
YAML
74 lines
2.0 KiB
YAML
---
|
|
name: Setup Action
|
|
description: Install requested pipx dependencies, configure the system python, and install poetry and the package dependencies
|
|
|
|
inputs:
|
|
os:
|
|
default: ubuntu-latest
|
|
pipx-packages:
|
|
default: ""
|
|
poetry-version:
|
|
default: 2.5
|
|
python-version:
|
|
required: true
|
|
|
|
env:
|
|
POETRY_VIRTUALENVS_IN_PROJECT: true
|
|
POETRY_NO_INTERACTION: 1
|
|
PIPX_HOME: ~/.local/share/pipx
|
|
PIPX_BIN_DIR: ~/.local/bin
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Setup Local Variables
|
|
id: variable-setup
|
|
run: |
|
|
echo "pipx-home=$PIPX_HOME" >> $GITHUB_OUTPUT
|
|
echo "pipx-bin-dir=$PIPX_BIN_DIR" >> $GITHUB_OUTPUT
|
|
|
|
export BASE64_PIPX_ID=$(echo -n 'poetry==${{ inputs.poetry-version }} ${{ inputs.pipx-packages }}' | base64)
|
|
echo "cache-key-pipx=pipx-${{ inputs.os }}-${{ inputs.python-version }}-$BASE64_PIPX_ID" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- name: Cache pipx
|
|
id: cache-pipx
|
|
uses: actions/cache@v6
|
|
with:
|
|
# https://pypa.github.io/pipx/how-pipx-works
|
|
path: |
|
|
${{ steps.variable-setup.outputs.pipx-home }}
|
|
${{ steps.variable-setup.outputs.pipx-bin-dir }}
|
|
key: ${{ steps.variable-setup.outputs.cache-key-pipx }}
|
|
|
|
- name: Install Poetry ${{ inputs.poetry-version }} and '${{ inputs.pipx-packages }}'
|
|
if: ${{ steps.cache-pipx.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
for tool in "poetry==${{ inputs.poetry-version }}" ${{ inputs.pipx-packages }}; do
|
|
pipx install $tool
|
|
done
|
|
shell: bash
|
|
|
|
- name: Debug pipx
|
|
run: |
|
|
pipx ensurepath
|
|
pipx list
|
|
shell: bash
|
|
|
|
- name: Setup Python ${{ inputs.python-version }}
|
|
uses: actions/setup-python@v7
|
|
with:
|
|
python-version: ${{ inputs.python-version }}
|
|
cache: poetry
|
|
|
|
- name: Poetry Debug Info
|
|
run: |
|
|
poetry debug info
|
|
poetry config --list
|
|
shell: bash
|
|
|
|
- name: Install Project and Minimum Subset of Dependencies
|
|
run: |
|
|
poetry install
|
|
shell: bash
|