Use poetry build commands, publish to TestPyPI #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Unit Tests with Poetry | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
jobs: | |
poetry-run-pytest: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # This ensures all matrix jobs run even if some fail | |
matrix: | |
python-version: ['3.10', '3.11', '3.12', '3.13'] # Adjust these as per available versions | |
container: | |
image: osgeo/gdal:ubuntu-small-3.6.3 | |
steps: | |
- uses: actions/checkout@v2 | |
# Use the custom action to set up the Python environment | |
- name: Setup Python Environment | |
uses: ./.github/actions/setup-python-environment | |
with: | |
python-version: ${{ matrix.python-version }} | |
poetry-version: '1.8.4' | |
# Cache your project dependencies | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: ./.venv | |
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
# Install dependencies with Poetry, avoiding caching of the project itself | |
- name: Install Dependencies | |
run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
# Ensure all dependencies are installed | |
- name: Final Install | |
run: poetry install --no-interaction | |
# Run tests with pytest as configured in pyproject.toml | |
- name: Run Tests | |
run: poetry run pytest |