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

View File

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

View File

@ -25,9 +25,9 @@ const oni = @import("oniguruma");
pub const regex = pub const regex =
"(?:" ++ url_schemes ++ "(?:" ++ url_schemes ++
\\)(?: \\)(?:
++ ipv6_url_pattern ++ ++ ipv6_url_pattern ++
\\|[\w\-.~:/?#@!$&*+,;=%]+(?:[\(\[]\w*[\)\]])?)+(?<![,.])|(?:\.\.\/|\.\/*|\/)[\w\-.~:\/?#@!$&*+,;=%]+(?:\/[\w\-.~:\/?#@!$&*+,;=%]*)* \\|[\w\-.~:/?#@!$&*+,;=%]+(?:[\(\[]\w*[\)\]])?)+(?<![,.])|(?:\.\.\/|\.\/*|\/)[\w\-.~:\/?#@!$&*+,;=%]+(?:\/[\w\-.~:\/?#@!$&*+,;=%]*)*
; ;
const url_schemes = const url_schemes =
\\https?://|mailto:|ftp://|file:|ssh:|git://|ssh://|tel:|magnet:|ipfs://|ipns://|gemini://|gopher://|news: \\https?://|mailto:|ftp://|file:|ssh:|git://|ssh://|tel:|magnet:|ipfs://|ipns://|gemini://|gopher://|news:
; ;