From 694664512cd37ad52fb7a010e2313a76c6402d29 Mon Sep 17 00:00:00 2001
From: Hongli Lai <hongli@phusion.nl>
Date: Sun, 6 Oct 2024 11:20:26 +0200
Subject: [PATCH] cache macOS CI

---
 .github/workflows/binaries.yml     | 20 +++++++++++++++-----
 dev/ci/fetch-cache-az-blob-storage |  1 +
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml
index 2d9e9e0f7a..4b1c096bd4 100644
--- a/.github/workflows/binaries.yml
+++ b/.github/workflows/binaries.yml
@@ -57,7 +57,7 @@ jobs:
         with:
           submodules: true
 
-      - run: mkdir cache runtime
+      - run: mkdir cache runtime output
         working-directory: packaging/binaries
 
       - name: Determine runtime version
@@ -82,7 +82,7 @@ jobs:
         run: xargs -I{} "$HOME/.rvm/bin/rvm" install ruby-{} < packaging/binaries/shared/definitions/ruby_versions
         if: steps.fetch_rvm_cache.outputs.cache-hit != 'true'
 
-      - name: Update runtime cache
+      - name: Update RVM cache
         run: CACHE_PATH="$HOME/.rvm" ./dev/ci/update-cache-az-blob-storage
         if: steps.fetch_rvm_cache.outputs.cache-hit != 'true'
         env:
@@ -112,9 +112,19 @@ jobs:
           CACHE_PATH: packaging/binaries/runtime
 
 
-      - run: ./dev/ci/tests/binaries/build-macos
+      - run: ./macos/build -p "$WORKSPACE" -r runtime -c cache -o output -j 4 passenger nginx
+        env:
+          WORKSPACE: ${{ github.workspace }}
+        working-directory: packaging/binaries
+
       - uses: actions/upload-artifact@v4
         with:
           name: binaries-macos-${{ matrix.arch }}
-          path: 'output-macos-${{ matrix.arch }}/**/*'
-      - run: ./dev/ci/tests/binaries/test-macos
+          path: 'output/**/*'
+
+
+      - run: ./macos/package -i output -o output
+        working-directory: packaging/binaries
+
+      - run: ./macos/test -p ../.. -r runtime -i output -I output
+        working-directory: packaging/binaries
diff --git a/dev/ci/fetch-cache-az-blob-storage b/dev/ci/fetch-cache-az-blob-storage
index 6eabe8d1af..6128645656 100755
--- a/dev/ci/fetch-cache-az-blob-storage
+++ b/dev/ci/fetch-cache-az-blob-storage
@@ -41,6 +41,7 @@ if [[ "$EXISTS" = True ]]; then
 	mkdir -p "$CACHE_PATH"
 	tar -C "$CACHE_PATH" -x --zstd -f "$CACHE_PATH.tar.zstd"
 	rm "$CACHE_PATH.tar.zstd"
+	echo "Extracted"
 
 	echo "cache-hit=true" >> "$GITHUB_OUTPUT"
 else