Skip to content

Build Python Application #1

Build Python Application

Build Python Application #1

Workflow file for this run

name: Build Python Application
on:
push:
branches: [ main, 0.4.1, develop, pyside-refactor ]
pull_request:
branches: [ main, 0.4.1 ]
workflow_dispatch:
jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Type check with mypy
run: |
mypy app/ core/ utils/ --ignore-missing-imports
continue-on-error: true
- name: Run tests
run: |
pytest tests/ -v --cov=app --cov=core --cov=utils
continue-on-error: true
build-windows:
name: Windows (Nuitka + zip)
runs-on: windows-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install nuitka ordered-set zstandard
- name: Build with Nuitka
run: python build_nuitka.py
- name: Zip distribution
shell: pwsh
run: |
$dist = Get-ChildItem -Path dist -Directory -Filter "*.dist" | Select-Object -First 1
if (-not $dist) { throw "No dist\*.dist folder after Nuitka build" }
$ver = python -c "from app import __version__; print(__version__)"
New-Item -ItemType Directory -Force -Path dist-packages | Out-Null
$zip = "dist-packages/EncodeForge-$ver-windows-x64.zip"
if (Test-Path $zip) { Remove-Item $zip }
Compress-Archive -Path (Join-Path $dist.FullName "*") -DestinationPath $zip -CompressionLevel Optimal
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: encodeforge-windows-${{ github.run_number }}
path: |
dist-packages/*.zip
retention-days: 14
- name: Build summary
shell: bash
run: |
echo "## Windows build" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- Nuitka standalone + zip: artifact encodeforge-windows-${{ github.run_number }}" >> "$GITHUB_STEP_SUMMARY"
build-linux-packages:
name: Linux (Nuitka + deb + rpm + AppImage)
runs-on: ubuntu-22.04
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
patchelf ccache file \
ruby ruby-dev build-essential rpm \
libfuse2 wget ca-certificates
- name: Install fpm
run: sudo gem install --no-document fpm
- name: Install appimagetool
run: |
wget -q -O /tmp/appimagetool \
"https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage"
chmod +x /tmp/appimagetool
sudo mv /tmp/appimagetool /usr/local/bin/appimagetool
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install nuitka ordered-set zstandard
- name: Build with Nuitka
run: python build_nuitka.py
- name: Build deb, rpm, and AppImage
run: |
chmod +x packaging/linux/build-deb-rpm.sh packaging/linux/build-appimage.sh packaging/linux/AppRun
./packaging/linux/build-deb-rpm.sh
./packaging/linux/build-appimage.sh
- name: Upload Linux packages
uses: actions/upload-artifact@v4
with:
name: encodeforge-linux-packages-${{ github.run_number }}
path: |
dist-packages/*.deb
dist-packages/*.rpm
dist-packages/*.AppImage
if-no-files-found: error
retention-days: 14
- name: Build summary
run: |
echo "## Linux packages" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- deb, rpm, AppImage: artifact encodeforge-linux-packages-${{ github.run_number }}" >> "$GITHUB_STEP_SUMMARY"
echo "- Built on ubuntu-22.04 (x86_64) for broader glibc compatibility" >> "$GITHUB_STEP_SUMMARY"