73 lines
3.0 KiB
YAML
73 lines
3.0 KiB
YAML
# Gitea act_runner (labels: ubuntu-latest / ubuntu-24.04 / ubuntu-22.04).
|
|
#
|
|
# The machine has no test framework of its own (tests/vm_test.c is the CLI), so
|
|
# the steps below are the promises the README makes about I/O and geometry.
|
|
name: ci
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "docs/**"
|
|
- "tapes/**"
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
smoke:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
# The runner image is a bare ubuntu, so the toolchain is installed per run.
|
|
# Point apt at a domestic mirror first -- archive.ubuntu.com is the slowest
|
|
# hop on this network. Swap APT_MIRROR for mirrors.aliyun.com/ubuntu or
|
|
# mirrors.ustc.edu.cn/ubuntu if TUNA is unhappy.
|
|
- name: toolchain
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
APT_MIRROR: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
|
|
run: |
|
|
set -eu
|
|
SUDO=""
|
|
command -v sudo >/dev/null 2>&1 && SUDO=sudo
|
|
# jammy and older keep sources.list; noble and newer use the deb822
|
|
# .sources format, so rewrite whatever exists.
|
|
for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.sources; do
|
|
[ -f "$f" ] || continue
|
|
$SUDO sed -i -E "s#https?://(archive|security|ports)\.ubuntu\.com/ubuntu#${APT_MIRROR}#g" "$f"
|
|
done
|
|
$SUDO apt-get update -qq
|
|
$SUDO apt-get install -y -qq --no-install-recommends cmake g++ make
|
|
cmake --version | head -1
|
|
g++ --version | head -1
|
|
echo "cores: $(nproc)"
|
|
- name: configure
|
|
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
|
- name: build
|
|
run: cmake --build build -j 4
|
|
- name: I/O modes and geometry
|
|
run: |
|
|
set -eu
|
|
exe=./build/rot8_test
|
|
fail() { echo "FAIL: $*" >&2; exit 1; }
|
|
out=$($exe --input R8F tapes/serial_echo.rot8)
|
|
[ "$out" = "R8F" ] || fail "serial default printed '$out'"
|
|
out=$($exe -n tapes/and.rot8 | tr "\n" " ")
|
|
[ "$out" = "512 1536 512 " ] || fail "-n and.rot8 printed '$out'"
|
|
out=$($exe --cell 1 tapes/and.rot8 | tr "\n" " ")
|
|
[ "$out" = "1 1 0 " ] || fail "--cell 1 and.rot8 printed '$out'"
|
|
$exe --serial --cell 1 tapes/and.rot8 >/dev/null 2>&1 && fail "--serial --cell 1 should fail"
|
|
$exe --numbers --parity even tapes/and.rot8 >/dev/null 2>&1 && fail "--numbers --parity even should fail"
|
|
out=$($exe --7e1 --input A tapes/serial_echo.rot8 | cut -c1)
|
|
[ "$out" = "A" ] || fail "--7e1 printed '$out'"
|
|
$exe --dump tapes/wave.rot8 | grep -q "of 259 cells" || fail "--dump lost its window line"
|
|
- name: usage text mentions both modes
|
|
run: |
|
|
set -eu
|
|
./build/rot8_test --help | grep -q -- "--numbers" || { echo "FAIL: --help lost --numbers" >&2; exit 1; }
|
|
./build/rot8_test --help | grep -q -- "--serial" || { echo "FAIL: --help lost --serial" >&2; exit 1; } |