build: false

platform:
  - x64

clone_folder: c:\projects\project-code

cache:
  - c:\ProgramData\chocolatey\bin -> .appveyor.yml
  - c:\ProgramData\chocolatey\lib -> .appveyor.yml
  - c:\ProgramData\ComposerSetup -> .appveyor.yml
  - c:\tools\php -> .appveyor.yml

environment:
  global:
    COMPOSER_NO_INTERACTION: 1
    ANSICON: 121x90 (121x90) # Console colors

  ffmpeg_download: https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-4.3.2-essentials_build.zip

  matrix:
    - PHP_VERSION: Latest_Version

init:
  - ps: $env:PATH = 'c:\tools\php;c:\ProgramData\ComposerSetup\bin;' + $env:PATH

install:
  - ps: Set-Service wuauserv -StartupType Manual # Chocolatey will try to install Windows updates when installing PHP.
  - ps: cinst php --params '""/InstallDir:C:\tools\php""' --ignore-checksums
  - ps: Start-FileDownload $env:ffmpeg_download

  - 7z x ffmpeg-4.3.2-essentials_build.zip
  - PATH=%PATH%;%cd%\ffmpeg-4.3.2-2021-02-27-essentials_build\bin
  - cd c:\tools\php
  - copy php.ini-production php.ini /Y
  - echo date.timezone="UTC" >> php.ini
  - echo extension_dir=ext >> php.ini
  - echo extension=php_openssl.dll >> php.ini # Needed to install Composer
  - echo extension=php_mbstring.dll >> php.ini # Needed for PHPunit
  - echo extension=php_fileinfo.dll >> php.ini

  - appveyor-retry cinst --no-progress -y composer

  - cd c:\projects\project-code
  - appveyor-retry composer update --no-interaction --no-progress --no-suggest --optimize-autoloader --prefer-stable --prefer-dist

test_script:
  - cd c:\projects\project-code
  - ffmpeg -version
  - vendor\bin\phpunit tests
