Build: Use Docker for Windows cross-compilation on Linux workers
Some checks failed
Build Tamigo CLI / build-linux (push) Successful in 52s
Build Tamigo CLI / build-windows (push) Failing after 32s

This commit is contained in:
Daniel Dybing
2026-03-11 12:15:22 +01:00
parent 2bbcbd7c7f
commit ae8a5252c7
2 changed files with 30 additions and 41 deletions

View File

@@ -34,26 +34,20 @@ jobs:
path: dist/tamigo-cli path: dist/tamigo-cli
build-windows: build-windows:
runs-on: windows-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python - name: Build Windows executable via Docker
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: | run: |
python -m pip install --upgrade pip docker run --rm \
pip install -r requirements.txt -v "$(pwd):/src" \
cdrx/pyinstaller-windows \
- name: Build with PyInstaller "pip install -r requirements.txt && pyinstaller --onefile --name tamigo-cli tamigo.py"
run: |
pyinstaller --onefile --name tamigo-cli tamigo.py
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: tamigo-cli-windows name: tamigo-cli-windows
path: dist/tamigo-cli.exe # The Docker image puts the output in dist/windows/
path: dist/windows/tamigo-cli.exe

View File

@@ -5,43 +5,38 @@ on:
types: [published] types: [published]
jobs: jobs:
build-and-upload: build-linux:
name: Build and Upload Release Assets runs-on: ubuntu-latest
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
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.12' python-version: '3.12'
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Build
- name: Build with PyInstaller
run: | run: |
pyinstaller --onefile --name tamigo-cli tamigo.py pyinstaller --onefile --name tamigo-cli tamigo.py
- name: Upload artifact
- name: Rename binary for release
shell: bash
run: |
mv dist/${{ matrix.artifact_name }} dist/${{ matrix.release_asset_name }}
- name: Upload to Release
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ matrix.release_asset_name }} name: tamigo-cli-linux
path: dist/${{ matrix.release_asset_name }} 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