name: PhpStorm Stubs PECL Test

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 1 * *'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Build Docker Container
        run: docker compose -f docker-compose.yml build >/dev/null
        env:
          PHP_VERSION: '8.4'

      - name: Composer Install
        run: docker compose -f docker-compose.yml run test_runner composer install

      - name: Dump Reflection With Pecl To File
        run: docker compose -f docker-compose.yml run pecl_extensions /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionDataPecl.json

      - name: Dump Reflection Without Pecl To File
        run: docker compose -f docker-compose.yml run php_under_test /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionData.json

      - name: Build Reflection Data With Pecl Only
        run: docker compose -f docker-compose.yml run php_under_test /usr/local/bin/php tests/Tools/dump-pecl-to-file.php

      - name: Run Tests
        run: docker compose -f docker-compose.yml run -e PHP_VERSION='8.4' test_runner vendor/bin/phpunit tests/
        env:
          PHP_VERSION: '8.4'
