on: 
  pull_request:
    paths:
      - .github/actions/extism/**
      - .github/workflows/ci-python.yml
      - manifest/**
      - runtime/**
      - libextism/**
      - python/**
  workflow_dispatch:

name: Python CI

jobs:
  python:
    name: Python
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        rust:
          - stable
    steps:
      - name: Checkout sources
        uses: actions/checkout@v3
      - uses: ./.github/actions/extism
      - name: Setup Python env
        uses: actions/setup-python@v4
        with:
          python-version: "3.9"
          check-latest: true
      - name: Install Poetry
        uses: snok/install-poetry@v1
      - name: Test Python Host SDK
        run: |
          cd python
          cp ../README.md .
          poetry install --no-dev
          poetry run python example.py
          poetry run python -m unittest discover
