github-ci-automation
Structured workflow for designing and maintaining GitHub Actions continuous integration for HypermediaEngine. Covers workflow file structure, push/pull_request triggers, build matrix, caching, dotnet build/test/stryker integration, uploading test results and coverage artifacts, branch protection integration, and PR status checks. Invoked by the devops-engineer agent when CI workflows need to be created or updated.
- License 许可
- GPL-3.0
- 最近更新
- 2026-06-06
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- github-ci-automation
- description
- Structured workflow for designing and maintaining GitHub Actions continuous integration for HypermediaEngine. Covers workflow file structure, push/pull_request triggers, build matrix, caching, dotnet build/test/stryker integration, uploading test results and coverage artifacts, branch protection integration, and PR status checks. Invoked by the devops-engineer agent when CI workflows need to be created or updated.
03 SKILL.md 正文
GitHub CI Automation
You are executing the github-ci-automation skill on behalf of the devops-engineer agent. Your job is to produce or modify .github/workflows/*.yml files that build, test, and validate HypermediaEngine on every push and pull request — gating merges with deterministic status checks.
When to Invoke
- A new CI workflow must be created (e.g., main
ci.yml, separatemutation.ymlfor nightly stryker) - An existing workflow needs new steps (additional target framework, coverage upload, etc.)
- A failing or flaky CI run requires diagnosis and remediation
- Branch protection rules must be aligned with workflow job names
Prerequisites
- Repository hosted on GitHub with Actions enabled
.csprojfiles build cleanly locally withdotnet build- Tests pass locally with
dotnet test - For coverage:
coverlet.collectorreferenced in test projects - For mutation: Stryker config (
stryker-config.json) in test project
Workflow Structure
A CI workflow file under .github/workflows/:
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
pull-requests: write
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
name: Build & Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
dotnet: ['8.0.x', '9.0.x']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Cache NuGet
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.dotnet }}
path: '**/TestResults/*.trx'
- name: Upload coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.dotnet }}
path: '**/TestResults/**/coverage.cobertura.xml'
Workflow
Phase 0 — Context Load
- Read
CLAUDE.mdfor project conventions and quality gates. - List existing workflows:
ls .github/workflows/. - Read any existing workflow you will modify in full.
- Read
global.json/Directory.Build.propsto identify target framework versions.
Phase 1 — Triggers and Concurrency
Decide which events fire the workflow:
pushtomain— every merge produces a CI runpull_requesttomain— every PR is validatedworkflow_dispatch— manual re-run capabilityschedule— only for nightly jobs (e.g., mutation testing)
Always include concurrency with cancel-in-progress: true so stale runs from force-pushes don't waste minutes.
Phase 2 — Matrix Selection
Build a matrix only when behavior differs across dimensions:
- Cross-platform behavior →
os: [ubuntu-latest, windows-latest] - Multiple SDK versions in support →
dotnet: ['8.0.x', '9.0.x']
fail-fast: false — let all matrix legs run so the report shows every failure, not just the first.
Phase 3 — Caching
NuGet cache key must include hashes of project files and any central package management file (Directory.Packages.props). A stale key returns the wrong package set; an over-specific key never hits. The provided pattern balances both.
Phase 4 — Quality Gates
Map each project quality gate to a workflow step:
| Gate | Step |
|---|---|
| Build | dotnet build --configuration Release --no-restore |
| Test | dotnet test --configuration Release --no-build --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage" |
| Mutation (separate job, runs less frequently) | dotnet stryker --reporter html --reporter cleartext |
Always run with --no-restore / --no-build after their predecessors to avoid redundant work.
Phase 5 — Artifact Upload
Upload these on every run with if: always() so PR reviewers can inspect failures:
.trxtest result filescoverage.cobertura.xmlfiles- Stryker HTML report (when applicable)
Phase 6 — Branch Protection
After the workflow runs at least once, configure branch protection on main:
- Require status checks: every job name from the matrix (e.g.,
Build & Test (ubuntu-latest, 8.0.x)) - Require branches to be up to date before merging
- Disallow direct pushes
Document the required check names in the PR description so future contributors know what must pass.
Common Pitfalls
- Forgetting
fetch-depth: 0: required for SemVer tools like MinVer, Source Link, and git-blame-based reviews. - Hardcoded SDK version: drifts from the project's
global.json. Either match it explicitly or read it dynamically. - No concurrency cancel: rapid pushes pile up runs and exhaust runner minutes.
- Stryker on every PR: too slow. Run it nightly or on-demand via
workflow_dispatch. - Coverage collected but not enforced: integrate with the
sonarqube-pr-quality-gateskill or a coverage threshold action. - Secrets in workflow file: only reference
${{ secrets.* }}; never echo them. - Status check names changing: when a job is renamed, branch protection rules silently stop enforcing until updated.
Output
Return to the calling agent:
- Workflow files created or modified
- Job names that must be added to branch protection
- Any caching, matrix, or secret prerequisites
- Estimated runtime per PR
04 同仓库更多 Skills
write-tests
Test implementation skill for HypermediaEngine. Takes a confirmed test plan from design-test-cases and produces compilable, runnable xUnit tests following project conventions. Validates coverage quality through mutation testing. Invoked by the sqa-engineer agent after the test plan is approved.
write-documentation
Structured documentation writing workflow for HypermediaEngine. Writes or updates README.md files at the repo root and in each project directory (src/, tests/, samples/, etc.) based on current implementation, ADRs, and architecture decisions.
write-adr
Writes a numbered Architecture Decision Record (ADR) for a significant architectural choice in the HypermediaEngine project. Invoked by the software-architect agent whenever a consequential design decision is made or ratified. Saves the ADR to docs/architecture/decisions/.
tunit-playwright-ui-testing
Comprehensive guidance for writing coded end-to-end UI tests in C# using TUnit.Playwright. Tests inherit from PageTest — the base class manages all browser lifecycle. Covers NuGet setup, PageTest inheritance, Page Object Model, browser configuration, parallelism limiting, and CI integration. Based on the official TUnit docs at https://tunit.dev/docs/examples/playwright.
triage
Task classification, decomposition, dependency mapping, and routing skill. Invoked by the triage-agent to break any user request into discrete, independently-routable work items with assigned priorities and agent chains.
system-design
Expert system design skill. Use PROACTIVELY to design systems, review architectures, and assist software engineers in learning design principles and implementing them in the code with design patterns.