From a995b6dbb0ea1f4a5faaa9f4a1b40172f5b03b89 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Fri, 22 Dec 2023 13:43:06 -0600 Subject: [PATCH 1/4] fix nix package and add ci test for nix package build --- .github/workflows/test.yml | 3 +++ nix/package.nix | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1d0ea907e..0fef0a803 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -138,6 +138,9 @@ jobs: - name: Test Dynamic Build run: nix develop -c zig build -Dstatic=false + - name: Test NixOS package build + run: nix build .#ghostty + prettier: runs-on: ubuntu-latest steps: diff --git a/nix/package.nix b/nix/package.nix index fccb0a143..2dc69543c 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -138,11 +138,17 @@ in else "$out/share/terminfo" } - mkdir -p $terminfo/share - cp -r "$terminfo_src" $terminfo/share/terminfo + mkdir -p "$out/nix-support" - mkdir -p $shell_integration - cp -r $out/share/shell-integration $shell_integration/shell-integration + mkdir -p "$terminfo/share" + mv "$terminfo_src" "$terminfo/share/terminfo" + ln -sf "$terminfo/share/terminfo" "$terminfo_src" + echo "$terminfo" >> "$out/nix-support/propagated-user-env-packages" + + mkdir -p "$shell_integration" + mv "$out/share/ghostty/shell-integration" "$shell_integration/shell-integration" + ln -sf "$shell_integration/shell-integration" "$out/share/ghostty/shell-integration" + echo "$shell_integration" >> "$out/nix-support/propagated-user-env-packages" ''; meta = with lib; { From d8e1aebfcda75f5815ea8f7ff6858cc615db7771 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Fri, 22 Dec 2023 14:28:27 -0600 Subject: [PATCH 2/4] enable magic nix cache to improve build times --- .github/workflows/nix.yml | 5 +++++ .github/workflows/release-tip.yml | 6 ++++++ .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 804f16bf0..cbc764baa 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -10,6 +10,11 @@ jobs: uses: cachix/install-nix-action@v24 with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry - name: Check Zig cache hash run: nix develop -c ./nix/build-support/check-zig-cache-hash.sh # diff --git a/.github/workflows/release-tip.yml b/.github/workflows/release-tip.yml index 590fd8a5a..23bc2431d 100644 --- a/.github/workflows/release-tip.yml +++ b/.github/workflows/release-tip.yml @@ -48,6 +48,12 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + # Setup Sparkle - name: Setup Sparkle env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0fef0a803..b981d0a36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,12 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + # Cross-compile the binary. We always use static building for this # because its the only way to access the headers. - name: Test Build @@ -51,6 +57,12 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + # GhosttyKit is the framework that is built from Zig for our native # Mac app to access. - name: Build GhosttyKit @@ -126,6 +138,12 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + - name: test run: nix develop -c zig build -Dapp-runtime=none test @@ -148,6 +166,11 @@ jobs: - uses: cachix/install-nix-action@v24 with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry - name: prettier check run: nix develop -c prettier --check . @@ -158,5 +181,10 @@ jobs: - uses: cachix/install-nix-action@v24 with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry - name: alejandra check run: nix develop -c alejandra --check . From 18ada8d1184c333e8eb760c3c5fdd1ed1d7d1f3a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 22 Dec 2023 14:20:27 -0800 Subject: [PATCH 3/4] ci: move nix build to dedicated job --- .github/workflows/test.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b981d0a36..e5eb220b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,29 @@ jobs: - name: Test Build run: nix develop -c zig build -Dstatic=true -Dapp-runtime=glfw -Dtarget=${{ matrix.target }} + build-nix: + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # Install Nix and use that to run our tests so our environment matches exactly. + - uses: cachix/install-nix-action@v24 + with: + nix_path: nixpkgs=channel:nixos-unstable + + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + + - name: Test NixOS package build + run: nix build .#ghostty + build-macos: runs-on: ghcr.io/cirruslabs/macos-ventura-xcode:latest needs: test @@ -73,6 +96,7 @@ jobs: # Nix breaks xcodebuild so this has to be run outside. - name: Build Ghostty.app run: cd macos && xcodebuild + build-windows: runs-on: windows-2019 # this will not stop other jobs from running @@ -156,9 +180,6 @@ jobs: - name: Test Dynamic Build run: nix develop -c zig build -Dstatic=false - - name: Test NixOS package build - run: nix build .#ghostty - prettier: runs-on: ubuntu-latest steps: From 98abf0d186f4575f99921d18ed75fa18fff7c6f6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 22 Dec 2023 14:29:37 -0800 Subject: [PATCH 4/4] ci: build-nix depends on test like other package builds --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e5eb220b1..700e73c16 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,6 +47,7 @@ jobs: matrix: os: [ubuntu-latest] runs-on: ${{ matrix.os }} + needs: test steps: - name: Checkout code uses: actions/checkout@v4