Workflow: Use xvfb-run for headless Windows Python installation in Docker
Some checks failed
Build Tamigo CLI / Build Linux Binary (push) Successful in 52s
Build Tamigo CLI / Build Windows Binary (push) Failing after 2m44s

This commit is contained in:
Daniel Dybing
2026-03-11 16:14:08 +01:00
parent 30d4c9dd47
commit 32da1e8ee1

View File

@@ -35,41 +35,43 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build Windows executable (True Cross-Compile) - name: Build Windows executable (Headless Cross-Compile)
run: | run: |
# 1. Create a local Dockerfile that installs Windows Python under Wine # 1. Create a local Dockerfile with xvfb for headless UI support
cat <<EOF > Dockerfile.win cat <<EOF > Dockerfile.win
FROM python:3.10-slim FROM python:3.10-slim
# Install Wine and dependencies ENV WINEDEBUG=-all
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture i386 && apt-get update && \ RUN dpkg --add-architecture i386 && apt-get update && \
apt-get install -y wine wine32 wine64 wget && \ apt-get install -y wine wine32 wine64 wget xvfb && \
apt-get clean apt-get clean
# Install Windows Python inside Wine # Install Windows Python using xvfb-run to provide a dummy display
RUN wget https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe && \ RUN wget https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe && \
wine python-3.10.11-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 && \ xvfb-run wine python-3.10.11-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 && \
rm python-3.10.11-amd64.exe rm python-3.10.11-amd64.exe
# Install dependencies inside Windows Python # Install dependencies
RUN wine python -m pip install --upgrade pip RUN xvfb-run wine python -m pip install --upgrade pip
RUN wine python -m pip install pyinstaller requests questionary rich python-dotenv RUN xvfb-run wine python -m pip install pyinstaller requests questionary rich python-dotenv
WORKDIR /src WORKDIR /src
EOF EOF
# 2. Build local image # 2. Build local image
docker build -t true-win-builder -f Dockerfile.win . docker build -t headless-win-builder -f Dockerfile.win .
# 3. Use unique container name # 3. Use unique container name
CONTAINER_NAME="win-build-${{ github.run_id }}" CONTAINER_NAME="win-build-${{ github.run_id }}"
# 4. Run build using the Windows Python interpreter # 4. Run build
docker create --name $CONTAINER_NAME true-win-builder wine python -m PyInstaller --onefile --name tamigo-cli tamigo.py docker create --name $CONTAINER_NAME headless-win-builder xvfb-run wine python -m PyInstaller --onefile --name tamigo-cli tamigo.py
docker cp . $CONTAINER_NAME:/src docker cp . $CONTAINER_NAME:/src
docker start -a $CONTAINER_NAME docker start -a $CONTAINER_NAME
# 5. Extract and cleanup # 5. Extract results
mkdir -p win_dist mkdir -p win_dist
docker cp $CONTAINER_NAME:/src/dist/. ./win_dist/ docker cp $CONTAINER_NAME:/src/dist/. ./win_dist/
docker rm $CONTAINER_NAME docker rm $CONTAINER_NAME
@@ -80,6 +82,7 @@ jobs:
ls -R win_dist/ || echo "No win_dist folder" ls -R win_dist/ || echo "No win_dist folder"
find . -name "*.exe" find . -name "*.exe"
# Downgrade to v3 for Gitea compatibility
- name: Upload Windows Artifact - name: Upload Windows Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with: