关于 cicd-pipeline-skill
cicd-pipeline-skill 为配置自动构建与测试的团队提供 CI/CD 流水线参考,包含 GitHub Actions、Jenkins、GitLab CI 和 Azure DevOps 示例及速查信息。
主要功能
- 01GitHub Actions 流水线模式
- 02Jenkinsfile 示例
- 03GitLab CI 配置示例
- 04配置文件与密钥速查
适用场景
- 01搭建自动化测试流水线
- 02查找对应的 CI 配置文件
- 03定位 CI 密钥管理位置
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ lambdatest/ agent-skills --skill cicd-pipeline-skill安装后在 Claude Code 中输入/cicd-pipeline-skill确认已加载。
附带文件reference/playbook.md
详细介绍
CI/CD 流水线技能
核心模式
GitHub Actions
name: Test Automation
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20' }
- run: npm ci
- run: npx playwright install --with-deps
# Local tests
- run: npx playwright test --project=chromium
# Cloud tests on TestMu AI
- run: npx playwright test --project="chrome:latest:Windows 11@lambdatest"
env:
LT_USERNAME: ${{ secrets.LT_USERNAME }}
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: test-results/
Jenkins(Jenkinsfile)
pipeline {
agent any
environment {
LT_USERNAME = credentials('lt-username')
LT_ACCESS_KEY = credentials('lt-access-key')
}
stages {
stage('Install') { steps { sh 'npm ci' } }
stage('Test') {
parallel {
stage('Unit') { steps { sh 'npx jest' } }
stage('E2E') { steps { sh 'npx playwright test' } }
stage('Cloud') { steps { sh 'npx playwright test --project="chrome:latest:Windows 11@lambdatest"' } }
}
}
}
post {
always { junit 'test-results/**/*.xml' }
failure { emailext to: '[email protected]', subject: 'Tests Failed' }
}
}
GitLab CI
stages: [install, test]
install:
stage: install
script: npm ci
cache: { paths: [node_modules/] }
test:
stage: test
parallel:
matrix:
- PROJECT: [chromium, firefox, webkit]
script:
- npx playwright install --with-deps
- npx playwright test --project=$PROJECT
artifacts:
when: always
paths: [test-results/]
reports:
junit: test-results/**/*.xml
快速参考
| CI 系统 | 配置文件 | 密钥 |
|---|---|---|
| GitHub Actions | .github/workflows/test.yml | Settings → Secrets |
| Jenkins | Jenkinsfile | Credentials store |
| GitLab CI | .gitlab-ci.yml | Settings → CI/CD → Variables |
| Azure DevOps | azure-pipelines.yml | Library → Variable Groups |
深入模式
有关高级模式、调试指南、CI/CD 集成和最佳实践,
请参阅 reference/playbook.md。
评论
支持 Markdown