ci: add freebsd tests (#8466)

pull/8470/head
Mitchell Hashimoto 2025-08-30 12:59:01 -07:00 committed by GitHub
commit 937d17cc35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 71 additions and 7 deletions

View File

@ -13,6 +13,7 @@ jobs:
- build-bench - build-bench
- build-dist - build-dist
- build-flatpak - build-flatpak
- build-freebsd
- build-linux - build-linux
- build-linux-libghostty - build-linux-libghostty
- build-nix - build-nix
@ -1015,3 +1016,57 @@ jobs:
- name: valgrind - name: valgrind
run: | run: |
nix develop -c zig build test-valgrind nix develop -c zig build test-valgrind
build-freebsd:
name: Build on FreeBSD
needs: test
runs-on: namespace-profile-mitchellh-sm-systemd
strategy:
matrix:
release:
- "14.3"
# - "15.0" # disable until fixed: https://github.com/vmactions/freebsd-vm/issues/108
steps:
- name: Checkout Ghostty
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Start SSH
run: |
sudo systemctl start ssh
- name: Set up FreeBSD VM
uses: vmactions/freebsd-vm@05856381fab64eeee9b038a0818f6cec649ca17a # v1.2.3
with:
release: ${{ matrix.release }}
copyback: false
usesh: true
prepare: |
pkg install -y \
devel/blueprint-compiler \
devel/gettext \
devel/git \
devel/pkgconf \
graphics/wayland \
lang/zig \
security/ca_root_nss \
textproc/hs-pandoc \
x11-fonts/jetbrains-mono \
x11-toolkits/libadwaita \
x11-toolkits/gtk40 \
x11-toolkits/gtk4-layer-shell
run: |
zig env
- name: Run tests
shell: freebsd {0}
run: |
cd $GITHUB_WORKSPACE
zig build test
- name: Build GTK-NG app runtime
shell: freebsd {0}
run: |
cd $GITHUB_WORKSPACE
zig build
./zig-out/bin/ghostty +version

View File

@ -70,13 +70,15 @@ pub const Runtime = enum {
gtk, gtk,
pub fn default(target: std.Target) Runtime { pub fn default(target: std.Target) Runtime {
// The Linux default is GTK because it is a full featured application. return switch (target.os.tag) {
if (target.os.tag == .linux) return .@"gtk-ng"; // The Linux and FreeBSD default is GTK because it is a full
// featured application.
// Otherwise, we do NONE so we don't create an exe and we .linux, .freebsd => .@"gtk-ng",
// create libghostty. On macOS, Xcode is used to build the app // Otherwise, we do NONE so we don't create an exe and we create
// that links to libghostty. // libghostty. On macOS, Xcode is used to build the app that links
return .none; // to libghostty.
else => .none,
};
} }
}; };

View File

@ -131,6 +131,13 @@ pub const VTable = struct {
}; };
test Benchmark { test Benchmark {
// This test fails on FreeBSD so skip:
//
// /home/runner/work/ghostty/ghostty/src/benchmark/Benchmark.zig:165:5: 0x3cd2de1 in decltest.Benchmark (ghostty-test)
// try testing.expect(result.duration > 0);
// ^
if (builtin.os.tag == .freebsd) return error.SkipZigTest;
const testing = std.testing; const testing = std.testing;
const Simple = struct { const Simple = struct {
const Self = @This(); const Self = @This();