Repository navigation
Replace DeepWiki badge with new image link #127
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: PyInstaller Build and Release Binaries | |
| on: | |
| push: | |
| tags: [ "v*.*.*" ] | |
| branches: [ "main", "testci" ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| discussions: write | |
| env: | |
| BASE_APP_NAME: "HwCodecDetect" | |
| ENTRY_POINT_SCRIPT: "launcher.py" | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.asset_name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # ======================== CLI BUILDS ======================== | |
| - os: windows-latest | |
| python_arch: 'x64' | |
| asset_name: HwCodecDetect-Windows-x64.exe | |
| job_type: native | |
| branch_mode: main | |
| - os: windows-latest | |
| python_arch: 'x86' | |
| asset_name: HwCodecDetect-Windows-x86.exe | |
| job_type: native | |
| branch_mode: main | |
| - os: macos-15-intel | |
| python_arch: 'x64' | |
| asset_name: HwCodecDetect-macOS-Intel | |
| job_type: native | |
| branch_mode: main | |
| - os: macos-latest | |
| python_arch: 'arm64' | |
| asset_name: HwCodecDetect-macOS-ARM64 | |
| job_type: native | |
| branch_mode: main | |
| - os: ubuntu-22.04 | |
| python_arch: 'x64' | |
| asset_name: HwCodecDetect-Linux-x64 | |
| job_type: native | |
| branch_mode: main | |
| - os: ubuntu-22.04 | |
| job_type: emulated | |
| qemu_arch: aarch64 | |
| docker_img: python:3.10-bullseye | |
| asset_name: HwCodecDetect-Linux-arm64 | |
| branch_mode: main | |
| - os: ubuntu-22.04 | |
| job_type: emulated | |
| qemu_arch: i386 | |
| docker_img: i386/python:3.10-slim-bullseye | |
| asset_name: HwCodecDetect-Linux-x86 | |
| branch_mode: main | |
| # ======================== GUI BUILDS ======================== | |
| - os: windows-latest | |
| python_arch: 'x64' | |
| asset_name: HwCodecDetect-GUI-Windows-x64.exe | |
| job_type: native | |
| branch_mode: ui | |
| - os: windows-latest | |
| python_arch: 'x86' | |
| asset_name: HwCodecDetect-GUI-Windows-x86.exe | |
| job_type: native | |
| branch_mode: ui | |
| - os: macos-15-intel | |
| python_arch: 'x64' | |
| asset_name: HwCodecDetect-GUI-macOS-Intel | |
| job_type: native | |
| branch_mode: ui | |
| - os: macos-latest | |
| python_arch: 'arm64' | |
| asset_name: HwCodecDetect-GUI-macOS-ARM64 | |
| job_type: native | |
| branch_mode: ui | |
| - os: ubuntu-22.04 | |
| python_arch: 'x64' | |
| asset_name: HwCodecDetect-GUI-Linux-x64 | |
| job_type: native | |
| branch_mode: ui | |
| - os: ubuntu-22.04 | |
| job_type: emulated | |
| qemu_arch: aarch64 | |
| docker_img: python:3.10-bullseye | |
| asset_name: HwCodecDetect-GUI-Linux-arm64 | |
| branch_mode: ui | |
| - os: ubuntu-22.04 | |
| job_type: emulated | |
| qemu_arch: i386 | |
| docker_img: i386/python:3.10-slim-bullseye | |
| asset_name: HwCodecDetect-GUI-Linux-x86 | |
| branch_mode: ui | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set App Name | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.branch_mode }}" == "ui" ]; then | |
| echo "APP_NAME_INTERNAL=${{ env.BASE_APP_NAME }}-GUI" >> $GITHUB_ENV | |
| else | |
| echo "APP_NAME_INTERNAL=${{ env.BASE_APP_NAME }}" >> $GITHUB_ENV | |
| fi | |
| - name: Create Entry Point Script | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.branch_mode }}" == "ui" ]; then | |
| cat > ${{ env.ENTRY_POINT_SCRIPT }} <<EOF | |
| import runpy | |
| import sys | |
| import os | |
| os.environ["HWCODECDETECT_GUI"] = "1" | |
| sys.path.append(os.path.abspath(".")) | |
| if False: | |
| import src.HwCodecDetect.run_tests | |
| if __name__ == "__main__": | |
| runpy.run_module('src.HwCodecDetect.run_tests', run_name='__main__', alter_sys=True) | |
| EOF | |
| else | |
| cat > ${{ env.ENTRY_POINT_SCRIPT }} <<EOF | |
| import runpy | |
| import sys | |
| import os | |
| sys.path.append(os.path.abspath(".")) | |
| if False: | |
| import src.HwCodecDetect.run_tests | |
| if __name__ == "__main__": | |
| runpy.run_module('src.HwCodecDetect.run_tests', run_name='__main__', alter_sys=True) | |
| EOF | |
| fi | |
| - name: Set up Python (Native) | |
| if: matrix.job_type == 'native' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| architecture: ${{ matrix.python_arch }} | |
| - name: Install & Build (Native) | |
| if: matrix.job_type == 'native' | |
| shell: bash | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build wheel setuptools pyinstaller | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| # Copy logo resources for packaging | |
| mkdir -p src/HwCodecDetect/resources | |
| cp imgs/logo.gif imgs/logo.ico src/HwCodecDetect/resources/ | |
| pip install . | |
| if [ "$RUNNER_OS" == "Windows" ]; then SEP=";"; else SEP=":"; fi | |
| ADD_PARAMS="" | |
| if [ "${{ matrix.branch_mode }}" == "ui" ]; then | |
| ADD_PARAMS="--noconsole --disable-windowed-traceback" | |
| fi | |
| ICON_PARAMS="" | |
| if [ "$RUNNER_OS" == "Windows" ]; then | |
| ICON_PARAMS="--icon imgs/logo.ico" | |
| elif [ "$RUNNER_OS" == "macOS" ]; then | |
| mkdir -p HwCodecDetect.iconset | |
| for sz in 16 32 128 256 512; do | |
| sips -z $sz $sz imgs/logo.png --out HwCodecDetect.iconset/icon_${sz}x${sz}.png >/dev/null | |
| sz2=$((sz * 2)) | |
| sips -z $sz2 $sz2 imgs/logo.png --out HwCodecDetect.iconset/icon_${sz}x${sz}@2x.png >/dev/null | |
| done | |
| iconutil -c icns HwCodecDetect.iconset -o imgs/logo.icns | |
| ICON_PARAMS="--icon imgs/logo.icns" | |
| fi | |
| pyinstaller --clean --onefile --name ${{ env.APP_NAME_INTERNAL }} \ | |
| $ADD_PARAMS \ | |
| $ICON_PARAMS \ | |
| --add-data "VERSION${SEP}." \ | |
| --add-data "src/HwCodecDetect/resources${SEP}imgs" \ | |
| --paths ".$SEP" \ | |
| --distpath dist \ | |
| --workpath build \ | |
| "${{ env.ENTRY_POINT_SCRIPT }}" | |
| - name: Build on Linux ${{ matrix.qemu_arch }} (Emulated) | |
| if: matrix.job_type == 'emulated' | |
| uses: uraimo/run-on-arch-action@v2 | |
| with: | |
| arch: ${{ matrix.qemu_arch }} | |
| distro: bullseye | |
| githubToken: ${{ github.token }} | |
| dockerRunArgs: | | |
| --volume "${{ github.workspace }}:/work" | |
| base_image: ${{ matrix.docker_img }} | |
| run: | | |
| cd /work | |
| apt-get update && apt-get install -y --no-install-recommends build-essential gcc zlib1g-dev git | |
| python3 -m pip install --upgrade pip | |
| pip install build wheel setuptools pyinstaller | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| # Copy logo resources for packaging | |
| mkdir -p src/HwCodecDetect/resources | |
| cp imgs/logo.gif imgs/logo.ico src/HwCodecDetect/resources/ | |
| pip install . | |
| pyinstaller --clean --onefile --name ${{ env.APP_NAME_INTERNAL }} \ | |
| --add-data "VERSION:." \ | |
| --add-data "src/HwCodecDetect/resources:imgs" \ | |
| --paths . \ | |
| --distpath dist \ | |
| --workpath build \ | |
| "${{ env.ENTRY_POINT_SCRIPT }}" | |
| chmod -R 777 dist/ | |
| - name: Rename Artifacts (Standardize) | |
| shell: bash | |
| run: | | |
| cd dist || exit 1 | |
| if [ -f "${{ env.APP_NAME_INTERNAL }}.exe" ]; then | |
| mv "${{ env.APP_NAME_INTERNAL }}.exe" "${{ matrix.asset_name }}" | |
| elif [ -f "${{ env.APP_NAME_INTERNAL }}" ]; then | |
| mv "${{ env.APP_NAME_INTERNAL }}" "${{ matrix.asset_name }}" | |
| fi | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: dist/${{ matrix.asset_name }} | |
| if-no-files-found: error | |
| create-release: | |
| name: Create Draft Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create Release (Draft) | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: "${{ github.ref_name }}" | |
| body: | | |
| ### Automated multi-platform build for CLI and GUI. | |
| - **CLI Version**: default mode (no GUI) | |
| - **GUI Version**: auto-enabled (--ui flag or HWCODECDETECT_GUI=1 env var) | |
| ### Supported Platforms: | |
| - **Windows**: x64, x86 (32-bit) | |
| - **macOS**: Apple Silicon (ARM64), Intel (x64) | |
| - **Linux**: x64, ARM64, x86 | |
| *Note: Windows ARM users should use the Windows x86 or x64 binary.* | |
| draft: true | |
| prerelease: true | |
| files: | | |
| artifacts/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |