Skip to content

CI: GitHub Actions workflow for the Python sample (#3) #3

CI: GitHub Actions workflow for the Python sample (#3)

CI: GitHub Actions workflow for the Python sample (#3) #3

Workflow file for this run

# CI for the Python sample in python/. One workflow per sample implementation:
# add a sibling workflow (e.g. dotnet.yml) when another language sample lands.
name: Python sample
on:
push:
branches: [main]
paths:
- 'python/**'
- '.github/workflows/python.yml'
pull_request:
paths:
- 'python/**'
- '.github/workflows/python.yml'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: python-sample-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
defaults:
run:
working-directory: python
jobs:
lint:
name: ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.12'
cache: pip
cache-dependency-path: python/pyproject.toml
- name: Install
run: pip install -e ".[dev]"
- name: Lint
run: ruff check src tests
test:
name: pytest (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# pyproject sets requires-python >= 3.11.
python-version: ['3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: python/pyproject.toml
- name: Install
run: pip install -e ".[dev]"
- name: Test
run: pytest -v