Skip to content

Cache poetry itself #1156

Cache poetry itself

Cache poetry itself #1156

Workflow file for this run

name: Build the package
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.9"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup environtment
run: |
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
export PIPX_HOME="$HOME/.pipx"
export PIPX_BIN_DIR="$PIPX_HOME/bin"
echo "$PIPX_BIN_DIR" >> $GITHUB_PATH
echo "PIPX_HOME=$PIPX_HOME" >> $GITHUB_ENV
echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" >> $GITHUB_ENV
- name: Install Poetry
run: |
echo "Python user base: $(python3 -m site --user-base)"
echo "Which pipx: $(which pipx)"
echo "PIPX_BIN_DIR: $PIPX_BIN_DIR"
echo "PIPX_HOME: $PIPX_HOME"
pip --version
pip install --user pipx
pipx install poetry
pipx list
- name: Use local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v4
id: cache-poetry-deps
name: Cache Poetry dependencies
with:
path: ./.venv
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
venv-${{ matrix.os }}-${{ matrix.python-version }}-
- name: Install dependencies with Poetry
run: |
poetry env use python3
poetry install
- name: List Poetry environment
run: |
python3 --version
poetry env info
- name: Check if package builds
run: |
poetry build