From ae8a5252c7ea547b81e08730eaa50c7243317a88 Mon Sep 17 00:00:00 2001 From: Daniel Dybing Date: Wed, 11 Mar 2026 12:15:22 +0100 Subject: [PATCH] Build: Use Docker for Windows cross-compilation on Linux workers --- .gitea/workflows/build.yml | 22 ++++++---------- .gitea/workflows/release.yml | 49 ++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index a5ae3de..aeb68d7 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -34,26 +34,20 @@ jobs: path: dist/tamigo-cli build-windows: - runs-on: windows-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Install dependencies + - name: Build Windows executable via Docker run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Build with PyInstaller - run: | - pyinstaller --onefile --name tamigo-cli tamigo.py + docker run --rm \ + -v "$(pwd):/src" \ + cdrx/pyinstaller-windows \ + "pip install -r requirements.txt && pyinstaller --onefile --name tamigo-cli tamigo.py" - name: Upload artifact uses: actions/upload-artifact@v3 with: name: tamigo-cli-windows - path: dist/tamigo-cli.exe + # The Docker image puts the output in dist/windows/ + path: dist/windows/tamigo-cli.exe diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 462fb11..de773ba 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -5,43 +5,38 @@ on: types: [published] jobs: - build-and-upload: - name: Build and Upload Release Assets - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: ubuntu-latest - artifact_name: tamigo-cli - release_asset_name: tamigo-cli-linux - - os: windows-latest - artifact_name: tamigo-cli.exe - release_asset_name: tamigo-cli-windows.exe - + build-linux: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.12' - - name: Install dependencies run: | - python -m pip install --upgrade pip pip install -r requirements.txt - - - name: Build with PyInstaller + - name: Build run: | pyinstaller --onefile --name tamigo-cli tamigo.py - - - name: Rename binary for release - shell: bash - run: | - mv dist/${{ matrix.artifact_name }} dist/${{ matrix.release_asset_name }} - - - name: Upload to Release + - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: ${{ matrix.release_asset_name }} - path: dist/${{ matrix.release_asset_name }} + name: tamigo-cli-linux + path: dist/tamigo-cli + + build-windows: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build Windows executable via Docker + run: | + docker run --rm \ + -v "$(pwd):/src" \ + cdrx/pyinstaller-windows \ + "pip install -r requirements.txt && pyinstaller --onefile --name tamigo-cli tamigo.py" + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: tamigo-cli-windows + path: dist/windows/tamigo-cli.exe