Mitchell Hashimoto 68a9110d8e build: make glfw opt-in on all platforms, default to GTK on Linux
The GLFW build has grown farther and farther in feature parity with GTK
on Linux. And on macOS, the GLFW build has been unstable (crashes) for
months.

I still find the GLFW build useful for testing some core terminal work,
but it is increasingly user-hostile in case someone just downloads the
project and does a `zig build`.

I keep GLFW as up to date as I can, but the features that are missing
are due to fundamental limitations:

  - GLFW has no tabs, splits, etc. because it has no UI elements.
    I am not interested in painting UI widgets from scratch.

  - GLFW cannot support keyboard layouts robustly because it has no
    hooks to detect keyboard layouts or functions to get keymaps.

  - GLFW cannot support the Kitty keyboard protocol because the
    key/char API is too high level and it provides no low-level
    alternatives.

  - GLFW crashes on macOS under certain scenarios (this is my problem).
    I'm not interested in fixing it because the AppKit-based build
    is highly recommended.

To build or run the GLFW build you must now explicitly pass in
`-Dapp-runtime=glfw` to `zig build`.
2023-08-17 16:27:03 -07:00

104 lines
2.7 KiB
YAML

on: [push, pull_request]
name: Test
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
target: [
aarch64-macos,
x86_64-macos,
aarch64-linux-gnu,
x86_64-linux-gnu,
# No windows support currently.
# i386-windows,
# x86_64-windows-gnu,
]
runs-on: ${{ matrix.os }}
needs: test
env:
# Needed for macos SDK
AGREE: "true"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
# Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
# Cross-compile the binary. We always use static building for this
# because its the only way to access the headers.
- name: Test Build
run: nix develop -c zig build -Dstatic=true -Dapp-runtime=glfw -Dtarget=${{ matrix.target }}
build-macos:
runs-on: macos-12
needs: test
env:
# Needed for macos SDK
AGREE: "true"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
# Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
# GhosttyKit is the framework that is built from Zig for our native
# Mac app to access.
- name: Build GhosttyKit
run: nix develop -c zig build -Dstatic=true
# The native app is built with native XCode tooling. This also does
# codesigning. IMPORTANT: this must NOT run in a Nix environment.
# Nix breaks xcodebuild so this has to be run outside.
- name: Build Ghostty.app
run: cd macos && xcodebuild
test:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
# Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: test
run: nix develop -c zig build test
- name: Test GTK Build
run: nix develop -c zig build -Dapp-runtime=gtk
- name: Test GLFW Build
run: nix develop -c zig build -Dapp-runtime=glfw
- name: Test Dynamic Build
run: nix develop -c zig build -Dstatic=false
- name: Test Wasm Build
run: nix develop -c zig build wasm