ci
ما الذي تفعله
تُعد هذه المهارة اختبارات Go المكتوبة بـ Ginkgo لتعمل بموثوقية في عمليات البناء الآلية. وهي مناسبة للمطورين الذين يريدون أن يلتقط التكامل المستمر الأخطاء ويعرض النتائج بوضوح.
متى تستخدمها
- ✓عندما تعد اختبارات Ginkgo في خط أنابيب التكامل المستمر.
- ✓عندما ينجح تشغيل Ginkgo على حاسوبك لكنه يتصرف بشكل مختلف في CI.
- ✓عندما تريد تقارير اختبار يمكن للآلة قراءتها من التشغيلات الآلية.
رابط المهارة
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/ci/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“اضبط اختبارات Go بـ Ginkgo لتعمل في CI بالخيارات الموصى بها، مع تقرير JSON.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يشغّل وكيلك أداة Ginkgo عبر go run حتى تتطابق نسختها مع مشروعك، ويضيف خيارات للترتيب العشوائي والتشغيل المتوازي، وللفشل عند بقاء علامات معلّقة أو تركيز، وتقرير JSON.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Ginkgo in CI
A CI invocation should maximize signal — surface flakes and spec pollution, catch mistakes that pass locally, and emit machine-readable artifacts — while collecting every failure in one run. This builds on the CLI (ginkgo:running) and report formats (ginkgo:reporting). Full rationale: https://onsi.github.io/ginkgo/#recommended-continuous-integration-configuration.
The recommended flag set
Invoke via go run so the CLI version always tracks the github.com/onsi/ginkgo/v2 in your go.mod — no separately-installed binary to drift (→ ginkgo:setup).
go run github.com/onsi/ginkgo/v2/ginkgo \
-r -p --randomize-all --randomize-suites \
--fail-on-pending --fail-on-empty --keep-going \
--cover --coverprofile=cover.profile --race --trace \
--json-report=report.json --output-dir=.ginkgo-report \
--timeout=TIMEOUT --poll-progress-after=Xs --poll-progress-interval=Ys
| Flag | Why |
|---|---|
-r |
recursively find and run every suite |
-p |
run each suite in parallel (→ ginkgo:parallelism; set --procs=N/--compilers=N if CPU detection is wrong) |
--randomize-all / --randomize-suites |
shuffle all specs and the suite order to surface spec pollution (→ ginkgo:running) |
--fail-on-pending |
fail if any Pending specs were committed |
--fail-on-empty |
fail if no specs ran (usually a malformed filter) |
--keep-going |
don't stop at the first failed suite — collect all failures |
--cover --coverprofile=cover.profile |
compute coverage into one merged profile (→ ginkgo:reporting) |
--race |
run with the race detector (costs a fixed ~1s per suite — see below) |
--trace |
full stack traces on failure (worth it without a local feedback loop) |
--json-report=report.json |
structured results for diagnosis and downstream tools (→ ginkgo:debugging-failures) |
--timeout=TIMEOUT |
cap the whole run (default 1h — often not enough) |
--poll-progress-after/--poll-progress-interval |
emit progress reports for stuck specs (→ ginkgo:timeouts-and-async) |
The exit-code safeguards — CI's real value
Three flags turn "looks green" into "is actually trustworthy." They make CI fail on mistakes that pass silently on a developer's machine:
--fail-on-pending— a committedPending/PIt/XItbecomes a CI failure, so dev-time placeholders can't rot into the suite.--fail-on-empty— a typo'd--label-filter(or an over-aggressive--skip) that selects zero specs fails instead of falsely passing.- Committed programmatic focus already fails CI for free. A passing suite that contains
FIt/FDescribe/Focusexits non-zero — Ginkgo's built-in guard against shipping focus. Don't suppress it; fix it withginkgo unfocus(→ginkgo:filtering).
Collecting artifacts
Point reports and profiles at one directory and upload it as a build artifact:
--output-dir=.ginkgo-reportcollects the JSON report (and, under-r, merges all suites into onereport.json) plus coverage/profiles into one place. →ginkgo:reportingfor--keep-separate-reportsand the other formats.--junit-report=junit.xmladditionally if your CI system renders JUnit — but keep--json-reportas the source of truth; JUnit loses Ginkgo metadata.- An agent or human then diagnoses failures straight from
report.jsonwithjq→ginkgo:debugging-failures.
CI-friendly console output
--github-output— formats the console log for GitHub Actions readability (grouped, annotated).--force-newlines— flush output line-by-line for CI systems that only flush on newline.--no-color(orGINKGO_NO_COLOR=TRUE) — drop ANSI codes from logs that don't render them.
The race detector's fixed per-suite cost
--race adds about a second to every suite, no matter how few specs it has. ThreadSanitizer sleeps for one second at process exit (atexit_sleep_ms, its default) so that races reported by goroutines still running at exit aren't lost, and Ginkgo has to wait for the processes it spawned. Under -r -p that lands in the gap between suites, where it looks exactly like compilation.
The tell is that it's flat across package size — a 2-spec package pays the same as a 2000-spec package. A build cost can't behave that way; a per-process cost must. If you're auditing a slow race-enabled run, measure with precompiled binaries (ginkgo build -r) so compilation is excluded by construction rather than by
الأسئلة الشائعة
لماذا نشغّل Ginkgo عبر go run؟
لأنه يُبقي نسخة أداة Ginkgo متوافقة مع ما هو في ملف go.mod، فلا يوجد تثبيت منفصل قد ينحرف.
ماذا تلتقط فحوص الأمان؟
علامات التركيز أو التعليق المرفوعة إلى المستودع، والمرشحات التي لا تطابق أي اختبار، وقد تخفي الفشل.
لماذا نرتب الاختبارات عشوائياً؟
يساعد الترتيب العشوائي على كشف الاختبارات التي تعتمد على بعضها دون قصد.
التفاصيل
الوصف الأصلي من المؤلف
Configure Ginkgo for continuous integration — the recommended CLI flag set and the rationale for each flag (-r -p --randomize-all --randomize-suites --fail-on-pending --fail-on-empty --keep-going --cover --race --trace --json-report --timeout --poll-progress-after/-interval), invoking via go run to pin the CLI to go.mod, the exit-code safeguards that catch committed Focus/Pending and empty filters, collecting report and coverage artifacts with --output-dir, CI-friendly output (--github-output/--force-newlines/--no-color), and the fixed per-suite cost --race adds (GORACE=atexit_sleep_ms=0). Use
repo: onsi/ginkgo
الشعبية
- نجوم GitHub
- 9.1k
- الترتيب
- #12298
- الترخيص
- MIT
- آخر تحديث
- 9/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
debugging-failures
9.1kيساعد وكيلك على معرفة سبب فشل اختبارات Ginkgo، بقراءة سطر النتيجة وسحب الاختبارات الفاشلة ورسائلها بدقة من تقرير JSON.
decorators
9.1kيساعد وكيلك على استخدام مزخرفات اختبارات Ginkgo بشكل صحيح، مثل Serial وOrdered وLabel وFocus والمهلات الزمنية، بشرح وظيفة كل واحدة.
filtering
9.1kيساعد وكيلك على تشغيل جزء فقط من اختبارات Ginkgo، باستخدام التعليق والتخطي والتركيز والتسميات والفلاتر بالترتيب الصحيح.
ordering-and-flakes
9.1kيساعد وكيلك على التحكم في ترتيب اختبارات Go والتعامل مع الاختبارات غير المستقرة، باستخدام إعدادات Serial وOrdered في Ginkgo وخيارات إعادة المحاولة.
مهارات مشابهة
test-driven-development
311kيعلّم وكيلك كتابة اختبار فاشل أولًا، ثم رؤيته يفشل، ثم كتابة أصغر شيفرة تنجحه، قبل بناء أي ميزة أو إصلاح.
verification-before-completion
311kيعلّم وكيلك تشغيل فحوصات حقيقية وقراءة نتائجها قبل أن يقول إن المهمة أو الإصلاح أو البناء مكتمل أو ناجح.
migrate-to-shoehorn
310kيستبدل تأكيدات النوع الخطرة في ملفات الاختبار بمكتبة shoehorn، حتى تتمكن الاختبارات من استخدام بيانات جزئية وتجتاز فحوص الأنواع.