From 64ba5ddfcda5e41ed1d20e5010a5d8328bafa339 Mon Sep 17 00:00:00 2001 From: Kareem <2+imrayya@noreply.localhost> Date: Wed, 1 Jul 2026 14:10:11 +0200 Subject: [PATCH] ci: fixed wine so hopefully it works and build the exe --- .gitea/workflows/build-exe.yml | 35 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/build-exe.yml b/.gitea/workflows/build-exe.yml index 053b16a..82c4729 100644 --- a/.gitea/workflows/build-exe.yml +++ b/.gitea/workflows/build-exe.yml @@ -16,6 +16,7 @@ on: env: WINEPREFIX: ${{ github.workspace }}/wine-prefix WINEPYTHON: ${{ github.workspace }}/wine-prefix/drive_c/Python312/python.exe + XDG_RUNTIME_DIR: /tmp # Suppress harmless warning jobs: build: @@ -25,23 +26,22 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Wine + - name: Install Wine & xvfb run: | sudo dpkg --add-architecture i386 sudo mkdir -p /etc/apt/keyrings sudo wget -qO /etc/apt/keyrings/winehq-archive.key \ https://dl.winehq.org/wine-builds/winehq.key - # Use the actual Ubuntu codename of the runner CODENAME=$(lsb_release -cs) sudo wget -qO /etc/apt/sources.list.d/winehq-${CODENAME}.sources \ "https://dl.winehq.org/wine-builds/ubuntu/dists/${CODENAME}/winehq-${CODENAME}.sources" sudo apt-get update - sudo apt-get install --install-recommends winehq-stable -y + sudo apt-get install --install-recommends winehq-stable xvfb -y - - name: Set up Wine prefix + - name: Set up Wine prefix (headless) run: | mkdir -p "$WINEPREFIX" - wineboot --init + xvfb-run wineboot --init - name: Download Python installer run: | @@ -49,31 +49,31 @@ jobs: https://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe \ -O /tmp/python.exe - - name: Install Python in Wine + - name: Install Python in Wine (headless) run: | - wine /tmp/python.exe \ + xvfb-run wine /tmp/python.exe \ /quiet \ InstallAllUsers=1 \ PrependPath=1 \ Include_test=0 rm /tmp/python.exe - - name: Install Python dependencies + - name: Install Python dependencies (headless) run: | cd server - wine "$WINEPYTHON" -m pip install --upgrade pip - wine "$WINEPYTHON" -m pip install -r requirements.txt + xvfb-run wine "$WINEPYTHON" -m pip install --upgrade pip + xvfb-run wine "$WINEPYTHON" -m pip install -r requirements.txt - - name: Run tests + - name: Run tests (headless) run: | cd server - wine "$WINEPYTHON" -m pip install pytest pytest-asyncio - wine "$WINEPYTHON" -m pytest tests/ -v + xvfb-run wine "$WINEPYTHON" -m pip install pytest pytest-asyncio + xvfb-run wine "$WINEPYTHON" -m pytest tests/ -v - - name: Build .exe with PyInstaller + - name: Build .exe with PyInstaller (headless) run: | cd server - wine "$WINEPYTHON" -m PyInstaller \ + xvfb-run wine "$WINEPYTHON" -m PyInstaller \ tray_wrapper.py \ --name PaperDash \ --onefile \ @@ -93,17 +93,14 @@ jobs: GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_TAG: rolling-draft run: | - # API base URL (e.g. https://your-gitea.example.com/api/v1) API="${{ github.api_url }}/repos/${{ github.repository }}" - # Check if release for this tag already exists RESPONSE=$(curl -sS -H "Authorization: token $GITEA_TOKEN" \ "$API/releases/tags/$RELEASE_TAG") RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id // empty') if [ -n "$RELEASE_ID" ]; then echo "Updating existing draft release (ID $RELEASE_ID)" - # Update draft status and body curl -sS -X PATCH -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d '{ @@ -113,7 +110,6 @@ jobs: }' \ "$API/releases/$RELEASE_ID" - # Delete existing assets of this release (so we can upload a fresh one) ASSETS=$(curl -sS -H "Authorization: token $GITEA_TOKEN" \ "$API/releases/$RELEASE_ID/assets") for asset_id in $(echo "$ASSETS" | jq -r '.[].id'); do @@ -134,7 +130,6 @@ jobs: RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id') fi - # Upload the .exe as a release asset echo "Uploading PaperDash.exe to release $RELEASE_ID" curl -sS -X POST -H "Authorization: token $GITEA_TOKEN" \ -F "attachment=@server/dist/PaperDash.exe;type=application/vnd.microsoft.portable-executable" \