From dd7b09dd94b7651411ea1bcfde9f7bb3107c7275 Mon Sep 17 00:00:00 2001 From: Tim Stirrat Date: Sun, 28 Jul 2024 13:47:23 +0200 Subject: [PATCH] try windows --- .github/workflows/test.yml | 37 ++++--------------------------------- tests/bgb_get_snapshot.py | 22 +++++++++------------- 2 files changed, 13 insertions(+), 46 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e72a7ab..620b53c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: [push] jobs: build: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v4 @@ -14,10 +14,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.12" - # - uses: schmiddim/action-wget-unzip@v2 - # with: - # url: "https://github.com/gbdk-2020/gbdk-2020/releases/download/4.3.0/gbdk-linux64.tar.gz" - # destination: gbdk - uses: robinraju/release-downloader@v1 with: repository: "gbdk-2020/gbdk-2020" @@ -25,20 +21,6 @@ jobs: fileName: "gbdk-linux64.tar.gz" extract: true tarBall: true - - uses: pyvista/setup-headless-display-action@v2 - - name: Install wine - run: | - sudo dpkg --add-architecture i386 - sudo mkdir -pm755 /etc/apt/keyrings - sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key - sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources - sudo apt update - sudo apt install -y --install-recommends winehq-stable winbind - wine --version - - name: Install wine-mono - run: | - wget https://github.com/madewokherd/wine-mono/releases/download/wine-mono-9.0.0/wine-mono-9.0.0-x86.msi - WINEDEBUG=fixme-all WINEDLLOVERRIDES=mscoree=d wine wine-mono-9.0.0-x86.msi - name: Get BGB uses: schmiddim/action-wget-unzip@v2 with: @@ -48,19 +30,8 @@ jobs: run: | cd tests python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - # - name: Lint with Ruff - # run: | - # cd tests - # pip install ruff - # ruff check --format=github --target-version=py310 . - # continue-on-error: true - - name: Run wine + pip install -r requirements.txt + - name: Test with pytest run: | cd tests - wine ../bgb/bgb.exe -set \"DebugSrcBrk=1\" -hf -stateonexit -screenonexit build/wav_test_load_and_play.bmp build/wav_test_load_and_play.gb - ls -alF - # - name: Test with pytest - # run: | - # cd tests - # pytest -v -s + pytest -v -s diff --git a/tests/bgb_get_snapshot.py b/tests/bgb_get_snapshot.py index e0ba2c9..f1c6509 100644 --- a/tests/bgb_get_snapshot.py +++ b/tests/bgb_get_snapshot.py @@ -41,16 +41,12 @@ def make_and_run(rom_relative): rom_path_full = base_path.joinpath(rom_relative) screenshot_path = rom_path_full.with_suffix('.bmp') - subprocess.run([ - "/usr/bin/env", - "wine", + result = subprocess.call([ "../bgb/bgb64.exe", "-set \"DebugSrcBrk=1\"", "-hf", "-stateonexit", - "-screenonexit", - screenshot_path, - + "-screenonexit", screenshot_path, rom_relative, ], cwd=base_dir, @@ -58,23 +54,23 @@ def make_and_run(rom_relative): # stderr=subprocess.DEVNULL, ) + if result != 0: + raise Exception("Rom execution failed " + rom_relative) + if not rom_path_full.with_suffix(".sna").is_file(): - raise Exception("Tried to run rom, failed " + rom_relative) + raise Exception( + "Snapshot not found after execution " + rom_relative) def make_rom(rom_relative): result = subprocess.call( - [ - "/usr/bin/env", - "make", - rom_relative - ], + ["make", rom_relative], cwd=base_dir, # stdout=subprocess.DEVNULL ) if result != 0: - raise Exception("Tried to make rom, failed " + rom_relative) + raise Exception("Rom make failed " + rom_relative) # The following code is repurposed from unit_checker.py by untoxa (MIT License)