Skip to content

Commit 13acb2c

Browse files
committed
👷 ci: Add GitHub Actions build and smoke test pipeline
This project has had no automated testing or CI for its entire history. As a code-preservation project, manual play-testing was the only way to verify changes didn't break the game. This commit adds a GitHub Actions pipeline that proves compilation succeeds and the game starts correctly on every push and pull request. The pipeline tests with both GCC and Clang via a build matrix, catching compiler-specific issues in parallel. The Makefile defaults to `-ltermcap` which is unavailable as a standalone library on the CI runner; the workflow overrides with `LIBS="-lncurses"` which provides termcap compatibility through `ncurses`. A smoke test pipes LOOK, QUIT, Y into the game and asserts the welcome banner, opening room description, and clean exit message all appear. This catches initialization failures, data file corruption, and command loop regressions without modifying any game source. Compilation caching via `ccache` keeps repeat builds fast. Each compiler gets its own cache keyed on source file content hashes, with prefix- based restore, so a single changed file still benefits from cached results for the other 32 compilation units. Concurrency controls cancel in-progress runs when new commits land on the same ref. No game source files are modified — the CI infrastructure is entirely additive and lives in `.github/`. Assisted-by: Claude Opus 4.6 (1M context) Signed-off-by: Justin Wheeler <jwheel@fedoraproject.org>
1 parent 30a117b commit 13acb2c

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
concurrency:
8+
group: ci-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
cc: [gcc, clang]
17+
18+
steps:
19+
- uses: actions/checkout@v6
20+
21+
- name: Restore compiler cache
22+
uses: actions/cache@v5
23+
with:
24+
path: ~/.cache/ccache
25+
key: ccache-${{ matrix.cc }}-${{ hashFiles('*.c', '*.h', 'Makefile') }}
26+
restore-keys: |
27+
ccache-${{ matrix.cc }}-
28+
29+
- name: Install dependencies
30+
run: sudo apt-get update -qq && sudo apt-get install -y -qq libncurses-dev ccache
31+
32+
- name: Build
33+
run: |
34+
ccache --zero-stats
35+
make clean
36+
make CC="ccache ${{ matrix.cc }}" LIBS="-lncurses" -j$(nproc)
37+
ccache --show-stats
38+
39+
- name: Verify binary
40+
run: test -x ./zork
41+
42+
- name: Smoke test
43+
run: |
44+
output=$(printf "LOOK\nQUIT\nY\n" | timeout 10 ./zork 2>&1)
45+
echo "$output"
46+
echo "--- Verifying expected output ---"
47+
echo "$output" | grep -q "Welcome to Dungeon"
48+
echo "$output" | grep -q "white house"
49+
echo "$output" | grep -q "mailbox"
50+
echo "$output" | grep -q "game is over"
51+
echo "--- Smoke test passed ---"

0 commit comments

Comments
 (0)