Skip to content

Commit

Permalink
Gitlab CI: Run tests on Wine.
Browse files Browse the repository at this point in the history
  • Loading branch information
Esme Povirk committed Apr 22, 2024
1 parent 3991f0f commit 9844770
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
stages:
- image
- build
- test

variables:
GIT_SUBMODULE_STRATEGY: "none"

include:
- local: "tools/ci/image.yml"
- local: "tools/ci/build.yml"
- local: "tools/ci/test.yml"
59 changes: 59 additions & 0 deletions tools/ci/download-addons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python3

import os
import shutil
import tempfile
import urllib.request

need_gecko = True
need_mono = False

basedir = os.path.join(os.getcwd(), "wine-addons")

existing_files = set(os.listdir(basedir))

addons_url = 'https://gitlab.winehq.org/wine/wine/-/raw/master/dlls/appwiz.cpl/addons.c?ref_type=heads&inline=false'

with urllib.request.urlopen(addons_url) as response:
addons_contents = response.read().decode('ascii')

gecko_version = None
mono_version = None

for line in addons_contents.splitlines():
if line.startswith('#define GECKO_VERSION '):
gecko_version = line.split()[2].strip('"')
print('Gecko version: ' + gecko_version)
if line.startswith('#define MONO_VERSION '):
mono_version = line.split()[2].strip('"')
print('Mono version: ' + mono_version)

needed_files = {}

if need_gecko:
needed_files['wine-gecko-' + gecko_version + '-x86.msi'] = 'https://dl.winehq.org/wine/wine-gecko/' + gecko_version + '/wine-gecko-' + gecko_version + '-x86.msi'
needed_files['wine-gecko-' + gecko_version + '-x86_64.msi'] = 'https://dl.winehq.org/wine/wine-gecko/' + gecko_version + '/wine-gecko-' + gecko_version + '-x86_64.msi'
if need_mono:
needed_files['wine-mono-' + mono_version + '-x86.msi'] = 'https://dl.winehq.org/wine/wine-mono/' + mono_version + '/wine-mono-' + mono_version + '-x86.msi'

def download(url, filename):
print("Downloading "+url)
with urllib.request.urlopen(url) as response:
with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
try:
shutil.copyfileobj(response, tmpfile)
shutil.move(tmpfile.name, filename)
except:
os.unlink(tmpfile.name)
raise

for f in needed_files:
if f in existing_files:
continue
download(needed_files[f], os.path.join(basedir, f))

for f in existing_files:
if f not in needed_files:
print("Removing "+f)
os.unlink(os.path.join(basedir, f))

42 changes: 42 additions & 0 deletions tools/ci/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
linux-test:
stage: test
image: $CI_REGISTRY/wine/wine:debian-bookworm
interruptible: true
cache:
- key: wine-addons
paths:
- wine-addons/
needs:
- job: build
before_script:
- |
- export BASEDIR=$PWD
- export PATH=$BASEDIR/usr/local/bin:$PATH
- export DISPLAY=:0
- export LC_ALL=C.UTF-8
- export LP_NUM_THREADS=4
- export WINEDEBUG=err-all,fixme-all
- |
cat >$HOME/xorg.conf << EOF
Section "Device"
Identifier "dummy"
Driver "dummy"
VideoRam 32768
EndSection
EOF
- echo 'exec /usr/bin/fvwm -f config -c "Style * MwmDecor" -c "Style * UsePPosition" 2>/dev/null' >$HOME/.xinitrc
- startx -- -config $HOME/xorg.conf $DISPLAY &
- mkdir -p wine-addons
- tools/ci/download-addons.sh
- wget -nv -O wine-build.zip "https://gitlab.winehq.org/wine/wine/-/jobs/artifacts/master/download?job=build-daily-linux"
- unzip -q wine-build.zip
- mkdir -p $HOME/Documents $HOME/Desktop usr/local/share/wine/gecko
- cp -l $BASEDIR/wine-addons/*.msi usr/local/share/wine/gecko
- pulseaudio --start --exit-idle-time=-1
- WINEDLLOVERRIDES=mscoree= wine wineboot.exe -u
- wine reg add 'HKCU\Software\Wine\WineDbg' /v ShowCrashDialog /t REG_DWORD /d 0 /f
- wine reg add 'HKCU\Software\Wine\Mono' /v RuntimePath /d "$(wine winepath -w ${BASEDIR}/image)" /f
- wine64 regsvr32 /s mscoree
- wineserver -w
script:
- wine tests/run-tests.exe

0 comments on commit 9844770

Please sign in to comment.