ci: unpin MoonBit in pages workflow to match CI toolchain
The Pages “Generate report data” step failed with “Unexpected key ‘pkgtype’ found in moon.pkg” because pages.yml pinned an older MoonBit (0.10.3) that predates the pkgtype key, while
moon fmt(current toolchain) rewrote options() -> pkgtype(). ci.yml already uses the unpinned latest and passed. Align pages.yml to hustcer/setup-moonbit@v1 so both workflows share one toolchain and the version skew can’t recur.Co-Authored-By: Claude Fable 5 noreply@anthropic.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
MoonBench(月衡)
MoonBench(月衡)是一个面向 MoonBit 开源生态的 benchmark 工具库,提供纳秒级计时、统计分析、性能回归对比、算法复杂度基准,以及一个开箱即用的静态 Web Dashboard。
核心能力
Duration/StopwatchSamples/StatsBenchmarkRunner() -> Unit工作负载,自动 warmup / measure / batch 执行CalibrationPolicyBenchmarkLifecycleComparison/RegressionRuleTrendReportBenchmarkArtifactalgo/算法复杂度基准(
algo/包)内置 17 个经典算法的 MoonBit 实现。
algo_benchmark_runner()将每个bench_*工作负载注册为可测量任务,run()使用 monotonic 后端在真实时钟下对每个算法 执行 warmup 5 次、测量 20 次(不是回放写死的耗时),输出含algo_meta的 JSON,Web UI 按类别分组展示彩色复杂度徽章。安装与接入
作为依赖加入你自己的 MoonBit 项目:
在需要使用的 包目录 的
moon.pkg(旧格式moon.pkg.json)里声明 import,并起一个别名:然后即可在代码里通过别名调用:
快速开始(本仓库)
本地预览 Web Dashboard:
使用示例
基础:Samples + BenchmarkSuite
Runner:注册真实工作负载
run()使用 monotonic backend 真实计时;测试场景可用MeasurementBackend::scripted注入确定性耗时。全链路:Runner + Gate + Artifact
性能回归闭环(CI 可失败)
cli/main.mbt演示了一个真实的回归 gate:先用 monotonic 后端测量 baseline 与 candidate,再按名字配对比较,超过预算就以非 0 退出码退出,从而让 CI 直接失败。项目结构
CI
GitHub Actions 三平台(Ubuntu / macOS / Windows)自动运行:
moon check --target allmoon test --target allmoon fmt+moon info工作区一致性检查(Ubuntu)moon run cli必须通过,moon run cli -- --demo-regression必须失败(Ubuntu)moon run webui输出的 17 个 case 每个都必须记录 20 个样本(Ubuntu)node --check webui/app.js静态语法检查(Ubuntu)许可证
Apache-2.0