ci: zig fmt check

This adds a CI test to ensure that all Zig files are properly formatted.
This avoids unrelated diff noise in future PRs.
This commit is contained in:
Mitchell Hashimoto
2025-03-18 13:51:39 -07:00
parent c0f5f913c9
commit 4d0bf303c6
10 changed files with 84 additions and 65 deletions

View File

@ -8,7 +8,7 @@ name: Test
jobs:
required:
name: "Required Checks: Test"
runs-on: namespace-profile-ghostty-sm
runs-on: namespace-profile-ghostty-xsm
needs:
- build-bench
- build-dist
@ -31,6 +31,7 @@ jobs:
- translations
- test-pkg-linux
- test-debian-12
- zig-fmt
steps:
- id: status
name: Determine status
@ -612,9 +613,36 @@ jobs:
- name: test
run: nix develop -c zig build test --system ${{ steps.deps.outputs.deps }}
zig-fmt:
if: github.repository == 'ghostty-org/ghostty'
runs-on: namespace-profile-ghostty-xsm
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: zig fmt
run: nix develop -c zig fmt --check .
prettier:
if: github.repository == 'ghostty-org/ghostty'
runs-on: namespace-profile-ghostty-sm
runs-on: namespace-profile-ghostty-xsm
timeout-minutes: 60
env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
@ -641,7 +669,7 @@ jobs:
alejandra:
if: github.repository == 'ghostty-org/ghostty'
runs-on: namespace-profile-ghostty-sm
runs-on: namespace-profile-ghostty-xsm
timeout-minutes: 60
env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
@ -668,7 +696,7 @@ jobs:
typos:
if: github.repository == 'ghostty-org/ghostty'
runs-on: namespace-profile-ghostty-sm
runs-on: namespace-profile-ghostty-xsm
timeout-minutes: 60
env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache

View File

@ -173,15 +173,6 @@ pub const Binding = struct {
width: c.GLsizei,
height: c.GLsizei,
) !void {
glad.context.CopyTexSubImage2D.?(
@intFromEnum(b.target),
level,
xoffset,
yoffset,
x,
y,
width,
height
);
glad.context.CopyTexSubImage2D.?(@intFromEnum(b.target), level, xoffset, yoffset, x, y, width, height);
}
};