From 270891eee182a48b8e2e1bc4dcf94a65790760f5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 19 Sep 2025 16:06:30 -0700 Subject: [PATCH] ci: add -Dsnap test --- .github/workflows/test.yml | 39 ++++++++++++++++++++++++++++++++++++-- snap/snapcraft.yaml | 2 +- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6c7093bc1..2099e1d42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,7 @@ jobs: - build-nix - build-macos - build-macos-matrix + - build-snap - build-windows - test - test-gtk @@ -118,7 +119,41 @@ jobs: run: | nix develop -c \ zig build \ - -Dflatpak=true + -Dflatpak + + build-snap: + strategy: + fail-fast: false + runs-on: namespace-profile-ghostty-sm + needs: test + env: + ZIG_LOCAL_CACHE_DIR: /zig/local-cache + ZIG_GLOBAL_CACHE_DIR: /zig/global-cache + steps: + - name: Checkout code + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Setup Cache + uses: namespacelabs/nscloud-cache-action@a289cf5d2fcd6874376aa92f0ef7f99dc923592a # v1.2.17 + with: + path: | + /nix + /zig + + # Install Nix and use that to run our tests so our environment matches exactly. + - uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 + with: + name: ghostty + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + + - name: Build with Snap + run: | + nix develop -c \ + zig build \ + -Dsnap build-linux: strategy: @@ -275,7 +310,7 @@ jobs: trigger-snap: if: github.event_name != 'pull_request' runs-on: namespace-profile-ghostty-xsm - needs: build-dist + needs: [build-dist, build-snap] steps: - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index c5a86ade7..e48fa93c8 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -80,7 +80,7 @@ parts: override-build: | craftctl set version=$(cat VERSION) $CRAFT_PART_SRC/../../zig/src/zig build \ - -Dsnap=true \ + -Dsnap \ -Dpatch-rpath=\$ORIGIN/../usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR \ -Doptimize=ReleaseFast \ -Dcpu=baseline \