XingLo SkillSearch

Playwright CI/CD 自动化

专门处理 Playwright 在 GitHub Actions、GitLab CI、Jenkins、Azure DevOps、CircleCI 和 Docker 中的运行,覆盖并行分片、重试、报告、制品、覆盖率及全局初始化,适合把本地测试稳定迁移到流水线。

在 AI 中使用此 Skill将本页链接复制给 AI,即可让 AI 获取完整 Skill 内容并按此执行
安全提示: 本站 Skill 均经 ChatGPT 最新模型扫描,未发现恶意脚本及危险指令、未检出已知恶意行为特征,但不保证绝对安全,使用即表示接受此风险

Skill 文件

版本 20260801 · d31f0dd9fe43b2426a57dd3485bd0670

SKILL.md
---
name: playwright-ci
description: Production-ready CI/CD configurations for Playwright — GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins, Docker, parallel sharding, reporting, code coverage, and global setup/teardown.
---

# Playwright CI/CD

> Ship reliable tests in every pipeline — CI-specific patterns for speed, stability, and actionable reports.

**9 guides** covering CI/CD setup, parallel execution, containerized runs, reporting, and infrastructure patterns for all major CI providers.

## Golden Rules

1. **`retries: 2` in CI only** — surface flakiness in pipelines, not locally
2. **`traces: 'on-first-retry'`** — capture rich debugging artifacts without slowing every run
3. **Shard across runners** — `--shard=N/M` splits tests evenly; scale horizontally, not vertically
4. **Cache browser binaries** — `~/.cache/ms-playwright` keyed on Playwright version
5. **Upload artifacts on failure** — traces, screenshots, and HTML reports as CI artifacts
6. **Use the official Docker image** — `mcr.microsoft.com/playwright:v*` has all OS deps pre-installed
7. **Global setup for auth** — run login once in `globalSetup`, reuse `storageState` across workers
8. **Fail fast, debug later** — keep CI runs short; use trace viewer and HTML reports to investigate

## Guide Index

### CI Providers

| Provider                          | Guide                                        |
| --------------------------------- | -------------------------------------------- |
| GitHub Actions                    | [ci-github-actions.md](ci-github-actions.md) |
| GitLab CI                         | [ci-gitlab.md](ci-gitlab.md)                 |
| CircleCI / Azure DevOps / Jenkins | [ci-other.md](ci-other.md)                   |

### Execution & Scaling

| Topic                         | Guide                                                        |
| ----------------------------- | ------------------------------------------------------------ |
| Parallel execution & sharding | [parallel-and-sharding.md](parallel-and-sharding.md)         |
| Docker & containers           | [docker-and-containers.md](docker-and-containers.md)         |
| Multi-project config          | [projects-and-dependencies.md](projects-and-dependencies.md) |

### Reporting & Setup

| Topic                 | Guide                                                    |
| --------------------- | -------------------------------------------------------- |
| Reports & artifacts   | [reporting-and-artifacts.md](reporting-and-artifacts.md) |
| Code coverage         | [test-coverage.md](test-coverage.md)                     |
| Global setup/teardown | [global-setup-teardown.md](global-setup-teardown.md)     |