Skip to content

src/tests: add unit test (#91) #28

src/tests: add unit test (#91)

src/tests: add unit test (#91) #28

Workflow file for this run

name: Release
on:
release:
types:
- created
push:
tags:
- "v*.*.*"
jobs:
build-linux-x86:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout BMF repository (specific branch)
run: |
sudo apt install -y nasm yasm libx264-dev libx265-dev libnuma-dev
git clone https://github.com/JackLau1222/bmf.git
- name: Cache FFmpeg build
uses: actions/cache@v3
with:
path: |
ffmpeg
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('bmf/scripts/build_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-ffmpeg-
- name: Compile FFmpeg if not cached
run: |
if [ ! -d "$(pwd)/ffmpeg" ]; then
echo "FFmpeg not found, starting build..."
wget https://ffmpeg.org/releases/ffmpeg-5.1.6.tar.bz2 && tar xjvf ffmpeg-5.1.6.tar.bz2
(cd ffmpeg-5.1.6 && ./configure --pkg-config-flags=--static --enable-shared --disable-static --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-nonfree --enable-libx264 --enable-libx265 --prefix=../ffmpeg)
(cd ffmpeg-5.1.6 && make -j$(nproc) && make install)
else
echo "FFmpeg is already installed, skipping build."
fi
echo "FFMPEG_ROOT_PATH=$(pwd)/ffmpeg" >> $GITHUB_ENV
- name: Set up Qt
run: |
sudo apt-get install -y qt5-qmake qtbase5-dev qtchooser qtbase5-dev-tools cmake build-essential
- name: Build with CMake
run: |
export PATH=$PATH:$FFMPEG_ROOT_PATH/bin
(cd src && cmake -B build -DBMF_TRANSCODER=OFF && cd build && make -j$(nproc))
- name: Copy libs
run: |
export LD_LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib/:$BMF_ROOT_PATH/lib
export LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib/:$BMF_ROOT_PATH/lib
# linuxdeployqt
sudo apt-get -y install git g++ libgl1-mesa-dev
git clone https://github.com/probonopd/linuxdeployqt.git
# Then build in Qt Creator, or use
export PATH=$(readlink -f /tmp/.mount_QtCreator-*-x86_64/*/gcc_64/bin/):$PATH
(cd linuxdeployqt && qmake && make && sudo make install)
# patchelf
wget https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2
tar xf patchelf-0.9.tar.bz2
( cd patchelf-0.9/ && ./configure && make && sudo make install )
# appimage
sudo wget -c "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool
sudo chmod a+x /usr/local/bin/appimagetool
(linuxdeployqt/bin/linuxdeployqt ./src/build/OpenConverter -appimage)
continue-on-error: true
# Step to package the build directory
- name: Create tar.gz package
run: |
BUILD_DIR="src/build"
PACKAGE_NAME="OpenConverter_Linux_x86.tar.gz"
OUTPUT_DIR="OpenConverter_Linux_x86"
mkdir -p $OUTPUT_DIR
cp -r $BUILD_DIR/* $OUTPUT_DIR/
tar -czvf $PACKAGE_NAME -C $OUTPUT_DIR .
rm -rf $OUTPUT_DIR
# Step to upload the tar.gz package as an artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: OpenConverter_Linux_x86
path: OpenConverter_Linux_x86.tar.gz
- name: Get GitHub Release information
id: release_info
run: echo "::set-output name=release_tag::$(echo ${GITHUB_REF#refs/tags/})"
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: OpenConverter_Linux_x86.tar.gz
- name: Finish
run: echo "Linux X86 Release upload complete"
build-mac-arm:
runs-on: macos-latest
steps:
- name: Checkout target branch code (using pull_request_target)
uses: actions/checkout@v2
- name: Cache FFmpeg build
uses: actions/cache@v3
with:
path: |
ffmpeg
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('bmf/scripts/build_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-ffmpeg-macos-arm-
- name: Compile FFmpeg if not cached
run: |
if [ ! -d "$(pwd)/ffmpeg" ]; then
echo "FFmpeg not found, starting build..."
brew install make pkg-config openssl cmake x264 x265
wget https://ffmpeg.org/releases/ffmpeg-5.1.6.tar.bz2 && tar xjvf ffmpeg-5.1.6.tar.bz2
(cd ffmpeg-5.1.6 && ./configure --pkg-config-flags=--static --enable-shared --disable-static --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-nonfree --enable-libx264 --enable-libx265 --prefix=../ffmpeg)
(cd ffmpeg-5.1.6 && make -j$(sysctl -n hw.ncpu) && make install)
else
echo "FFmpeg is already installed, skipping build."
fi
echo "FFMPEG_ROOT_PATH=$(pwd)/ffmpeg" >> $GITHUB_ENV
- name: Set up Qt
run: |
brew install qt5
- name: Build with CMake
run: |
export PATH=$PATH:$FFMPEG_ROOT_PATH/bin
export CMAKE_PREFIX_PATH="/opt/homebrew/opt/qt@5:$CMAKE_PREFIX_PATH"
export QT_DIR="/opt/homebrew/opt/qt@5/lib/cmake/Qt5"
export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"
(cd src && cmake -B build -DBMF_TRANSCODER=OFF && cd build && make -j$(sysctl -n hw.ncpu))
export DYLD_LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib/
export LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib/
# fix link libraries path mistake
cd src/build
macdeployqt OpenConverter.app
cd ../..
(cd src/build &&
macdeployqt OpenConverter.app -dmg)
mv src/build/OpenConverter.dmg OpenConverter_macOS_aarch64.dmg
# Step to upload the dmg package as an artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: OpenConverter_macOS_aarch64
path: OpenConverter_macOS_aarch64.dmg
- name: Get GitHub Release information
id: release_info
run: echo "::set-output name=release_tag::$(echo ${GITHUB_REF#refs/tags/})"
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: OpenConverter_macOS_aarch64.dmg
- name: Finish
run: echo "macOS aarch64 Release upload complete"
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
- name: Finish
run: echo "Release upload complete"
build-windows-x64:
runs-on: windows-latest
steps:
# Check out the repository code.
- name: Checkout repository
uses: actions/checkout@v2
# Set up the Qt environment.
- name: (2) Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.4.3
host: windows
target: desktop
arch: win64_msvc2019_64
dir: ${{ runner.temp }}
setup-python: false
# Download FFmpeg from the specified release URL.
- name: Download FFmpeg
shell: powershell
run: |
$ffmpegUrl = "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-03-31-17-28/ffmpeg-n4.4.4-94-g5d07afd482-win64-gpl-shared-4.4.zip"
$outputZip = "ffmpeg.zip"
Invoke-WebRequest -Uri $ffmpegUrl -OutFile $outputZip
Expand-Archive -Path $outputZip -DestinationPath ffmpeg
echo "FFMPEG_ROOT_PATH=$(pwd)/ffmpeg/ffmpeg-n4.4.4-94-g5d07afd482-win64-gpl-shared-4.4" >> $GITHUB_ENV
# Create a build directory, run qmake, and build the project.
- name: Build Qt project
run: |
(cd src &&
cmake -S . -B build "-DFFMPEG_ROOT_PATH=../ffmpeg/ffmpeg-n4.4.4-94-g5d07afd482-win64-gpl-shared-4.4" -DFFTOOL_TRANSCODER=OFF &&
cmake --build build --config Release --parallel)
- name : Deploy project
run: |
# 1) Create the deploy folder under the repo workspace
New-Item -ItemType Directory -Force -Path OpenConverter_win64
# 2) Copy your built exe into OpenConverter_win64/
Copy-Item -Path "src\build\Release\OpenConverter.exe" -Destination "OpenConverter_win64"
# 3) Bundle Qt runtime into OpenConverter_win64/
& "D:\a\_temp\Qt\6.4.3\msvc2019_64\bin\windeployqt.exe" `
"--qmldir=src" `
"OpenConverter_win64\OpenConverter.exe"
# 4) Copy FFmpeg DLLs into OpenConverter_win64/
Copy-Item `
-Path "ffmpeg\ffmpeg-n4.4.4-94-g5d07afd482-win64-gpl-shared-4.4\bin\*.dll" `
-Destination "OpenConverter_win64"
# 5) Zip the OpenConverter_win64 folder into the workspace root
Compress-Archive -Path "OpenConverter_win64" -DestinationPath "OpenConverter_win64.zip"
# (Optional) Archive the build artifacts.
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: OpenConverter_win64
path: OpenConverter_win64.zip
- name: Get GitHub Release information
id: release_info
run: echo "::set-output name=release_tag::$(echo ${GITHUB_REF#refs/tags/})"
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: OpenConverter_win64.zip
- name: Finish
run: echo "win64 Release upload complete"
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
- name: Finish
run: echo "Release upload complete"