Skip to content

Commit a349d71

Browse files
authored
chore: fail-fast CI hangs + refresh README header (#75)
* chore: fail-fast CI hangs + refresh README header Recent main runs (notably the v0.0.28 bump) burned the full 60-min job budget on `10_env_command.sh` hanging in xlings install on a fresh MCPP_HOME. The hang is intermittent and lives at the network boundary; no fix to xlings itself in this PR — just shorten the feedback loop. CI: - tests/e2e/run_all.sh wraps every test with `timeout 600` (override via E2E_TEST_TIMEOUT). Distinguishes TIMEOUT (exit 124) from regular FAIL and surfaces the offending test name in the summary. Uses `timeout` if available, falls back to `gtimeout` (macOS coreutils), else skips wrapping and relies on the step-level guard. - ci.yml / ci-macos.yml / ci-windows.yml: add `timeout-minutes: 25` to each "E2E suite" step. A hung suite now fails in ~25 min instead of eating the full 60-min job, freeing the toolchain test steps to still run / be diagnosed. README: - Add a prominent links table directly under the badges: docs / quick start / mcpp.toml guide / examples / toolchains on row 1; package index, mcpplibs, forum, Issues, Releases on row 2. - Add live CI status badges for Linux/macOS/Windows; drop the static "Self-hosted" badge that the CI badges now subsume. - Promote Windows x86_64 LLVM/Clang from 🔄 to ✅ (CI is green since v0.0.27); add footnote noting the MSVC BuildTools dependency and the llvm-mingw direction. * chore: rename ci.yml → ci-linux.yml; move CI status into README table - Workflow renamed (and `name:` updated) to match the platform-prefixed ci-macos / ci-windows convention. Comment cross-references updated. - README: drop the 3 CI badges from the badges row and add them as the table's last row alongside the docs / community links — keeps the badges row focused on project metadata (release / language / license).
1 parent 73ffe30 commit a349d71

5 files changed

Lines changed: 67 additions & 12 deletions

File tree

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: ci
1+
name: ci-linux
22

3-
# Self-host CI: mcpp builds mcpp. The bootstrap mcpp comes from
4-
# `xlings install mcpp` (xim:mcpp in the xlings package index), so
5-
# this workflow no longer depends on a previous-release tarball — the
3+
# Self-host CI on Linux: mcpp builds mcpp. The bootstrap mcpp comes from
4+
# `xlings install mcpp` (xim:mcpp in the xlings package index), so this
5+
# workflow no longer depends on a previous-release tarball — the
66
# chicken-and-egg now lives upstream in the xlings index.
7+
#
8+
# Paired workflows: ci-macos.yml, ci-windows.yml.
79

810
on:
911
push:
@@ -104,6 +106,12 @@ jobs:
104106
"$MCPP_FRESH" test
105107
106108
- name: E2E suite
109+
# Step-level guard: a single hung test (historically 10_env_command.sh
110+
# on slow xlings/network) used to eat the full 60-min job budget.
111+
# Cap the suite at 25 min so a hang fails fast and we still have room
112+
# for the downstream toolchain steps. Per-test 600s timeout lives in
113+
# tests/e2e/run_all.sh and identifies WHICH test hung.
114+
timeout-minutes: 25
107115
run: |
108116
# Point the e2e runner at the freshly-built binary, not the
109117
# bootstrap one. Tests cd into mktemp -d, so $MCPP must be

.github/workflows/ci-macos.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ jobs:
292292
"$MCPP" test
293293
294294
- name: E2E suite
295+
# See ci-linux.yml — fail-fast on hung tests instead of burning the
296+
# whole job budget. Per-test 600s timeout lives in run_all.sh.
297+
timeout-minutes: 25
295298
run: |
296299
MCPP=$(find target -path "*/bin/mcpp" | head -1)
297300
MCPP=$(cd "$(dirname "$MCPP")" && pwd)/$(basename "$MCPP")

.github/workflows/ci-windows.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: ci-windows
22

3-
# Windows CI for mcpp — same flow as Linux (ci.yml) and macOS (ci-macos.yml):
3+
# Windows CI for mcpp — same flow as Linux (ci-linux.yml) and macOS (ci-macos.yml):
44
# xlings install mcpp → self-host build → E2E → smoke → package
55

66
on:
@@ -178,6 +178,9 @@ jobs:
178178
179179
- name: E2E suite
180180
shell: bash
181+
# See ci-linux.yml — fail-fast on hung tests instead of burning the
182+
# whole job budget. Per-test 600s timeout lives in run_all.sh.
183+
timeout-minutes: 25
181184
run: |
182185
export MCPP="$MCPP_SELF"
183186
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
55
[![Release](https://img.shields.io/github/v/release/mcpp-community/mcpp)](https://github.com/mcpp-community/mcpp/releases)
66
[![C++23](https://img.shields.io/badge/C%2B%2B-23-blue.svg)](https://en.cppreference.com/w/cpp/23)
7-
[![Self-hosted](https://img.shields.io/badge/build-self--hosted-brightgreen)]()
87
[![Module](https://img.shields.io/badge/module-ok-green.svg)](https://en.cppreference.com/w/cpp/language/modules)
98
[![License](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](LICENSE)
109

10+
| [文档](docs/) · [快速开始](docs/00-getting-started.md) · [mcpp.toml 指南](docs/05-mcpp-toml.md) · [示例项目](docs/01-examples.md) · [工具链管理](docs/03-toolchains.md) |
11+
|:---:|
12+
| [包索引 mcpp-index](https://github.com/mcpp-community/mcpp-index) · [模块化库 mcpplibs](https://github.com/mcpplibs) · [社区论坛](https://forum.d2learn.org/category/20) · [Issues](https://github.com/mcpp-community/mcpp/issues) · [Releases](https://github.com/mcpp-community/mcpp/releases) |
13+
| [![ci-linux](https://github.com/mcpp-community/mcpp/actions/workflows/ci-linux.yml/badge.svg?branch=main)](https://github.com/mcpp-community/mcpp/actions/workflows/ci-linux.yml) [![ci-macos](https://github.com/mcpp-community/mcpp/actions/workflows/ci-macos.yml/badge.svg?branch=main)](https://github.com/mcpp-community/mcpp/actions/workflows/ci-macos.yml) [![ci-windows](https://github.com/mcpp-community/mcpp/actions/workflows/ci-windows.yml/badge.svg?branch=main)](https://github.com/mcpp-community/mcpp/actions/workflows/ci-windows.yml) |
14+
1115
<p align="center">
1216
<img src="https://github.com/user-attachments/assets/6c85896e-9a37-4f62-acfb-d37a4eae2363" alt="mcpp demo" width="720">
1317
</p>
@@ -209,12 +213,16 @@ import mcpplibs.cmdline;
209213
| Linux aarch64 | 🔄 | 🔄 | 🔄 ||
210214
| macOS arm64 |||*默认* ||
211215
| macOS x86_64 ||| 🔄 ||
212-
| Windows ||| 🔄 | 🔄 |
216+
| Windows x86_64 ||| ✅ ¹ *默认* | 🔄 |
213217

214218
✅ 已支持 | 🔄 计划中
215219

216220
> *默认*:Linux 默认工具链为 musl-gcc,release 二进制走 musl 全静态;
217-
> macOS ARM64 默认工具链为 LLVM/Clang。
221+
> macOS ARM64 / Windows x86_64 默认工具链均为 LLVM/Clang。
222+
>
223+
> ¹ Windows 上 Clang/LLVM 当前依赖系统已安装 **MSVC BuildTools 或 Visual Studio**
224+
> (提供 UCRT、Windows SDK、MSVC STL)。零-MSVC 依赖的 `llvm-mingw` 路线在规划中
225+
> ([讨论](https://github.com/mcpp-community/mcpp/issues))。
218226
219227
## 文档
220228

tests/e2e/run_all.sh

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,28 @@ check_requires() {
123123
return 1 # all satisfied → don't skip
124124
}
125125

126+
# Per-test timeout: bail out of an individual test that gets stuck (e.g.
127+
# 10_env_command.sh has been observed hanging for the full job budget on
128+
# slow xlings/network combinations). 600s default; override via env.
129+
# Linux + git-bash on Windows have GNU `timeout`; macOS may need `gtimeout`
130+
# (coreutils). If neither is present, we run without a wrapper and rely on
131+
# the step-level GitHub Actions timeout-minutes as the backstop.
132+
E2E_TEST_TIMEOUT="${E2E_TEST_TIMEOUT:-600}"
133+
TIMEOUT_CMD=""
134+
if command -v timeout &>/dev/null; then TIMEOUT_CMD=timeout
135+
elif command -v gtimeout &>/dev/null; then TIMEOUT_CMD=gtimeout
136+
fi
137+
if [[ -n "$TIMEOUT_CMD" ]]; then
138+
echo "Per-test timeout: ${E2E_TEST_TIMEOUT}s (via $TIMEOUT_CMD)"
139+
else
140+
echo "Per-test timeout: <unavailable> (no timeout/gtimeout on PATH)"
141+
fi
142+
126143
PASS=0
127144
FAIL=0
128145
SKIP=0
129146
FAILED_TESTS=()
147+
TIMED_OUT_TESTS=()
130148

131149
for test in "$HERE"/[0-9]*.sh; do
132150
name="$(basename "$test")"
@@ -138,21 +156,36 @@ for test in "$HERE"/[0-9]*.sh; do
138156
continue
139157
fi
140158
echo "=== $name ==="
141-
if MCPP="$MCPP" bash "$test"; then
159+
if [[ -n "$TIMEOUT_CMD" ]]; then
160+
MCPP="$MCPP" "$TIMEOUT_CMD" "$E2E_TEST_TIMEOUT" bash "$test"
161+
else
162+
MCPP="$MCPP" bash "$test"
163+
fi
164+
rc=$?
165+
if [[ $rc -eq 0 ]]; then
142166
echo "PASS: $name"
143167
((PASS++))
168+
elif [[ $rc -eq 124 ]]; then
169+
# GNU timeout: 124 = killed after deadline (TERM); 137 = SIGKILL after grace.
170+
echo "TIMEOUT: $name (exceeded ${E2E_TEST_TIMEOUT}s — likely network / xlings stall)"
171+
((FAIL++))
172+
FAILED_TESTS+=("$name (TIMEOUT)")
173+
TIMED_OUT_TESTS+=("$name")
144174
else
145-
echo "FAIL: $name"
175+
echo "FAIL: $name (exit $rc)"
146176
((FAIL++))
147-
FAILED_TESTS+=("$name")
177+
FAILED_TESTS+=("$name (exit $rc)")
148178
fi
149179
done
150180

151181
echo
152182
echo "==============================================="
153183
echo "E2E Summary: $PASS passed, $FAIL failed, $SKIP skipped"
184+
if [[ ${#TIMED_OUT_TESTS[@]} -gt 0 ]]; then
185+
echo "Timed out: ${TIMED_OUT_TESTS[*]}"
186+
fi
154187
if [[ $FAIL -gt 0 ]]; then
155-
echo "Failed: ${FAILED_TESTS[@]}"
188+
echo "Failed: ${FAILED_TESTS[*]}"
156189
exit 1
157190
fi
158191
exit 0

0 commit comments

Comments
 (0)