on: 
  pull_request:
    paths:
      - .github/actions/extism/**
      - .github/workflows/ci-php.yml
      - manifest/**
      - runtime/**
      - libextism/**
      - php/**
      - composer.json
      - composer.lock
  workflow_dispatch:

name: PHP CI

jobs:
  php:
    name: PHP
    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 PHP env
        uses: shivammathur/setup-php@v2
        with:
          php-version: "8.1"
          extensions: ffi
          tools: composer
        env:
          fail-fast: true

      - name: Test PHP SDK
        run: |
          cd php/example
          composer install
          php index.php
