when:
  - event: [push, pull_request]
    path: 'native/wordpress/maple-fonts-wp/**'

steps:
  install:
    image: composer:2
    commands:
      - cd native/wordpress/maple-fonts-wp
      - composer install --prefer-dist --no-interaction

  phpcs:
    image: php:8.2-cli
    commands:
      - cd native/wordpress/maple-fonts-wp
      - ./vendor/bin/phpcs --standard=phpcs.xml.dist --report=summary || true
    depends_on:
      - install

  phpcompat:
    image: php:8.2-cli
    commands:
      - cd native/wordpress/maple-fonts-wp
      - ./vendor/bin/phpcs -p --standard=PHPCompatibilityWP --runtime-set testVersion 7.4- --extensions=php --ignore=vendor,tests . || true
    depends_on:
      - install

  test-php74:
    image: wordpressdevelop/phpunit:9-php-7.4-fpm
    commands:
      - cd native/wordpress/maple-fonts-wp
      - composer install --prefer-dist --no-interaction
      - bash bin/install-wp-tests.sh wordpress_test root root database latest true
      - ./vendor/bin/phpunit
    depends_on:
      - install

  test-php82:
    image: wordpressdevelop/phpunit:9-php-8.2-fpm
    commands:
      - cd native/wordpress/maple-fonts-wp
      - composer install --prefer-dist --no-interaction
      - bash bin/install-wp-tests.sh wordpress_test root root database latest true
      - ./vendor/bin/phpunit
    depends_on:
      - install

services:
  database:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: wordpress_test
