ci: add run-tests composite action + ci workflow on main/release #32

Merged
jasoncouture merged 2 commits from ci/run-tests-action into main 2026-05-07 11:40:15 -04:00
jasoncouture commented 2026-05-07 11:00:37 -04:00 (Migrated from github.com)

Summary

Lays the CI foundation: a reusable composite action that the next two PRs (PR coverage comment, future quality gates) build on top of, plus the main / release/**/* push trigger.

What's in here

.github/actions/run-tests/action.yml

Composite action with four steps:

  1. dotnet restore LlamaShears.slnx — explicit so step 2 can --no-restore.
  2. dotnet test LlamaShears.slnx --no-restore --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml. Each test project's MTP runner drops a per-project cobertura under <test-proj>/bin/Debug/net10.0/TestResults/coverage.cobertura.xml.
  3. irongut/CodeCoverageSummary@v1 — globs all per-project cobertura files, emits code-coverage-results.md (per-assembly markdown breakdown).
  4. actions/upload-artifact@v4 — uploads code-coverage-results.md as artifact coverage-summary (if-no-files-found: error).

If dotnet test fails, steps 3 and 4 don't run — by design. Nothing is uploaded from a failing build.

.github/workflows/ci.yml

Trigger: push to main and release/** branches. Single test job:

  1. actions/checkout@v4 with fetch-depth: 0 (NBGV needs full history for proper version computation).
  2. actions/setup-dotnet@v4 pinned to 10.0.x.
  3. The local ./.github/actions/run-tests action.

concurrency group keyed to ref with cancel-in-progress: false — release branches deserve to finish.

Why a composite action and not job steps inline

PR 3 (PR coverage comment) needs the same restore/test/coverage pipeline; sharing the action means main and PR coverage are computed identically, with one place to update flags. The action also keeps the workflow files tiny — the workflow only adds what's specific to its trigger (PR comment posting in PR 3, push trigger here).

Action-pinning policy

All third-party actions are pinned to a floating major (@v1, @v4) per repo policy.

Test plan

  • Locally verified dotnet test LlamaShears.slnx --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml works end-to-end without adding extra packages — TUnit/MTP transitively pulls Microsoft.Testing.Extensions.CodeCoverage.
  • Confirmed cobertura files land in <test-proj>/bin/Debug/net10.0/TestResults/.
  • Husky docs-api-up-to-date pre-push check passed.
  • First push to main after merge will exercise the workflow end-to-end. Coverage extension version, ubuntu runner availability, and irongut @v1 resolution can only be verified there.

Stacking note

This PR targets feat/public-readme-required (PR #31). Merging order: #31 first, then this PR re-targets main automatically.

🤖 Generated with Claude Code

## Summary Lays the CI foundation: a reusable composite action that the next two PRs (PR coverage comment, future quality gates) build on top of, plus the `main` / `release/**/*` push trigger. ## What's in here ### `.github/actions/run-tests/action.yml` Composite action with four steps: 1. `dotnet restore LlamaShears.slnx` — explicit so step 2 can `--no-restore`. 2. `dotnet test LlamaShears.slnx --no-restore --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml`. Each test project's MTP runner drops a per-project cobertura under `<test-proj>/bin/Debug/net10.0/TestResults/coverage.cobertura.xml`. 3. `irongut/CodeCoverageSummary@v1` — globs all per-project cobertura files, emits `code-coverage-results.md` (per-assembly markdown breakdown). 4. `actions/upload-artifact@v4` — uploads `code-coverage-results.md` as artifact `coverage-summary` (`if-no-files-found: error`). If `dotnet test` fails, steps 3 and 4 don't run — by design. Nothing is uploaded from a failing build. ### `.github/workflows/ci.yml` Trigger: `push` to `main` and `release/**` branches. Single `test` job: 1. `actions/checkout@v4` with `fetch-depth: 0` (NBGV needs full history for proper version computation). 2. `actions/setup-dotnet@v4` pinned to `10.0.x`. 3. The local `./.github/actions/run-tests` action. `concurrency` group keyed to ref with `cancel-in-progress: false` — release branches deserve to finish. ## Why a composite action and not job steps inline PR 3 (PR coverage comment) needs the same restore/test/coverage pipeline; sharing the action means main and PR coverage are computed identically, with one place to update flags. The action also keeps the workflow files tiny — the workflow only adds what's specific to its trigger (PR comment posting in PR 3, push trigger here). ## Action-pinning policy All third-party actions are pinned to a floating major (`@v1`, `@v4`) per repo policy. ## Test plan - [x] Locally verified `dotnet test LlamaShears.slnx --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml` works end-to-end without adding extra packages — TUnit/MTP transitively pulls `Microsoft.Testing.Extensions.CodeCoverage`. - [x] Confirmed cobertura files land in `<test-proj>/bin/Debug/net10.0/TestResults/`. - [x] Husky `docs-api-up-to-date` pre-push check passed. - [ ] First push to `main` after merge will exercise the workflow end-to-end. Coverage extension version, ubuntu runner availability, and irongut `@v1` resolution can only be verified there. ## Stacking note This PR targets `feat/public-readme-required` (PR #31). Merging order: #31 first, then this PR re-targets `main` automatically. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CLAassistant commented 2026-05-07 11:00:48 -04:00 (Migrated from github.com)

CLA assistant check
All committers have signed the CLA.

[![CLA assistant check](https://cla-assistant.io/pull/badge/signed)](https://cla-assistant.io/jasoncouture/llama-shears?pullRequest=32) <br/>All committers have signed the CLA.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-05-07 11:03:48 -04:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

Introduces an initial CI setup for the repo by adding a reusable composite action to run .NET restore/test with code coverage and a workflow that runs it on pushes to main and release/**.

Changes:

  • Added .github/actions/run-tests composite action to restore, run tests with cobertura coverage output, generate a markdown coverage summary, and upload it as an artifact.
  • Added .github/workflows/ci.yml workflow triggered on push to main/release/**, running the composite action on ubuntu-latest.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/ci.yml Adds a push-triggered CI workflow that checks out the repo, installs .NET SDK 10, and runs the shared test/coverage action.
.github/actions/run-tests/action.yml Implements the shared restore/test/coverage + summary generation + artifact upload pipeline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview Introduces an initial CI setup for the repo by adding a reusable composite action to run .NET restore/test with code coverage and a workflow that runs it on pushes to `main` and `release/**`. **Changes:** - Added `.github/actions/run-tests` composite action to restore, run tests with cobertura coverage output, generate a markdown coverage summary, and upload it as an artifact. - Added `.github/workflows/ci.yml` workflow triggered on push to `main`/`release/**`, running the composite action on `ubuntu-latest`. ### Reviewed changes Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment. | File | Description | | ---- | ----------- | | .github/workflows/ci.yml | Adds a push-triggered CI workflow that checks out the repo, installs .NET SDK 10, and runs the shared test/coverage action. | | .github/actions/run-tests/action.yml | Implements the shared restore/test/coverage + summary generation + artifact upload pipeline. | --- 💡 <a href="/jasoncouture/llama-shears/new/feat/public-readme-required?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -0,0 +7,4 @@
- 'release/**'
permissions:
contents: read
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-07 11:03:48 -04:00

The workflow sets permissions: contents: read only, which can prevent actions/upload-artifact (invoked by the run-tests composite action) from creating artifacts. Add actions: write at the workflow (or job) level, or remove the explicit permissions block so the artifact upload can succeed.

The workflow sets `permissions: contents: read` only, which can prevent `actions/upload-artifact` (invoked by the `run-tests` composite action) from creating artifacts. Add `actions: write` at the workflow (or job) level, or remove the explicit permissions block so the artifact upload can succeed.
Sign in to join this conversation.
No description provided.