Skip to content

update

update #11

name: Python package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-venv
- name: Install Poetry
run: |
# Install specific version of Poetry directly
pip install "poetry==1.5.1"
echo "$(python -m site --user-base)/bin" >> $GITHUB_PATH
- name: Configure Poetry
run: |
# Configure Poetry with explicit paths
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv
poetry config --list
poetry --version
- name: Install dependencies
run: |
echo "=== Installing dependencies ==="
# Check if poetry.lock exists
if [ -f poetry.lock ]; then
echo "Using existing poetry.lock"
poetry install --no-interaction --no-ansi -v
else
echo "No poetry.lock found, installing without lock file"
poetry install --no-interaction --no-ansi -v --no-lock
fi
# Verify the environment
echo "\n=== Environment information ==="
poetry env info
echo "\n=== Installed packages ==="
poetry show --tree || echo "Failed to show package tree"
- name: Run tests
run: |
poetry run pytest tests/ -v
- name: Lint with flake8
run: |
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --max-complexity=10 --max-line-length=88 --statistics