Files
e-ink-dash/.gitea/workflows/build-exe.yml
T
Imrayya f99ae2570d
Build Server .exe / build (push) Failing after 2m50s
ci: Xvfb started manually
2026-07-01 14:36:07 +02:00

149 lines
5.0 KiB
YAML

name: Build Server .exe
on:
push:
branches: [main]
paths:
- "server/**"
- ".gitea/workflows/build-exe.yml"
pull_request:
branches: [main]
paths:
- "server/**"
- ".gitea/workflows/build-exe.yml"
workflow_dispatch:
env:
WINEPREFIX: ${{ github.workspace }}/wine-prefix
WINEPYTHON: ${{ github.workspace }}/wine-prefix/drive_c/Python312/python.exe
DISPLAY: :99.0
WINEDLLOVERRIDES: "mscoree,mshtml=;winemenubuilder.exe=d"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
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 xvfb -y
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x16 &
sleep 2 # give Xvfb a moment
- name: Set up Wine prefix
run: |
mkdir -p "$WINEPREFIX"
# Initialize the prefix without Mono/Gecko timeouts
wineboot --init --update
# Set Windows version to 10 (or your target)
winecfg -v win10
- name: Download Python installer
run: |
wget -q \
https://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe \
-O /tmp/python.exe
- name: Install Python in Wine
run: |
wine /tmp/python.exe \
/quiet \
InstallAllUsers=1 \
PrependPath=1 \
Include_test=0
rm /tmp/python.exe
- name: Install Python dependencies
run: |
cd server
wine "$WINEPYTHON" -m pip install --upgrade pip
wine "$WINEPYTHON" -m pip install -r requirements.txt
- name: Run tests
run: |
cd server
wine "$WINEPYTHON" -m pip install pytest pytest-asyncio
wine "$WINEPYTHON" -m pytest tests/ -v
- name: Build .exe with PyInstaller
run: |
cd server
wine "$WINEPYTHON" -m PyInstaller \
tray_wrapper.py \
--name PaperDash \
--onefile \
--noconsole \
--clean
ls -la dist/
- name: Stop Xvfb
if: always()
run: killall Xvfb || true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PaperDash.exe
path: server/dist/PaperDash.exe
if-no-files-found: error
- name: Create or update draft release
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: rolling-draft
run: |
API="${{ github.api_url }}/repos/${{ github.repository }}"
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)"
curl -sS -X PATCH -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"draft": true,
"name": "Draft (latest build)",
"body": "Latest PaperDash server build from commit '"${{ github.sha }}"'. Built on Linux via Wine + PyInstaller. Edit tag, name, and notes before publishing."
}' \
"$API/releases/$RELEASE_ID"
ASSETS=$(curl -sS -H "Authorization: token $GITEA_TOKEN" \
"$API/releases/$RELEASE_ID/assets")
for asset_id in $(echo "$ASSETS" | jq -r '.[].id'); do
curl -sS -X DELETE -H "Authorization: token $GITEA_TOKEN" \
"$API/releases/$RELEASE_ID/assets/$asset_id"
done
else
echo "Creating new draft release"
RESPONSE=$(curl -sS -X POST -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"tag_name": "'"$RELEASE_TAG"'",
"draft": true,
"name": "Draft (latest build)",
"body": "Latest PaperDash server build from commit '"${{ github.sha }}"'. Built on Linux via Wine + PyInstaller. Edit tag, name, and notes before publishing."
}' \
"$API/releases")
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
fi
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" \
"$API/releases/$RELEASE_ID/assets"