Skip to content

Commit 91efb6a

Browse files
Create php-av.yml
1 parent a033f6c commit 91efb6a

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/php-av.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: AV Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test on ${{ matrix.os }} with PHP ${{ matrix.php }}
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
php: [8.4]
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up PHP with FFI
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php }}
27+
extensions: ffi
28+
ini-values: ffi.enable=true
29+
tools: composer:v2
30+
31+
# Ubuntu: Compile FFmpeg 7 from source
32+
- name: Install FFmpeg 7+ (Ubuntu)
33+
if: matrix.os == 'ubuntu-latest'
34+
run: |
35+
sudo apt update
36+
sudo apt install -y \
37+
autoconf automake build-essential cmake git libtool \
38+
pkg-config texinfo zlib1g-dev libx264-dev libx265-dev \
39+
libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev
40+
41+
git clone --depth=1 https://github.com/FFmpeg/FFmpeg.git
42+
cd FFmpeg
43+
./configure --enable-shared --enable-gpl --enable-nonfree \
44+
--enable-libx264 --enable-libx265 --enable-libvpx \
45+
--enable-libfdk-aac --enable-libmp3lame --enable-libopus
46+
make -j$(nproc)
47+
sudo make install
48+
sudo ldconfig
49+
ffmpeg -version
50+
51+
# macOS: Use brew (typically has FFmpeg 7+)
52+
- name: Install FFmpeg 7+ (macOS)
53+
if: matrix.os == 'macos-latest'
54+
run: |
55+
brew install ffmpeg
56+
ffmpeg -version
57+
58+
# Windows: Download FFmpeg 7+ from official builds
59+
- name: Install FFmpeg 7+ (Windows)
60+
if: matrix.os == 'windows-latest'
61+
run: |
62+
Invoke-WebRequest https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7zip -OutFile ffmpeg.7z
63+
7z x ffmpeg.7z -oC:\ffmpeg -y
64+
echo "C:\ffmpeg\ffmpeg-*\bin" | Out-File -Append $env:GITHUB_PATH
65+
ffmpeg -version
66+
shell: pwsh
67+
68+
- name: Validate environment
69+
run: |
70+
php -v
71+
php -r "echo 'FFI enabled: ' . (extension_loaded('ffi') ? 'yes' : 'no') . PHP_EOL;"
72+
73+
- name: Install Composer dependencies
74+
run: composer install --no-interaction --prefer-dist
75+
76+
- name: Run tests
77+
run: vendor/bin/phpunit

0 commit comments

Comments
 (0)