Skip to content

Cache poetry itself #1158

Cache poetry itself

Cache poetry itself #1158

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
shell: bash
run: |
PIPX_HOME="$HOME/.pipx"
PIPX_BIN_DIR="$PIPX_HOME/bin"
echo "PIPX_HOME=$PIPX_HOME" >> $GITHUB_ENV
echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" >> $GITHUB_ENV
echo "$PIPX_BIN_DIR" >> $GITHUB_PATH
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
- name: Get pipx and poetry latest versions
id: latest-versions
run: |
pipx_version=$(curl -s https://pypi.org/pypi/pipx/json | jq -r .info.version)
poetry_version=$(curl -s https://pypi.org/pypi/poetry/json | jq -r .info.version)
echo "pipx=$pipx_version" >> $GITHUB_OUTPUT
echo "poetry=$poetry_version" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Cache Poetry
with:
path: ~/.pipx/
key: >

Check failure on line 52 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / Build the package

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 52, Col: 16): Unexpected symbol: ')'. Located at position 100 within expression: format('pipx-{0}-{1}-{2}', matrix.os, matrix.python-version, steps.latest-versions.outputs.poetry, )
${{ format('pipx-{0}-{1}-{2}',
matrix.os,
matrix.python-version,
steps.latest-versions.outputs.poetry,
) }}
- name: Install pipx
run: pip install --user pipx
- name: Install Poetry
run: pipx install poetry
- 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: Check if package builds
run: |
poetry build