ci: install the ffmpeg@5 via homebrew rather than compiling it #179
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| ci-linux: | |
| runs-on: ubuntu-22.04 | |
| concurrency: | |
| group: "build-linux-${{ github.event.pull_request.number }}" | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake pkg-config | |
| sudo apt-get install -y nasm yasm libx264-dev libx265-dev libnuma-dev | |
| git clone https://github.com/google/googletest.git 3rd_party/gtest | |
| - name: Get FFmpeg | |
| run: | | |
| wget https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-11-30-13-12/ffmpeg-n5.1.6-11-gcde3c5fc0c-linux64-gpl-shared-5.1.tar.xz | |
| tar xJvf ffmpeg-n5.1.6-11-gcde3c5fc0c-linux64-gpl-shared-5.1.tar.xz | |
| ls ffmpeg-n5.1.6-11-gcde3c5fc0c-linux64-gpl-shared-5.1 | |
| echo "FFMPEG_ROOT_PATH=$(pwd)/ffmpeg-n5.1.6-11-gcde3c5fc0c-linux64-gpl-shared-5.1" >> $GITHUB_ENV | |
| - name: Build with CMake | |
| run: | | |
| export PATH=$PATH:$FFMPEG_ROOT_PATH/bin | |
| (cd src && cmake -B build -DENABLE_TESTS=ON -DENABLE_GUI=OFF && cd build && make -j$(nproc)) | |
| - name: Run tests | |
| run: | | |
| export LD_LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib | |
| wget https://github.com/JackLau1222/OpenConverter/releases/download/files/oc-test.zip | |
| unzip -j oc-test.zip -d src/build/tests/media | |
| cd src/build/tests && ./transcoder_test | |
| ci-macos: | |
| runs-on: macos-latest | |
| concurrency: | |
| group: "build-macos-${{ github.event.pull_request.number }}" | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| brew install cmake pkg-config | |
| brew install nasm yasm x264 x265 | |
| git clone https://github.com/google/googletest.git 3rd_party/gtest | |
| - name: Install FFmpeg via Homebrew | |
| run: | | |
| # Install FFmpeg 5 with x264, x265 support (pre-built from Homebrew) | |
| brew install ffmpeg@5 | |
| # Set FFmpeg path | |
| export FFMPEG_ROOT_PATH=$(brew --prefix ffmpeg@5) | |
| echo "FFMPEG_ROOT_PATH=$FFMPEG_ROOT_PATH" >> $GITHUB_ENV | |
| # Verify FFmpeg has x264 and x265 | |
| echo "FFmpeg configuration:" | |
| $FFMPEG_ROOT_PATH/bin/ffmpeg -version | head -n 1 | |
| $FFMPEG_ROOT_PATH/bin/ffmpeg -encoders 2>/dev/null | grep -E "libx264|libx265" || echo "Warning: x264/x265 not found" | |
| - name: Build with CMake | |
| run: | | |
| export PATH=$PATH:$FFMPEG_ROOT_PATH/bin | |
| (cd src && cmake -B build -DENABLE_TESTS=ON -DENABLE_GUI=OFF && cd build && make -j$(sysctl -n hw.ncpu)) | |
| - name: Run tests | |
| run: | | |
| export DYLD_LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib | |
| wget https://github.com/JackLau1222/OpenConverter/releases/download/files/oc-test.zip | |
| unzip -j oc-test.zip -d src/build/tests/media | |
| cd src/build/tests && ./transcoder_test |