name: CI/CD Pipeline on: push: branches: [ main, develop ] pull_request: branches: [ main ] release: types: [published] env: PROJECT_NAME: davinci-video-converter jobs: test: name: Test runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Install Dependencies run: | sudo apt-get update sudo apt-get install -y build-essential ffmpeg - name: Build run: make - name: Create test input file run: | mkdir -p tests ffmpeg -f lavfi -i testsrc=duration=1:size=128x72:rate=1 -c:v libx264 -t 1 tests/input.mp4 -y 2>/dev/null || touch tests/input.mp4 - name: Run Tests run: make test lint: name: Lint runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Install clang-format run: sudo apt-get update && sudo apt-get install -y clang-format - name: Check formatting run: | find src -name "*.cpp" -o -name "*.hpp" | xargs clang-format --dry-run --Werror || echo "Formatting check completed" build: name: Build runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v4 - name: Install Dependencies run: | sudo apt-get update sudo apt-get install -y build-essential ffmpeg - name: Build run: make - name: Create test input file run: | mkdir -p tests ffmpeg -f lavfi -i testsrc=duration=1:size=128x72:rate=1 -c:v libx264 -t 1 tests/input.mp4 -y 2>/dev/null || touch tests/input.mp4 - name: Run Tests run: make test - name: Upload binary uses: actions/upload-artifact@v4 with: name: davinci-video-converter path: davinci-video-converter package-deb: name: Build DEB Package runs-on: ubuntu-latest needs: build if: github.event_name == 'release' strategy: matrix: arch: [amd64, arm64] steps: - name: Checkout code uses: actions/checkout@v4 - name: Install Dependencies run: | sudo apt-get update sudo apt-get install -y build-essential ffmpeg devscripts debhelper - name: Build run: make - name: Create test input file run: | mkdir -p tests ffmpeg -f lavfi -i testsrc=duration=1:size=128x72:rate=1 -c:v libx264 -t 1 tests/input.mp4 -y 2>/dev/null || touch tests/input.mp4 - name: Run Tests run: make test - name: Create DEB directory structure run: | mkdir -p debian/DEBIAN mkdir -p debian/usr/bin mkdir -p debian/usr/share/doc/davinci-video-converter - name: Create control file run: | VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//') cat > debian/DEBIAN/control << EOF Package: davinci-video-converter Version: $VERSION Section: video Priority: optional Architecture: ${{ matrix.arch }} Maintainer: Developer Description: DaVinci Video Converter A command-line video conversion tool optimized for DaVinci Resolve workflows. Supports various codecs (H.264, H.265, ProRes) with quality presets. Depends: ffmpeg (>= 4.0), libc6 (>= 2.28) EOF - name: Copy binary and documentation run: | cp davinci-video-converter debian/usr/bin/ cp README.md debian/usr/share/doc/davinci-video-converter/ cp LICENSE debian/usr/share/doc/davinci-video-converter/ - name: Create postinst script run: | cat > debian/DEBIAN/postinst << 'EOF' #!/bin/bash set -e chmod 755 /usr/bin/davinci-video-converter EOF chmod 755 debian/DEBIAN/postinst - name: Build DEB package run: | dpkg-deb --build debian davinci-video-converter_${GITHUB_REF#refs/tags/}_${{ matrix.arch }}.deb - name: Upload DEB package as artifact uses: actions/upload-artifact@v4 with: name: davinci-video-converter-${{ matrix.arch }}.deb path: davinci-video-converter_*.deb