diff --git a/.github/workflows/build.tcl b/.github/workflows/build.tcl new file mode 100755 index 00000000..3987a3d6 --- /dev/null +++ b/.github/workflows/build.tcl @@ -0,0 +1,58 @@ +#!/usr/bin/expect + +set timeout 60 +spawn sh boot/qemu -ci + +# Boot up +expect "Selection: " +send "4\r" +expect "bootfile: " +send "2\r" +expect "term% " + +proc terminate {status} { + # Halt + expect "term% " + send "fshalt\r" + expect "done halting" + + # Enter QEMU monitor + send "\x1d" ; # Ctrl+Alt+2 + send "close\r" + + exit $status +} + +# Build sources +send "cd /sys/src\r" +expect "term% " + +set timeout [expr 10*60] +send "objtype=386 mk libs cleanlibs\r" +expect { + timeout { + puts stderr "timeout" + exit 1 + } + -re "mk: (.+): exit status=(.+)" { + terminate 1 + } + "term% " +} + +set timeout [expr 2*60*60] +send "mk release\r" +expect { + timeout { + puts stderr "timeout" + exit 1 + } + -re "mk: (.+): exit status=(.+)" { + terminate 1 + } + "term% " +} + +set timeout 60 +send "echo XXX:\$status\r" +terminate 0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..5c3390d1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: Build + +on: + pull_request: +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Setup qemu + run: | + sudo apt update + sudo apt -y install qemu-kvm expect + - name: Install plan9 binaries from the latest release + run: | + gh release download --pattern=x86.tar.gz + tar zxf x86.tar.gz + rm -f x86.tar.gz + env: + GH_TOKEN: ${{ github.token }} + - name: Run tests + run: | + ./boot/mkdirs + ./.github/workflows/build.tcl diff --git a/boot/qemu b/boot/qemu index decf6b27..8a20bae2 100755 --- a/boot/qemu +++ b/boot/qemu @@ -4,6 +4,7 @@ set -e cd $(dirname $0) pxe=pxeboot.raw +display=gtk vmdisk=false case "$1" in -pxenew) @@ -13,13 +14,18 @@ case "$1" in -mini) pxe=mini.raw shift + ;; +-ci) + display=none + shift + ;; esac case "$#" in 0) ;; *) - echo 'usage: boot/qemu [-pxenew]' >&2 + echo 'usage: boot/qemu [-pxenew] [-mini] [-ci]' >&2 exit 1 esac @@ -30,7 +36,7 @@ u9fs="guestfwd=tcp:10.0.2.1:564-cmd:../sys/src/cmd/unix/u9fs/u9fs -a none -u $US tftp='tftp=..' mac=mac=52:54:00:12:34:56 -qemu-system-x86_64 -m 1G -smp 1 -serial stdio \ +qemu-system-x86_64 -m 1G -smp 1 -serial stdio -display $display \ -drive file=$pxe,format=raw -snapshot \ -device virtio-net-pci,netdev=net0,$mac \ -netdev "user,id=net0,$u9fs,$tftp" diff --git a/cfg/pxe/525400123456 b/cfg/pxe/525400123456 index 121568c7..a97a299b 100644 --- a/cfg/pxe/525400123456 +++ b/cfg/pxe/525400123456 @@ -29,7 +29,7 @@ sysname=gnot partition=new factotumopts=-n user=glenda -console=0 +console=0 b115200 l8 pn s1 mouseport=ps2intellimouse monitor=vesa *nomp=1