update ci #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PHP-AV CI TEST | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up PHP 8.4 with FFI | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.4 | |
| extensions: ffi | |
| ini-values: ffi.enable=true | |
| tools: composer:v2 | |
| - name: Validate composer.json and composer.lock | |
| run: composer validate --strict | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Install FFmpeg 7.1.1 on Linux | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y \ | |
| autoconf automake build-essential cmake git libtool \ | |
| pkg-config texinfo zlib1g-dev libx264-dev libx265-dev \ | |
| libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev \ | |
| nasm | |
| git clone https://github.com/FFmpeg/FFmpeg.git | |
| cd FFmpeg | |
| git checkout n7.1.1 | |
| ./configure --enable-shared --enable-gpl --enable-nonfree \ | |
| --enable-libx264 --enable-libx265 --enable-libvpx \ | |
| --enable-libfdk-aac --enable-libmp3lame --enable-libopus | |
| make -j$(nproc) | |
| sudo make install | |
| sudo ldconfig | |
| ffmpeg -version | |
| - name: Install FFmpeg 7.1.1 on macOS | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install cmake git nasm pkg-config x264 x265 libvpx fdk-aac lame opus | |
| git clone https://github.com/FFmpeg/FFmpeg.git | |
| cd FFmpeg | |
| git checkout n7.1.1 | |
| ./configure --enable-shared --enable-gpl --enable-nonfree \ | |
| --enable-libx264 --enable-libx265 --enable-libvpx \ | |
| --enable-libfdk-aac --enable-libmp3lame --enable-libopus | |
| make -j$(sysctl -n hw.ncpu) | |
| sudo make install | |
| ffmpeg -version | |
| - name: Install FFmpeg 7.1.1 on Windows (custom build) | |
| if: matrix.os == 'windows-latest' | |
| shell: powershell | |
| run: | | |
| Invoke-WebRequest -Uri https://github.com/PHP-WebRTC/ffmpeg-builder/releases/download/v7.1.1/ffmpeg-win_amd64.tar.gz -OutFile ffmpeg.tar.gz | |
| mkdir ffmpeg | |
| tar -xzf ffmpeg.tar.gz -C ffmpeg | |
| # Add lib folder containing DLLs to PATH | |
| echo "${{ github.workspace }}\ffmpeg\lib" | Out-File -Append $env:GITHUB_PATH | |
| # Check ffmpeg version from bin if available | |
| if (Test-Path "${{ github.workspace }}\ffmpeg\bin\ffmpeg.exe") { | |
| & "${{ github.workspace }}\ffmpeg\bin\ffmpeg.exe" -version | |
| } elseif (Test-Path "${{ github.workspace }}\ffmpeg\lib\ffmpeg.exe") { | |
| & "${{ github.workspace }}\ffmpeg\lib\ffmpeg.exe" -version | |
| } else { | |
| Write-Host "ffmpeg.exe not found." | |
| } | |
| - name: Check PHP and FFI status | |
| run: | | |
| php -v | |
| php -r "echo 'FFI enabled: ' . (extension_loaded('ffi') ? 'yes' : 'no') . PHP_EOL;" | |
| - name: Run PHPUnit tests | |
| run: vendor/bin/phpunit |