Skip to content
130 changes: 130 additions & 0 deletions .github/workflows/build-test-and-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build, run test and upload binaries

on: [push, pull_request]

jobs:

linux-clang:
runs-on: "ubuntu-20.04"

steps:
- uses: actions/checkout@v2

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H%M')"

- name: Install build dependencies
run: sudo apt -y update && sudo apt -y install libpcap-dev libsdl-dev netcat-openbsd

- name: Create build environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wall"

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config Release
env:
MAKEFLAGS: "-j2"

- name: Run test scripts
working-directory: ${{runner.workspace}}/axpbox
shell: bash
run: ${{runner.workspace}}/axpbox/test/run

- name: Upload AXPbox binary
uses: actions/upload-artifact@v1
with:
name: AXPbox-linux-clang-${{ env.BUILD_DATE }}
path: ${{runner.workspace}}/build/axpbox
env:
BUILD_DATE: ${{ steps.date.outputs.date }}

linux-gcc:
runs-on: "ubuntu-20.04"

steps:
- uses: actions/checkout@v2

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H%M')"

- name: Install build dependencies
run: sudo apt -y update && sudo apt -y install libpcap-dev libsdl-dev netcat-openbsd

- name: Create build environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wall"

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config Release
env:
MAKEFLAGS: "-j2"

- name: Run test scripts
working-directory: ${{runner.workspace}}/axpbox
shell: bash
run: ${{runner.workspace}}/axpbox/test/run

- name: Upload AXPbox binary
uses: actions/upload-artifact@v1
with:
name: AXPbox-linux-gcc-${{ env.BUILD_DATE }}
path: ${{runner.workspace}}/build/axpbox
env:
BUILD_DATE: ${{ steps.date.outputs.date }}

osx-appleclang:
runs-on: "macos-10.15"
continue-on-error: true

steps:
- uses: actions/checkout@v2

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H%M')"

- name: Create build environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Install dependencies
run: brew install libpcap netcat gnu-sed # sdl2 libx11 / sdl doesnt work see #44

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wall -std=c++11 -stdlib=libc++ -I/usr/local/opt/libpcap/include"

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config Release
env:
MAKEFLAGS: "-j2"

- name: Run test scripts
working-directory: ${{runner.workspace}}/axpbox
shell: bash
run: ${{runner.workspace}}/axpbox/test/run

- name: Upload AXPbox Binary
uses: actions/upload-artifact@v1
with:
name: AXPbox-osx-10.15-appleclang-${{ env.BUILD_DATE }}
path: ${{runner.workspace}}/build/axpbox
env:
BUILD_DATE: ${{ steps.date.outputs.date }}

17 changes: 14 additions & 3 deletions test/disk/unwritable/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@ if [[ ! -f "cl67srmrom.exe" ]]; then
fi

# Start AXPbox
../../../build/axpbox run | tee axp.log
if [[ -f ../../../build/axpbox ]]; then
../../../build/axpbox run | tee axp.log
elif [[ -f ../../../../build/axpbox ]]; then
../../../../build/axpbox run | tee axp.log;
else
../../build/axpbox run | tee axp.log
fi

chmod 700 disk-unwritable.img
rm disk-unwritable.img

sed -i -e 's$/[^ ]*/DiskFile.cpp$DiskFile.cpp$g' \
-e 's/line [0-9]*/line L/g' -e '/$Id/d' axp.log
# OS X github runner has weiro sed version, use gnu one there.
SED=/usr/bin/sed
if [[ -f "/usr/local/opt/gnu-sed/libexec/gnubin/sed" ]]; then
SED=/usr/local/opt/gnu-sed/libexec/gnubin/sed
fi

${SED} -i -e 's$/[^ ]*/DiskFile.cpp$DiskFile.cpp$g' -e 's/line [0-9]*/line L/g' -e '/$Id/d' axp.log

echo -n -e '\033[1;31m'
diff -c axp_correct.log axp.log && echo -e '\033[1;32mdiff clean\033[0m'
Expand Down
21 changes: 15 additions & 6 deletions test/rom/test.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
#!/bin/bash
export LC_CTYPE=C
export LANG=C
export LC_ALL=C

# Download the firmware
wget 'http://80.211.96.38/s/inc/downloads/es40-srmon/cl67srmrom.exe'
wget 'http://raymii.org/s/inc/downloads/es40-srmon/cl67srmrom.exe'

# Start AXPbox
../../build/axpbox run &
AXPBOX_PID=$!
if [[ -f ../../../build/axpbox ]]; then
../../../build/axpbox run &
AXPBOX_PID=$!
else # Travis
../../build/axpbox run &
AXPBOX_PID=$!
fi

# Wait for AXPbox to start
sleep 3
sleep 5

# Connect to terminal
nc -t 127.0.0.1 21000 | tee axp.log &
NETCAT_PID=$!

# Wait for the last line of log to become P00>>>
timeout=300
timeout=100
while true
do
if [ $timeout -eq 0 ]
Expand All @@ -24,7 +32,8 @@ do
exit 1
fi

if [ "$(tail -n 1 axp.log | tr -d '\0')" == "P00>>>" ]
# print last line and remove null byte from it
if [ "$(LC_ALL=C sed -n '$p' axp.log | LC_ALL=C sed 's/\x00//g')" == "P00>>>" ]
then
echo
break
Expand Down