name: Linux Qt5 PyQt Wheel

on:
  workflow_call:

jobs:
  build:
    runs-on:  ubuntu-24.04

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Install Qt
        uses: jurplel/install-qt-action@v3
        with:
          aqtversion: '==3.1.*'
          version:      5.15.2
          host:         linux
          target:       desktop
          arch:         gcc_64

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: 3.12

      - name: Install Python Dependencies
        run: |
          python -m pip install --upgrade pip
          pip install build

      - name: Make Python Wheel
        working-directory: ${{ runner.temp }}
        run: |
          mkdir python
          cd python
          cp -r ${{ github.workspace }}/src .
          cp ${{ github.workspace }}/license.txt .
          cp ${{ github.workspace }}/readme.md .
          cp ${{ github.workspace }}/python/pyqt5-pyproject.toml pyproject.toml
          cp ${{ github.workspace }}/python/QHexEdit.sip .

          python -m build --verbose

      - name: Save Python Wheel
        uses: actions/upload-artifact@v4
        with:
          name: wheel-qt5-linux
          path: ${{ runner.temp }}/python/dist