CI: Add checks for blueprint compiler / Nix refactors

1. Refactored Nix devshell/package to make it easier to keep
   LD_LIBRARY_PATH & buildInputs in sync (plus make it easier to re-use
   in other Nix environment).
2. Added a CI job to ensure that Blueprints are formatted correctly and
   that they will compile using `blueprint-compiler` 0.16.0.
3. Reformatted all Blueprints with `blueprint-compiler format`.
This commit is contained in:
Jeffrey C. Ollie
2025-03-18 15:33:12 -05:00
parent 0f2f0ab69f
commit 648e0a06ab
17 changed files with 192 additions and 148 deletions

View File

@ -28,6 +28,7 @@ jobs:
- alejandra - alejandra
- typos - typos
- translations - translations
- blueprint-compiler
- test-pkg-linux - test-pkg-linux
- test-debian-12 - test-debian-12
steps: steps:
@ -702,6 +703,35 @@ jobs:
msgcmp --use-untranslated "$f" po/com.mitchellh.ghostty.pot; msgcmp --use-untranslated "$f" po/com.mitchellh.ghostty.pot;
done done
blueprint-compiler:
if: github.repository == 'ghostty-org/ghostty'
runs-on: namespace-profile-ghostty-sm
timeout-minutes: 60
env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
steps:
- uses: actions/checkout@v4 # Check out repo so we can lint it
- name: Setup Cache
uses: namespacelabs/nscloud-cache-action@v1.2.0
with:
path: |
/nix
/zig
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: ghostty
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
skipPush: true
useDaemon: false # sometimes fails on short jobs
- name: check blueprints
run: nix develop -c ./nix/build-support/check-blueprints.sh
- name: check unchanged
run: git diff --exit-code
test-pkg-linux: test-pkg-linux:
strategy: strategy:
fail-fast: false fail-fast: false

View File

@ -51,6 +51,8 @@
devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix { devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix {
zig = zig.packages.${system}."0.14.0"; zig = zig.packages.${system}."0.14.0";
wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {}; wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {};
# remove once blueprint-compiler 0.16.0 is in the stable nixpkgs
blueprint-compiler = pkgs-unstable.blueprint-compiler;
zon2nix = zon2nix; zon2nix = zon2nix;
}; };

View File

@ -0,0 +1,43 @@
{
pkgs,
lib,
stdenv,
enableX11 ? true,
enableWayland ? true,
}:
[
pkgs.libGL
]
++ lib.optionals stdenv.hostPlatform.isLinux [
pkgs.bzip2
pkgs.expat
pkgs.fontconfig
pkgs.freetype
pkgs.harfbuzz
pkgs.libpng
pkgs.libxml2
pkgs.oniguruma
pkgs.simdutf
pkgs.zlib
pkgs.glslang
pkgs.spirv-cross
pkgs.libxkbcommon
pkgs.glib
pkgs.gobject-introspection
pkgs.gsettings-desktop-schemas
pkgs.gtk4
pkgs.libadwaita
]
++ lib.optionals (stdenv.hostPlatform.isLinux && enableX11) [
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXi
pkgs.xorg.libXrandr
]
++ lib.optionals (stdenv.hostPlatform.isLinux && enableWayland) [
pkgs.gtk4-layer-shell
pkgs.wayland
]

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -o nounset -o pipefail -o errexit
find src -name \*.blp -exec blueprint-compiler format {} \+
find src -name \*.blp -exec blueprint-compiler compile --output=/dev/null {} \;

View File

@ -0,0 +1,17 @@
{
pkgs,
lib,
stdenv,
}:
lib.makeSearchPath "lib/girepository-1.0" (map (lib.getOutput "lib") (lib.optionals stdenv.hostPlatform.isLinux [
pkgs.cairo
pkgs.gdk-pixbuf
pkgs.glib
pkgs.gobject-introspection
pkgs.graphene
pkgs.gtk4
pkgs.gtk4-layer-shell
pkgs.harfbuzz
pkgs.libadwaita
pkgs.pango
]))

View File

@ -0,0 +1,10 @@
{
pkgs,
lib,
stdenv,
enableX11 ? true,
enableWayland ? true,
}:
lib.makeLibraryPath (import ./build-inputs.nix {
inherit pkgs lib stdenv enableX11 enableWayland;
})

View File

@ -40,7 +40,6 @@
hicolor-icon-theme, hicolor-icon-theme,
harfbuzz, harfbuzz,
libpng, libpng,
libGL,
libxkbcommon, libxkbcommon,
libX11, libX11,
libXcursor, libXcursor,
@ -63,44 +62,18 @@
wayland-protocols, wayland-protocols,
zon2nix, zon2nix,
system, system,
pkgs,
}: let }: let
# See package.nix. Keep in sync. # See package.nix. Keep in sync.
rpathLibs = ld_library_path = import ./build-support/ld-library-path.nix {
[ inherit pkgs lib stdenv;
libGL };
] gi_typelib_path = import ./build-support/gi-typelib-path.nix {
++ lib.optionals stdenv.hostPlatform.isLinux [ inherit pkgs lib stdenv;
bzip2 };
expat
fontconfig
freetype
harfbuzz
libpng
libxml2
oniguruma
simdutf
zlib
glslang
spirv-cross
libxkbcommon
libX11
libXcursor
libXi
libXrandr
libadwaita
gtk4
gtk4-layer-shell
glib
gobject-introspection
wayland
];
in in
mkShell { mkShell {
name = "ghostty"; name = "ghostty";
packages = packages =
[ [
# For builds # For builds
@ -186,7 +159,8 @@ in
# This should be set onto the rpath of the ghostty binary if you want # This should be set onto the rpath of the ghostty binary if you want
# it to be "portable" across the system. # it to be "portable" across the system.
LD_LIBRARY_PATH = lib.makeLibraryPath rpathLibs; LD_LIBRARY_PATH = ld_library_path;
GI_TYPELIB_PATH = gi_typelib_path;
shellHook = shellHook =
(lib.optionalString stdenv.hostPlatform.isLinux '' (lib.optionalString stdenv.hostPlatform.isLinux ''

View File

@ -1,26 +1,12 @@
{ {
lib, lib,
stdenv, stdenv,
bzip2,
callPackage, callPackage,
expat,
fontconfig,
freetype,
harfbuzz,
libpng,
oniguruma,
zlib,
libGL,
glib,
gtk4,
gtk4-layer-shell,
gobject-introspection, gobject-introspection,
libadwaita,
blueprint-compiler, blueprint-compiler,
libxml2, libxml2,
gettext, gettext,
wrapGAppsHook4, wrapGAppsHook4,
gsettings-desktop-schemas,
git, git,
ncurses, ncurses,
pkg-config, pkg-config,
@ -29,14 +15,10 @@
revision ? "dirty", revision ? "dirty",
optimize ? "Debug", optimize ? "Debug",
enableX11 ? true, enableX11 ? true,
libX11,
libXcursor,
libXi,
libXrandr,
enableWayland ? true, enableWayland ? true,
wayland,
wayland-protocols, wayland-protocols,
wayland-scanner, wayland-scanner,
pkgs,
}: let }: let
# The Zig hook has no way to select the release type without actual # The Zig hook has no way to select the release type without actual
# overriding of the default flags. # overriding of the default flags.
@ -48,6 +30,12 @@
zig_hook = zig_0_14.hook.overrideAttrs { zig_hook = zig_0_14.hook.overrideAttrs {
zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize} --color off"; zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize} --color off";
}; };
gi_typelib_path = import ./build-support/gi-typelib-path.nix {
inherit pkgs lib stdenv;
};
buildInputs = import ./build-support/build-inputs.nix {
inherit pkgs lib stdenv enableX11 enableWayland;
};
in in
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "ghostty"; pname = "ghostty";
@ -96,38 +84,12 @@ in
wayland-protocols wayland-protocols
]; ];
buildInputs = buildInputs = buildInputs;
[
libGL
]
++ lib.optionals stdenv.hostPlatform.isLinux [
bzip2
expat
fontconfig
freetype
harfbuzz
libpng
oniguruma
zlib
libadwaita
gtk4
glib
gsettings-desktop-schemas
]
++ lib.optionals enableX11 [
libX11
libXcursor
libXi
libXrandr
]
++ lib.optionals enableWayland [
gtk4-layer-shell
wayland
];
dontConfigure = true; dontConfigure = true;
GI_TYPELIB_PATH = gi_typelib_path;
zigBuildFlags = [ zigBuildFlags = [
"--system" "--system"
"${finalAttrs.deps}" "${finalAttrs.deps}"

View File

@ -8,7 +8,7 @@ Adw.MessageDialog clipboard_confirmation_window {
responses [ responses [
cancel: _("Deny") suggested, cancel: _("Deny") suggested,
ok: _("Allow") destructive ok: _("Allow") destructive,
] ]
default-response: "cancel"; default-response: "cancel";
@ -16,7 +16,7 @@ Adw.MessageDialog clipboard_confirmation_window {
extra-child: Overlay { extra-child: Overlay {
styles [ styles [
"osd" "osd",
] ]
ScrolledWindow text_view_scroll { ScrolledWindow text_view_scroll {
@ -33,7 +33,7 @@ Adw.MessageDialog clipboard_confirmation_window {
right-margin: 8; right-margin: 8;
styles [ styles [
"clipboard-content-view" "clipboard-content-view",
] ]
} }
} }
@ -60,7 +60,7 @@ Adw.MessageDialog clipboard_confirmation_window {
margin-top: 12; margin-top: 12;
styles [ styles [
"opaque" "opaque",
] ]
Image { Image {

View File

@ -8,7 +8,7 @@ Adw.MessageDialog clipboard_confirmation_window {
responses [ responses [
cancel: _("Deny") suggested, cancel: _("Deny") suggested,
ok: _("Allow") destructive ok: _("Allow") destructive,
] ]
default-response: "cancel"; default-response: "cancel";
@ -16,7 +16,7 @@ Adw.MessageDialog clipboard_confirmation_window {
extra-child: Overlay { extra-child: Overlay {
styles [ styles [
"osd" "osd",
] ]
ScrolledWindow text_view_scroll { ScrolledWindow text_view_scroll {
@ -33,7 +33,7 @@ Adw.MessageDialog clipboard_confirmation_window {
right-margin: 8; right-margin: 8;
styles [ styles [
"clipboard-content-view" "clipboard-content-view",
] ]
} }
} }
@ -60,7 +60,7 @@ Adw.MessageDialog clipboard_confirmation_window {
margin-top: 12; margin-top: 12;
styles [ styles [
"opaque" "opaque",
] ]
Image { Image {

View File

@ -8,7 +8,7 @@ Adw.MessageDialog clipboard_confirmation_window {
responses [ responses [
cancel: _("Cancel") suggested, cancel: _("Cancel") suggested,
ok: _("Paste") destructive ok: _("Paste") destructive,
] ]
default-response: "cancel"; default-response: "cancel";
@ -16,7 +16,7 @@ Adw.MessageDialog clipboard_confirmation_window {
extra-child: Overlay { extra-child: Overlay {
styles [ styles [
"osd" "osd",
] ]
ScrolledWindow text_view_scroll { ScrolledWindow text_view_scroll {
@ -33,7 +33,7 @@ Adw.MessageDialog clipboard_confirmation_window {
right-margin: 8; right-margin: 8;
styles [ styles [
"clipboard-content-view" "clipboard-content-view",
] ]
} }
} }
@ -60,7 +60,7 @@ Adw.MessageDialog clipboard_confirmation_window {
margin-top: 12; margin-top: 12;
styles [ styles [
"opaque" "opaque",
] ]
Image { Image {

View File

@ -2,27 +2,27 @@ using Gtk 4.0;
using Adw 1; using Adw 1;
Adw.MessageDialog config_errors_dialog { Adw.MessageDialog config_errors_dialog {
heading: _("Configuration Errors"); heading: _("Configuration Errors");
body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors."); body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors.");
responses [ responses [
ignore: _("Ignore"), ignore: _("Ignore"),
reload: _("Reload Configuration") suggested, reload: _("Reload Configuration") suggested,
] ]
extra-child: ScrolledWindow { extra-child: ScrolledWindow {
min-content-width: 500; min-content-width: 500;
min-content-height: 100; min-content-height: 100;
TextView {
editable: false;
cursor-visible: false;
top-margin: 8;
bottom-margin: 8;
left-margin: 8;
right-margin: 8;
buffer: TextBuffer error_message { }; TextView {
} editable: false;
}; cursor-visible: false;
top-margin: 8;
bottom-margin: 8;
left-margin: 8;
right-margin: 8;
buffer: TextBuffer error_message {};
}
};
} }

View File

@ -8,7 +8,7 @@ Adw.AlertDialog clipboard_confirmation_window {
responses [ responses [
cancel: _("Deny") suggested, cancel: _("Deny") suggested,
ok: _("Allow") destructive ok: _("Allow") destructive,
] ]
default-response: "cancel"; default-response: "cancel";
@ -16,7 +16,7 @@ Adw.AlertDialog clipboard_confirmation_window {
extra-child: Overlay { extra-child: Overlay {
styles [ styles [
"osd" "osd",
] ]
ScrolledWindow text_view_scroll { ScrolledWindow text_view_scroll {
@ -33,7 +33,7 @@ Adw.AlertDialog clipboard_confirmation_window {
right-margin: 8; right-margin: 8;
styles [ styles [
"clipboard-content-view" "clipboard-content-view",
] ]
} }
} }
@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window {
margin-top: 12; margin-top: 12;
styles [ styles [
"opaque" "opaque",
] ]
Image { Image {

View File

@ -8,7 +8,7 @@ Adw.AlertDialog clipboard_confirmation_window {
responses [ responses [
cancel: _("Deny") suggested, cancel: _("Deny") suggested,
ok: _("Allow") destructive ok: _("Allow") destructive,
] ]
default-response: "cancel"; default-response: "cancel";
@ -16,7 +16,7 @@ Adw.AlertDialog clipboard_confirmation_window {
extra-child: Overlay { extra-child: Overlay {
styles [ styles [
"osd" "osd",
] ]
ScrolledWindow text_view_scroll { ScrolledWindow text_view_scroll {
@ -33,7 +33,7 @@ Adw.AlertDialog clipboard_confirmation_window {
right-margin: 8; right-margin: 8;
styles [ styles [
"clipboard-content-view" "clipboard-content-view",
] ]
} }
} }
@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window {
margin-top: 12; margin-top: 12;
styles [ styles [
"opaque" "opaque",
] ]
Image { Image {

View File

@ -8,7 +8,7 @@ Adw.AlertDialog clipboard_confirmation_window {
responses [ responses [
cancel: _("Cancel") suggested, cancel: _("Cancel") suggested,
ok: _("Paste") destructive ok: _("Paste") destructive,
] ]
default-response: "cancel"; default-response: "cancel";
@ -16,7 +16,7 @@ Adw.AlertDialog clipboard_confirmation_window {
extra-child: Overlay { extra-child: Overlay {
styles [ styles [
"osd" "osd",
] ]
ScrolledWindow text_view_scroll { ScrolledWindow text_view_scroll {
@ -33,7 +33,7 @@ Adw.AlertDialog clipboard_confirmation_window {
right-margin: 8; right-margin: 8;
styles [ styles [
"clipboard-content-view" "clipboard-content-view",
] ]
} }
} }
@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window {
margin-top: 12; margin-top: 12;
styles [ styles [
"opaque" "opaque",
] ]
Image { Image {

View File

@ -2,27 +2,27 @@ using Gtk 4.0;
using Adw 1; using Adw 1;
Adw.AlertDialog config_errors_dialog { Adw.AlertDialog config_errors_dialog {
heading: _("Configuration Errors"); heading: _("Configuration Errors");
body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors."); body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors.");
responses [ responses [
ignore: _("Ignore"), ignore: _("Ignore"),
reload: _("Reload Configuration") suggested, reload: _("Reload Configuration") suggested,
] ]
extra-child: ScrolledWindow { extra-child: ScrolledWindow {
min-content-width: 500; min-content-width: 500;
min-content-height: 100; min-content-height: 100;
TextView {
editable: false;
cursor-visible: false;
top-margin: 8;
bottom-margin: 8;
left-margin: 8;
right-margin: 8;
buffer: TextBuffer error_message { }; TextView {
} editable: false;
}; cursor-visible: false;
top-margin: 8;
bottom-margin: 8;
left-margin: 8;
right-margin: 8;
buffer: TextBuffer error_message {};
}
};
} }

View File

@ -7,7 +7,7 @@ Adw.AlertDialog prompt_title_dialog {
responses [ responses [
cancel: _("Cancel") suggested, cancel: _("Cancel") suggested,
ok: _("OK") destructive ok: _("OK") destructive,
] ]
focus-widget: title_entry; focus-widget: title_entry;