Added .github

This commit is contained in:
Pierre-Emmanuel Gob. 2026-09-17 21:26:55 +02:00
parent 7f91a9586a
commit 53f1295927
5 changed files with 144 additions and 0 deletions

39
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Bug report
description: The kernel doesn't build, doesn't boot, or misbehaves in QEMU
title: "[Bug]: "
labels: ["bug"]
body:
- type: textarea
id: what
attributes:
label: What happened?
description: What you saw versus what you expected.
validations:
required: true
- type: textarea
id: repro
attributes:
label: Steps to reproduce
description: Exact commands, starting from a clean checkout.
placeholder: |
1. `nasm -f bin boot.asm -o boot.bin`
2. `qemu-system-x86_64 -fda boot.bin`
3. …
validations:
required: true
- type: textarea
id: env
attributes:
label: Environment
description: OS and tool versions.
placeholder: |
OS: Ubuntu 24.04
nasm: 2.16.01 (`nasm -v`)
QEMU: 8.2.2 (`qemu-system-x86_64 --version`)
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs / screenshots
description: Paste terminal output or attach a screenshot of the QEMU window.

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1 @@
blank_issues_enabled: true

11
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,11 @@
## What does this change do?
<!-- One or two sentences. Link related issues, e.g. "Fixes #123". -->
## Checklist
- [ ] Builds cleanly without error
- [ ] Boots in QEMU and shows the expected output
- [ ] No generated artifacts committed (`*.o`, `*.bin`, `*.iso`, `build/` etc)
- [ ] Documentation updated if behavior changed
- [ ] AI policy respected: code is human-authored (or fully understood) see [CONTRIBUTING.md](CONTRIBUTING.md)

67
.github/scripts/check_boot.py vendored Normal file
View file

@ -0,0 +1,67 @@
"""QEMU boot check for Nadir CI.
Runs the boot sector headless on a pseudo-terminal with the curses display,
waits for the boot, then asserts the welcome message reached the screen.
A garbage image (SeaBIOS "No bootable device") fails this check.
Usage: python3 .github/scripts/check_boot.py (from the repository root)
Requires: qemu-system-x86_64 on PATH. Stdlib only.
"""
import fcntl
import os
import pty
import select
import struct
import subprocess
import sys
import termios
import time
IMAGE = "boot.bin"
NEEDLE = b"Nadir"
BOOT_WAIT_S = 8
def main() -> int:
master, slave = pty.openpty()
fcntl.ioctl(slave, termios.TIOCSWINSZ, struct.pack("HHHH", 24, 80, 0, 0))
env = dict(os.environ, TERM="xterm")
proc = subprocess.Popen(
["qemu-system-x86_64", "-display", "curses", "-fda", IMAGE],
stdin=slave,
stdout=slave,
stderr=subprocess.DEVNULL,
env=env,
)
os.close(slave)
time.sleep(BOOT_WAIT_S)
proc.terminate()
try:
proc.wait(timeout=10)
except subprocess.TimeoutExpired:
proc.kill()
proc.wait()
fcntl.fcntl(master, fcntl.F_SETFL, os.O_NONBLOCK)
data = b""
while True:
ready, _, _ = select.select([master], [], [], 1)
if not ready:
break
try:
chunk = os.read(master, 65536)
except OSError:
break
if not chunk:
break
data += chunk
os.close(master)
if NEEDLE not in data:
print(f"FAIL: {NEEDLE!r} not found on the QEMU screen")
return 1
print("OK: QEMU booted and printed the welcome message")
return 0
if __name__ == "__main__":
sys.exit(main())

26
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,26 @@
# Nadir Kernel CI. Runs on every pull request and every push to main.
#
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
build-and-boot:
name: Build and boot in QEMU
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install toolchain
run: sudo apt-get update && sudo apt-get install -y nasm qemu-system-x86
- name: Build boot sector
run: nasm -f bin boot.asm -o boot.bin