Skip to content

Commit

Permalink
Merge branch 'main' into dependabot-auto-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
gabezurita authored Dec 19, 2024
2 parents b3c6d57 + 886a412 commit fb9a76a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Test & Lint"
name: "Test, Lint & Coverage"

on:
push:
Expand Down Expand Up @@ -37,5 +37,15 @@ jobs:
- name: "Run mypy"
run: poetry run mypy .

- name: "Run tests"
run: poetry run pytest --cov=src --cov-report=html
- name: "Run tests with coverage"
run: poetry run pytest --cov=src --cov-report=xml --cov-report=term-missing

- name: "Upload coverage to Code Climate"
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{github.workspace}}/coverage.xml:coverage.py
debug: true
prefix: ${{github.workspace}}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Disability Max Ratings API

[![Tests](https://github.com/department-of-veterans-affairs/disability-max-ratings-api/actions/workflows/test-code.yml/badge.svg)](https://github.com/department-of-veterans-affairs/disability-max-ratings-api/actions/workflows/test-code.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/3cdea963cb3092674df1/maintainability)](https://codeclimate.com/github/department-of-veterans-affairs/disability-max-ratings-api/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/3cdea963cb3092674df1/test_coverage)](https://codeclimate.com/github/department-of-veterans-affairs/disability-max-ratings-api/test_coverage)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
![Python Version from PEP 621 TOML](https://img.shields.io/badge/Python-3.12-blue)
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![Linting: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

This repository uses CodeClimate for code coverage and maintainability reporting. See [Configuration Guide](docs/CONFIGURATION.md) for setup instructions.

> **Note:** This API was formerly known as Max CFI (Claim for Increase) API. All functionality remains the same.
Expand Down
34 changes: 34 additions & 0 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuration Guide

## Code Coverage Setup

This repository uses CodeClimate for code coverage and maintainability reporting.

### Required Setup Steps

#### In CodeClimate:
1. [Enable CodeClimate](https://github.com/apps/codeclimate) for the repository
2. [Enable "Pull Request Status Updates"](https://codeclimate.com/repos/676364ba629a59031e118d21/settings/github/edit) in Repo Settings > GitHub
3. [Enable Test Coverage and Maintainability checks](https://codeclimate.com/repos/676364ba629a59031e118d21/settings/test_reporter)

#### In GitHub:
1. Add `CC_TEST_REPORTER_ID` to [GitHub Actions secrets](https://github.com/department-of-veterans-affairs/disability-max-ratings-api/settings/secrets/actions)
2. Ensure [Actions have "Read and write permissions"](https://github.com/department-of-veterans-affairs/disability-max-ratings-api/settings/actions) under repository Settings > Actions > General
3. Enable [branch protection](https://github.com/department-of-veterans-affairs/disability-max-ratings-api/settings/branches) for the following status checks:
- `codeclimate/test-coverage`
- `codeclimate/maintainability`

### Verification

After setup, CodeClimate will:
- Run on every PR and push to main
- Post coverage reports as PR comments
- Show coverage changes inline with code changes
- Block PR merging if coverage drops below configured thresholds (if set)

### Troubleshooting

If coverage reports are not appearing:
1. Verify the `CC_TEST_REPORTER_ID` is correctly set
2. Check GitHub Actions logs for any coverage upload errors
3. Ensure the repository is properly connected in CodeClimate's UI

0 comments on commit fb9a76a

Please sign in to comment.