Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

on:
# push only on main; PR branches are covered by pull_request. Scoping push this
# way avoids the double run (a push to a branch with an open PR otherwise fires
# both events).
push:
branches: [main]
pull_request:

# libtile57 (the static lib linked into chartplotter's CGO binary) and the tile57
# CLI are built with Zig 0.16. The nested submodules carry the IHO S-101 catalogues
# that are embedded at build time, so checkout must be recursive.
#
# chartplotter cross-compiles its CGO binary against this engine with `zig cc` for
# linux + windows, amd64/arm64 (see chartplotter's release/xbuild). A default
# `zig build` builds BOTH libtile57.a and the `tile57` CLI exe, so the whole engine
# — not just the lib — has to compile for every one of those targets. The
# cross-compile matrix guards that here, in the engine repo, instead of only
# surfacing downstream when chartplotter tags a release.
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: Build (native)
run: zig build -Doptimize=ReleaseFast
- name: Test
run: zig build test

cross-compile:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-linux-gnu
- aarch64-linux-gnu
- x86_64-windows-gnu
- aarch64-windows-gnu
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0
# Builds libtile57.a + the tile57 CLI exe for the target. This is exactly
# what chartplotter's `xbuild` invokes per target before linking the Go
# binary, so a green matrix means the downstream cross-build will link.
- name: Cross-compile ${{ matrix.target }}
run: zig build -Dtarget=${{ matrix.target }} -Doptimize=ReleaseFast
4 changes: 4 additions & 0 deletions tools/ascii.zig
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ pub fn run(io: std.Io, a: std.mem.Allocator, args: []const [:0]const u8) !void {
// carriage-returns), alternate screen + hidden cursor, terminal re-measured
// every frame so a resize just repaints.
fn runAsciiTui(io: std.Io, a: std.mem.Allocator, c: *chart.Chart, lon0: f64, lat0: f64, zoom0: f64, palette: render.resolve.PaletteId, m: *render.resolve.MarinerSettings, ansi: bool, kitty: bool) !void {
// The interactive TUI is POSIX-only: std.posix.termios is `void` on Windows,
// so gate the whole raw-mode body out at comptime (same idiom as common.zig's
// terminalSize). The non-interactive `ascii` render paths stay cross-platform.
if (@import("builtin").os.tag == .windows) return usageErr("--tui is not supported on Windows");
const stdout = std.Io.File.stdout();
const stdin_fd = std.Io.File.stdin().handle;
const old = std.posix.tcgetattr(stdin_fd) catch return usageErr("--tui needs a terminal");
Expand Down
4 changes: 4 additions & 0 deletions tools/explore.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,10 @@ fn exLoadCell(
// transmit-once-per-view + place, deleted each frame — the same cached-region
// pattern as the ascii kitty TUI, so it never scrolls the layout.
fn exploreTui(io: std.Io, a: std.mem.Allocator, rows: []const ExIndexRow, cells: []const ExCellSrc, dir: std.Io.Dir, rules: []const u8, F: ExFilters, kitty: bool, palette: render.resolve.PaletteId, m: *const render.resolve.MarinerSettings, source: []const u8) !void {
// The interactive TUI is POSIX-only: std.posix.termios is `void` on Windows,
// so gate the whole raw-mode body out at comptime (same idiom as common.zig's
// terminalSize). The non-interactive `explore` paths stay cross-platform.
if (@import("builtin").os.tag == .windows) return usageErr("--tui is not supported on Windows");
const stdout = std.Io.File.stdout();
const stdin_fd = std.Io.File.stdin().handle;
const old = std.posix.tcgetattr(stdin_fd) catch return usageErr("--tui needs a terminal");
Expand Down
Loading