1717 workflow_dispatch :
1818
1919jobs :
20+ # Fast smoke tests that run before expensive operations
21+ smoke-test :
22+ name : Quick Formula Validation
23+ runs-on : ubuntu-latest # Use Linux for speed (Homebrew works on Linux too)
24+
25+ steps :
26+ - name : Checkout repository
27+ uses : actions/checkout@v4
28+
29+ - name : Set up Homebrew
30+ uses : Homebrew/actions/setup-homebrew@master
31+
32+ - name : Validate formula syntax with brew style
33+ run : |
34+ echo "Checking formula syntax..."
35+ brew style packaging/homebrew/mfc.rb
36+
37+ - name : Run brew audit (without installation)
38+ run : |
39+ echo "Creating temporary local tap..."
40+ brew tap-new mflowcode/test
41+ cp packaging/homebrew/mfc.rb $(brew --repository)/Library/Taps/mflowcode/homebrew-test/Formula/mfc.rb
42+
43+ echo "Running brew audit (online checks)..."
44+ brew audit --online --skip-style mflowcode/test/mfc || true
45+
46+ echo "Cleaning up tap..."
47+ brew untap mflowcode/test
48+
49+ - name : Validate Ruby syntax
50+ run : |
51+ echo "Checking Ruby syntax..."
52+ ruby -c packaging/homebrew/mfc.rb
53+
54+ - name : Check for common formula issues
55+ run : |
56+ echo "Checking for common issues..."
57+
58+ # Check that required fields are present
59+ grep -q 'desc "' packaging/homebrew/mfc.rb || (echo "❌ Missing desc"; exit 1)
60+ grep -q 'homepage "' packaging/homebrew/mfc.rb || (echo "❌ Missing homepage"; exit 1)
61+ grep -q 'url "' packaging/homebrew/mfc.rb || (echo "❌ Missing url"; exit 1)
62+ grep -q 'sha256 "' packaging/homebrew/mfc.rb || (echo "❌ Missing sha256"; exit 1)
63+ grep -q 'license "' packaging/homebrew/mfc.rb || (echo "❌ Missing license"; exit 1)
64+
65+ # Check that install method exists
66+ grep -q 'def install' packaging/homebrew/mfc.rb || (echo "❌ Missing install method"; exit 1)
67+
68+ # Check that test block exists
69+ grep -q 'test do' packaging/homebrew/mfc.rb || (echo "❌ Missing test block"; exit 1)
70+
71+ echo "✅ All required formula components present"
72+
73+ - name : Verify URL is reachable
74+ run : |
75+ echo "Checking that source URL is reachable..."
76+ URL=$(grep -E 'url "https://[^"]+' packaging/homebrew/mfc.rb | head -1 | sed 's/.*url "\([^"]*\)".*/\1/')
77+
78+ if [ -z "$URL" ]; then
79+ echo "❌ Could not extract URL from formula"
80+ exit 1
81+ fi
82+
83+ echo "URL: $URL"
84+ HTTP_CODE=$(curl -sI -w "%{http_code}" -o /dev/null "$URL")
85+
86+ if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ]; then
87+ echo "✅ URL is reachable (HTTP $HTTP_CODE)"
88+ else
89+ echo "⚠️ URL returned HTTP $HTTP_CODE (may indicate an issue)"
90+ # Don't fail here - could be a temporary issue
91+ fi
92+
93+ - name : Verify SHA256 checksum
94+ run : |
95+ echo "Verifying SHA256 checksum matches URL..."
96+ URL=$(grep -E 'url "https://[^"]+' packaging/homebrew/mfc.rb | head -1 | sed 's/.*url "\([^"]*\)".*/\1/')
97+ EXPECTED_SHA=$(grep 'sha256 "' packaging/homebrew/mfc.rb | head -1 | sed 's/.*sha256 "\([^"]*\)".*/\1/')
98+
99+ if [ -z "$URL" ] || [ -z "$EXPECTED_SHA" ]; then
100+ echo "❌ Could not extract URL or SHA256 from formula"
101+ exit 1
102+ fi
103+
104+ echo "Downloading tarball to compute checksum..."
105+ ACTUAL_SHA=$(curl -sL "$URL" | shasum -a 256 | awk '{print $1}')
106+
107+ echo "Expected SHA256: $EXPECTED_SHA"
108+ echo "Actual SHA256: $ACTUAL_SHA"
109+
110+ if [ "$EXPECTED_SHA" = "$ACTUAL_SHA" ]; then
111+ echo "✅ SHA256 checksum matches!"
112+ else
113+ echo "❌ SHA256 mismatch!"
114+ exit 1
115+ fi
116+
117+ # Full installation test (only runs if smoke tests pass)
20118 test-formula :
21- name : Test Homebrew Formula
119+ name : Full Installation Test
120+ needs : smoke-test # Only run after smoke tests pass
22121 runs-on : macos-latest
23122
24123 steps :
@@ -37,11 +136,6 @@ jobs:
37136 echo "Installing MFC dependencies..."
38137 brew install cmake gcc [email protected] boost fftw hdf5 open-mpi openblas 39138
40- - name : Validate formula syntax
41- run : |
42- echo "Checking formula syntax..."
43- brew style packaging/homebrew/mfc.rb
44-
45139 - name : Install MFC from formula
46140 run : |
47141 echo "Creating temporary local tap..."
@@ -164,4 +258,3 @@ jobs:
164258 echo "Cleaning up..."
165259 brew uninstall mfc || true
166260 brew cleanup
167-
0 commit comments