From 043175c3d55ac78e46e0a88855e99d5d10e914d6 Mon Sep 17 00:00:00 2001
From: Sander <hey@sandydoo.me>
Date: Fri, 3 Jan 2025 11:10:59 +0400
Subject: [PATCH] ci: split build and test scripts

---
 .github/workflows/build.yml | 25 +++++++++++++++++++++++++
 .github/workflows/test.yml  | 27 +++------------------------
 2 files changed, 28 insertions(+), 24 deletions(-)
 create mode 100644 .github/workflows/build.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..ef4dff4
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,25 @@
+name: "Build"
+
+on:
+  pull_request:
+  push:
+    branches:
+      - master
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: cachix/install-nix-action@v30
+      - run: nix profile install nixpkgs#devenv
+      - name: Build
+        run: devenv shell -- pnpm build
+      # Check that build was committed
+      - name: Verify latest build
+        run: git diff --exit-code
+
+  test:
+    needs: [build]
+    uses: ./test.yml
+    secrets: inherit
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 2809536..0ae1f2f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,28 +1,12 @@
-name: "cachix-action test"
-on:
-  pull_request:
-  push:
-    branches:
-      - master
+name: "Test"
+
+on: workflow_call
 
 env:
   ACTIONS_STEP_DEBUG: true
 
 jobs:
-  build:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4
-      - uses: cachix/install-nix-action@v30
-      - run: nix profile install nixpkgs#devenv
-      - name: Build
-        run: devenv shell -- pnpm build
-      # Check that build was committed
-      - name: Verify latest build
-        run: git diff --exit-code
-
   public-cache:
-    needs: [build]
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest]
@@ -40,7 +24,6 @@ jobs:
       - run: nix-build test.nix
 
   public-cache-no-signing-key:
-    needs: [build]
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest]
@@ -57,7 +40,6 @@ jobs:
       - run: nix-build test.nix
 
   private-cache:
-    needs: [build]
     if: ${{ github.ref == 'refs/heads/master' }}
     strategy:
       matrix:
@@ -77,7 +59,6 @@ jobs:
       - run: nix-build test.nix
 
   push-paths:
-    needs: [build]
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest]
@@ -97,7 +78,6 @@ jobs:
           pathsToPush: "${{ steps.paths.outputs.OUT_PATHS }}"
 
   installCommand:
-    needs: [build]
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest]
@@ -114,7 +94,6 @@ jobs:
       - run: nix-build test.nix
 
   nix-master:
-    needs: [build]
     strategy:
       matrix:
         include: