Skip to content

Commit dc84590

Browse files
committed
probe: 在真实 macOS arm64 上复现 brew install 报错(临时,合入前删除)
1 parent 92a2af5 commit dc84590

1 file changed

Lines changed: 112 additions & 0 deletions

File tree

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: tmp-brew-macos-probe
2+
3+
# TEMPORARY. Delete before merging.
4+
#
5+
# Reproduces "brew install mcpp errors on macOS" on a real arm64 macOS runner
6+
# and prints enough to identify WHICH step fails. Every brew invocation is
7+
# allowed to fail and is followed by a diagnostic dump, because a job that dies
8+
# on the first non-zero exit tells us the command failed and nothing else.
9+
10+
on:
11+
pull_request:
12+
workflow_dispatch:
13+
14+
jobs:
15+
brew-probe:
16+
name: brew install probe (macOS arm64)
17+
runs-on: macos-14
18+
timeout-minutes: 40
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Environment
23+
run: |
24+
echo "arch: $(uname -m)"
25+
echo "macOS: $(sw_vers -productVersion)"
26+
echo "brew: $(brew --version | head -1)"
27+
echo "brew prefix: $(brew --prefix)"
28+
echo "already installed mcpp? $(command -v mcpp || echo no)"
29+
30+
- name: Tap
31+
run: |
32+
set -x
33+
brew tap mcpp-community/mcpp
34+
brew tap-info mcpp-community/mcpp
35+
36+
# The formula as the tap publishes it. `brew info` first: it evaluates
37+
# the ruby WITHOUT downloading, so a formula-level error (bad DSL, a
38+
# requirement that cannot be satisfied on this runner) shows up here
39+
# rather than being confused with a download/extract failure below.
40+
- name: "brew info (evaluate formula only)"
41+
run: |
42+
set +e
43+
brew info mcpp-community/mcpp/mcpp-m 2>&1 | tee info.log
44+
echo "exit=$?"
45+
echo "── ruby source as tapped ──"
46+
cat "$(brew --repo mcpp-community/mcpp)/Formula/mcpp-m.rb"
47+
48+
- name: "brew install mcpp-m (verbose, failure tolerated)"
49+
id: install
50+
run: |
51+
set +e
52+
brew install --verbose mcpp-community/mcpp/mcpp-m 2>&1 | tee install.log
53+
rc=${PIPESTATUS[0]}
54+
echo "install_rc=$rc" >> "$GITHUB_OUTPUT"
55+
echo "=== install exit code: $rc ==="
56+
exit 0
57+
58+
- name: "Diagnose a failed install"
59+
if: ${{ steps.install.outputs.install_rc != '0' }}
60+
run: |
61+
echo "── last 60 lines ──"
62+
tail -60 install.log
63+
echo "── anything that looks like an error ──"
64+
grep -nEi 'error|fail|cannot|no such|denied|unable|invalid' install.log | tail -40 || true
65+
echo "── brew gist-logs (formula build logs) ──"
66+
ls -la ~/Library/Logs/Homebrew/mcpp-m/ 2>/dev/null || echo "(no formula log dir)"
67+
for f in ~/Library/Logs/Homebrew/mcpp-m/*; do
68+
echo "===== $f ====="; cat "$f"
69+
done 2>/dev/null || true
70+
71+
- name: "Post-install: does the launcher work?"
72+
if: ${{ steps.install.outputs.install_rc == '0' }}
73+
run: |
74+
set -x
75+
brew list mcpp-community/mcpp/mcpp-m
76+
which mcpp
77+
mcpp --version
78+
mcpp --help | head -5
79+
80+
# The alias path the formula's header comment promises. A user reading
81+
# the README types `mcpp`, not `mcpp-m`, so this is a separate claim.
82+
- name: "Alias: brew install …/mcpp resolves"
83+
run: |
84+
set +e
85+
brew info mcpp-community/mcpp/mcpp 2>&1 | tail -20
86+
echo "alias info exit=$?"
87+
88+
- name: "brew audit (formula hygiene)"
89+
run: |
90+
set +e
91+
brew audit --strict --online mcpp-community/mcpp/mcpp-m 2>&1 | tail -40
92+
echo "audit exit=$?"
93+
94+
- name: "brew test (the formula's own test block)"
95+
if: ${{ steps.install.outputs.install_rc == '0' }}
96+
run: |
97+
set +e
98+
brew test --verbose mcpp-community/mcpp/mcpp-m 2>&1 | tail -40
99+
echo "test exit=$?"
100+
101+
# The real usability question, beyond "the files landed": a brew-installed
102+
# mcpp must be able to bootstrap a toolchain and build something.
103+
- name: "Real use: mcpp new → run"
104+
if: ${{ steps.install.outputs.install_rc == '0' }}
105+
run: |
106+
set +e
107+
cd "$(mktemp -d)"
108+
mcpp new brewhello 2>&1 | tail -20
109+
echo "new exit=$?"
110+
cd brewhello || exit 0
111+
mcpp run 2>&1 | tail -40
112+
echo "run exit=$?"

0 commit comments

Comments
 (0)