Skip to content

Commit

Permalink
Add a CP/M CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
dfandrich committed Feb 1, 2024
1 parent 714cf22 commit 8df6189
Showing 1 changed file with 56 additions and 4 deletions.
60 changes: 56 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ jobs:
libc6-dev-powerpc-cross
gcc-10-powerpc64-linux-gnu
libc6-dev-ppc64-cross
unzip
xz-utils
- name: 'Install binaries'
# z88dk only releases OS X and Windows binaries, so use the Windows ones
run: |
curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/z88dk/z88dk/releases/download/v2.3/z88dk-win32-2.3.zip
unzip -q z88dk-win32-2.3.zip
- name: 'Build CP/M emulator'
run: |
GITHASH=7f15e5aa45972b2fdfa4dd5537ce7a3b730fc4a0
curl -LOJsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/jhallen/cpm/archive/"$GITHASH".tar.gz
tar -xaf cpm-"$GITHASH".tar.gz
cd cpm-"$GITHASH"
make
cp cpm ..
- name: 'Compile with gcc'
run: make linux
- name: 'Run tests with gcc'
Expand Down Expand Up @@ -72,20 +88,56 @@ jobs:
run: make test TESTWRAPPER=qemu-ppc64
- name: 'Set up wine'
run: |
cat >wine-wrapper <<EOF
mkdir wrappers
cat >wrappers/wine-test-wrapper <<EOF
#!/bin/bash
set -o pipefail
# Show all errors except for the ones about querying the display
WINEDEBUG=-all,err+all,-explorer wine "\$@" |& dos2unix
EOF
chmod 755 wine-wrapper
cat >wrappers/zcc <<EOF
#!/bin/bash
# Run zcc using wine
set -o pipefail
# Show all errors except for the ones about querying the display
WINEDEBUG=-all,err+all,-explorer WINEPATH="$PWD/z88dk/bin" wine zcc "\$@" |& dos2unix
EOF
cat >wrappers/cpm-test-wrapper <<EOF
#!/bin/bash
# Run a program under the CP/M emulator, changing directories to match
# the location of the first argument, if necessary
set -o pipefail
if [[ "${1//\//}" != "${1}" ]]; then
# First argument
NEWDIR="$(dirname "$1")"
NEWARG="$(basename "$1")"
set -- "$1" "$NEWARG" "${@:3}"
# copy the binary to the desired directory
cp -f "$1" "$NEWDIR"
cd "$NEWDIR"
fi
# kill the initial A> prompt
# TODO: fix tests
"$PWD/cpm" "\$@" |& tail +13c | dos2unix -q
rc=$?
if [[ -n "$NEWDIR" ]]; then
# remove the copied binary
rm -f "$1"
fi
exit "$rc"
EOF
chmod 755 wrappers/*
# Run wine once to set it up, which displays some logs that would mess up tests
WINEDEBUG=-all wine cmd /c exit
- name: 'Compile with mingw32'
run: make clean && make linux LINUX_CC=x86_64-w64-mingw32-gcc
- name: 'Run tests with mingw32+wine'
run: make test TESTWRAPPER=./wine-wrapper
run: make test TESTWRAPPER=wrappers/wine-test-wrapper
- name: 'Compile with mingw32-posix'
run: make clean && make linux LINUX_CC=x86_64-w64-mingw32-gcc-10-posix
- name: 'Run tests with mingw32-posix+wine'
run: make test TESTWRAPPER=./wine-wrapper
run: make test TESTWRAPPER=wrappers/wine-test-wrapper
- name: 'Compile with z88dk'
run: make clean && PATH="$PATH:$PWD/wrappers" make cpm
- name: 'Run tests with z88dk'
run: make test TESTWRAPPER=wrappers/cpm-test-wrapper

0 comments on commit 8df6189

Please sign in to comment.