Skip to content

Run tests in qemu in GitHub action #126

Run tests in qemu in GitHub action

Run tests in qemu in GitHub action #126

Workflow file for this run

name: PR checks
on:
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: shellcheck shell scripts
run: |
shellcheck scripts/build-in-container.sh
shellcheck scripts/build-release-artifacts.sh
shellcheck test/run_cicd_dos.sh
build:
runs-on: ubuntu-latest
container:
image: ghcr.io/volkertb/debian-djgpp:v0.2
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Enforce Conventional Commits
uses: webiny/[email protected]
- name: Build project
run: |
make CC=gcc CXX=g++
objdump -x output/sbemu.exe
- name: 'Upload test files'
uses: actions/upload-artifact@v4
with:
name: sbemu-test-files
path: |
output/sbemu.exe
test/*
retention-days: 1
test:
needs: build
runs-on: ubuntu-latest
container:
image: ghcr.io/volkertb/cicd-qemu-dos-docker:v1.8
options: --device=/dev/kvm --cpus 1
steps:
- name: 'Download test files'
uses: actions/download-artifact@v4
with:
name: sbemu-test-files
- name: 'Download dependencies'
run: |
# HDPMI32i is needed for emulation to work with Protected Mode games
wget https://github.com/crazii/HX/releases/download/v0.1-beta3/HDPMI32i.zip
echo "4b7fc576d6c5dfd3fe7290fd1d0c0229118d01a55c8325d487452c2d6e0c3bbd HDPMI32i.zip" | sha256sum -c
unzip HDPMI32i.zip
# Jemm is needed for emulation to work with Real Mode games
wget https://github.com/Baron-von-Riedesel/Jemm/releases/download/v5.85pre1/JemmB_v585.zip
echo "8edc9653e58ae172584f5065b0d6111f1df75998008e46170d2767bfda8236b3 JemmB_v585.zip" | sha256sum -c
unzip JemmB_v585.zip
- name: Test executable
run: |
ls -lh /dev/kvm
ls -lh .
touch CICD_DOS.BAT
echo "JEMM386.EXE LOAD" >> CICD_DOS.BAT
echo "JLOAD QPIEMU.DLL" >> CICD_DOS.BAT
echo "HDPMI32i.EXE" >> CICD_DOS.BAT
echo "output\\sbemu" >> CICD_DOS.BAT
echo "cd test" >> CICD_DOS.BAT
#echo "ren dos32a.exe dos4gw.exe" >> CICD_DOS.BAT
echo "ECHO Current BLASTER variable: %BLASTER%" >> CICD_DOS.BAT
echo "stp32 dtmf_src.wav a32sbdg.dll" >> CICD_DOS.BAT
echo "ECHO %ERRORLEVEL% > exitcode.txt" >> CICD_DOS.BAT
echo "ECHO Result exit code of test command:" >> CICD_DOS.BAT
echo "type exitcode.txt" >> CICD_DOS.BAT
cp -f test/run_cicd_dos.sh /usr/local/bin/
chmod +x /usr/local/bin/run_cicd_dos.sh
/usr/local/bin/run_cicd_dos.sh
# Propagate error code from DOS test or exit with error code 254 if the exit code file is missing
echo step1
dos_exit_code=$(cat test/exitcode.txt || echo 254)
echo step2
if [ $dos_exit_code -ne 0 ]; then
exit $dos_exit_code
fi
echo step3
echo apt install -y dtmf2num
echo step4
echo dtmf2num hda_out.wav