mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
* ci: upload macOS binary to GitHub release on publish * ci: version macOS release artifact as ccextractor-<version>-macos
212 lines
6.8 KiB
YAML
212 lines
6.8 KiB
YAML
name: Build CCExtractor on Mac
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
paths:
|
|
- '.github/workflows/build_mac.yml'
|
|
- '**.c'
|
|
- '**.h'
|
|
- '**CMakeLists.txt'
|
|
- '**.cmake'
|
|
- '**Makefile**'
|
|
- 'mac/**'
|
|
- 'package_creators/**'
|
|
- 'src/rust/**'
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
paths:
|
|
- '.github/workflows/build_mac.yml'
|
|
- '**.c'
|
|
- '**.h'
|
|
- '**CMakeLists.txt'
|
|
- '**.cmake'
|
|
- '**Makefile**'
|
|
- 'mac/**'
|
|
- 'package_creators/**'
|
|
- 'src/rust/**'
|
|
release:
|
|
types: [published]
|
|
jobs:
|
|
build_shell:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: Install dependencies
|
|
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac
|
|
- uses: actions/checkout@v6
|
|
- name: build
|
|
run: ./build.command
|
|
working-directory: ./mac
|
|
- name: Display version information
|
|
run: ./ccextractor --version
|
|
working-directory: ./mac
|
|
- name: Prepare artifacts
|
|
run: mkdir ./mac/artifacts
|
|
- name: Get version
|
|
id: version
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "release" ]; then
|
|
VERSION="${{ github.event.release.tag_name }}"
|
|
VERSION="${VERSION#v}"
|
|
else
|
|
VERSION=$(sed -n 's/#define VERSION "//;s/"//p' src/lib_ccx/lib_ccx.h 2>/dev/null | head -1 || echo "dev")
|
|
fi
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
echo "filename=ccextractor-${VERSION}-macos" >> "$GITHUB_OUTPUT"
|
|
- name: Copy release artifact
|
|
run: cp ./mac/ccextractor ./mac/artifacts/${{ steps.version.outputs.filename }}
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: CCExtractor mac build
|
|
path: ./mac/artifacts/${{ steps.version.outputs.filename }}
|
|
- name: Upload macOS binary to Release
|
|
if: github.event_name == 'release'
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
files: ./mac/artifacts/${{ steps.version.outputs.filename }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
build_shell_system_libs:
|
|
# Test building with system libraries via pkg-config (for Homebrew formula compatibility)
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: Install dependencies
|
|
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac freetype libpng protobuf-c utf8proc zlib
|
|
- uses: actions/checkout@v6
|
|
- name: build with system libs
|
|
run: ./build.command -system-libs
|
|
working-directory: ./mac
|
|
- name: Display version information
|
|
run: ./ccextractor --version
|
|
working-directory: ./mac
|
|
build_autoconf:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Install dependencies
|
|
run: brew install pkg-config autoconf automake libtool gpac
|
|
- name: run autogen
|
|
run: ./autogen.sh
|
|
working-directory: ./mac
|
|
- name: configure
|
|
run: ./configure --enable-debug
|
|
working-directory: ./mac
|
|
- name: make
|
|
run: make
|
|
working-directory: ./mac
|
|
- name: Display version information
|
|
run: ./ccextractor --version
|
|
working-directory: ./mac
|
|
cmake:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: dependencies
|
|
run: brew install gpac
|
|
- uses: actions/checkout@v6
|
|
- name: cmake
|
|
run: mkdir build && cd build && cmake ../src
|
|
- name: build
|
|
run: make -j$(nproc)
|
|
working-directory: build
|
|
- name: Display version information
|
|
run: ./build/ccextractor --version
|
|
cmake_ocr_hardsubx:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Install dependencies
|
|
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac ffmpeg
|
|
- name: cmake
|
|
run: |
|
|
mkdir build && cd build
|
|
cmake -DWITH_OCR=ON -DWITH_HARDSUBX=ON ../src
|
|
- name: build
|
|
run: |
|
|
make -j$(nproc)
|
|
working-directory: build
|
|
- name: Display version information
|
|
run: ./build/ccextractor --version
|
|
cmake_ffmpeg_mp4:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Install dependencies
|
|
run: brew install pkg-config gpac ffmpeg tesseract leptonica
|
|
- name: cmake (FFmpeg MP4 build)
|
|
run: |
|
|
mkdir build && cd build
|
|
cmake -DWITH_FFMPEG=ON -DWITH_OCR=ON -DWITH_HARDSUBX=ON ../src
|
|
- name: build
|
|
run: make -j$(nproc)
|
|
working-directory: build
|
|
- name: Display version information
|
|
run: ./build/ccextractor --version
|
|
build_shell_hardsubx:
|
|
# Test build.command with -hardsubx flag (burned-in subtitle extraction)
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: Install dependencies
|
|
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac ffmpeg
|
|
- uses: actions/checkout@v6
|
|
- name: build with hardsubx
|
|
run: ./build.command -hardsubx
|
|
working-directory: ./mac
|
|
- name: Display version information
|
|
run: ./ccextractor --version
|
|
working-directory: ./mac
|
|
- name: Verify hardsubx support
|
|
run: |
|
|
# Check that -hardsubx is recognized (will fail if not compiled in)
|
|
./ccextractor -hardsubx --help 2>&1 | head -20 || true
|
|
working-directory: ./mac
|
|
build_autoconf_hardsubx:
|
|
# Test autoconf build with HARDSUBX enabled (fixes issue #1173)
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Install dependencies
|
|
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac ffmpeg
|
|
- name: run autogen
|
|
run: ./autogen.sh
|
|
working-directory: ./mac
|
|
- name: configure with hardsubx
|
|
run: |
|
|
# Set Homebrew paths for configure to find libraries
|
|
export HOMEBREW_PREFIX="$(brew --prefix)"
|
|
export LDFLAGS="-L${HOMEBREW_PREFIX}/lib"
|
|
export CPPFLAGS="-I${HOMEBREW_PREFIX}/include"
|
|
export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/lib/pkgconfig"
|
|
./configure --enable-hardsubx --enable-ocr
|
|
working-directory: ./mac
|
|
- name: make
|
|
run: make
|
|
working-directory: ./mac
|
|
- name: Display version information
|
|
run: ./ccextractor --version
|
|
working-directory: ./mac
|
|
- name: Verify hardsubx support
|
|
run: |
|
|
# Check that -hardsubx is recognized
|
|
./ccextractor -hardsubx --help 2>&1 | head -20 || true
|
|
working-directory: ./mac
|
|
build_rust:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: cache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
src/rust/.cargo/registry
|
|
src/rust/.cargo/git
|
|
src/rust/target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: ${{ runner.os }}-cargo-
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: build
|
|
run: cargo build
|
|
working-directory: ./src/rust |