Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

  • Add SKIP_AI_ENFORCEMENT: 1 environment variable to coverage steps
  • Applied to both coverage-text and coverage-html steps
  • Matches pattern from testing.yml workflow
  • Skips AI enforcement tests that require third-party tools (cargo machete, Ansible, OpenTofu)
  • YAML linting passes
Original prompt

This section details on the original issue you should resolve

<issue_title>Create coverage CI workflow</issue_title>
<issue_description>Parent Epic: #85

Overview

Create a GitHub Actions workflow to generate code coverage reports on every push and pull request. The workflow generates coverage in two formats: a text summary for immediate viewing in the workflow output, and an HTML report uploaded as an artifact for detailed inspection.

Note: This issue does NOT include Codecov or other external coverage service integration.

Goals

  • Generate coverage reports automatically in CI/CD for all branches
  • Display coverage summary in workflow output (text format)
  • Make detailed HTML coverage reports available as artifacts
  • Add .coverage/ directory to .gitignore

Specifications

Workflow Structure

Trigger Events: Push and pull_request (following testing.yml pattern)

Job: Single coverage job with these steps:

  1. Checkout code - actions/checkout@v4
  2. Setup Rust toolchain - dtolnay/rust-toolchain@stable
  3. Enable caching - Swatinem/rust-cache@v2
  4. Install cargo-llvm-cov - taiki-e/install-action@v2
  5. Generate text coverage - cargo cov
  6. Generate HTML report - cargo cov-html
  7. Upload HTML artifact - actions/upload-artifact@v4

Example Workflow

name: Coverage

on:
  push:
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  coverage:
    name: Coverage Report
    runs-on: ubuntu-latest

    steps:
      - id: checkout
        name: Checkout Repository
        uses: actions/checkout@v4

      - id: setup
        name: Setup Toolchain
        uses: dtolnay/rust-toolchain@stable

      - id: cache
        name: Enable Workflow Cache
        uses: Swatinem/rust-cache@v2

      - id: install-llvm-cov
        name: Install cargo-llvm-cov
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-llvm-cov

      - id: coverage-text
        name: Generate Text Coverage Summary
        run: cargo cov

      - id: coverage-html
        name: Generate HTML Coverage Report
        run: cargo cov-html

      - id: upload-coverage
        name: Upload HTML Coverage Report
        uses: actions/upload-artifact@v4
        with:
          name: coverage-html-report
          path: target/llvm-cov/html/
          retention-days: 30

Implementation Plan

Phase 1: Update .gitignore (5 minutes)

  • Add .coverage/ directory to .gitignore with comment

Phase 2: Create Workflow (15 minutes)

  • Create .github/workflows/coverage.yml
  • Add trigger events and environment variables
  • Set up job structure

Phase 3: Configure Toolchain (10 minutes)

  • Add Rust toolchain setup, caching, and cargo-llvm-cov installation

Phase 4: Generate Reports (15 minutes)

  • Add text and HTML coverage generation steps

Phase 5: Upload Artifact (10 minutes)

  • Add artifact upload step with 30-day retention

Phase 6: Testing (15 minutes)

  • Test workflow on a feature branch
  • Verify text output and HTML artifact availability

Acceptance Criteria

  • .coverage/ directory added to .gitignore
  • Workflow file exists at .github/workflows/coverage.yml
  • Workflow triggers on push and pull_request
  • Text coverage summary visible in workflow output
  • HTML coverage artifact uploaded with 30-day retention
  • Workflow does NOT block CI/CD on coverage failures

Notes

  • Uses cov and cov-html aliases from .cargo/config.toml
  • Follows patterns from existing testing.yml workflow
  • Non-blocking by design - coverage is informational only
  • Future enhancement: External coverage service integration can be added later</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Create GitHub Actions workflow for code coverage reports Add coverage CI workflow Oct 29, 2025
Copilot AI requested a review from josecelano October 29, 2025 18:52
@josecelano josecelano marked this pull request as ready for review October 29, 2025 19:14
@josecelano
Copy link
Member

josecelano commented Oct 29, 2025

@copilot in the steps:

- id: coverage-text
  name: Generate Text Coverage Summary
  run: cargo cov

- id: coverage-html
  name: Generate HTML Coverage Report
  run: cargo cov-html

We need to skip the AI ENFORCEMENT tests. Some tests run E2E tests that require some third-party tools to be installed like: cargo machete, Ansible, OpenTofu. We do not need to run those tests to generate the code coverage. We nned to add the env var SKIP_AI_ENFORCEMENT with value 1 like the testing workflow (.github/workflows/testing.yml)

- id: test
  name: Run Unit Tests
  env:
    SKIP_AI_ENFORCEMENT: 1
  run: cargo test --tests --benches --examples --workspace --all-targets --all-features

Copy link
Contributor Author

Copilot AI commented Oct 29, 2025

@copilot in the steps:

...

Added SKIP_AI_ENFORCEMENT: 1 to both coverage steps. This skips AI enforcement tests that require third-party tools. (commit b4092b6)

Copy link
Member

@josecelano josecelano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b4092b6

@josecelano josecelano merged commit 94c764e into main Oct 29, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create coverage CI workflow

2 participants