Skip to content

Commit

Permalink
M2 6526 (#1284)
Browse files Browse the repository at this point in the history
* add coverage pipeline for get badge
* upd readme
  • Loading branch information
Maksim Barsukou authored May 8, 2024
1 parent 48f02c6 commit 86d3432
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Coverage
on:
push:
branches:
- develop

permissions:
statuses: write

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: KengoTODA/actions-setup-docker-compose@v1
with:
version: '2.23.3'

- name: "Get coverage"
run: |
cp .env.default .env
echo -e "\nRABBITMQ__USE_SSL=False" >> .env
make run_local
- run: make ctest

- run: make creport SHA=${{ github.sha }}

- run: pip install smokeshow

- run: smokeshow upload htmlcov
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 80
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
SMOKESHOW_GITHUB_CONTEXT: coverage
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}

13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ PORT = 8000
HOST = localhost

TEST_COMMAND = pytest -s -vv
COVERAGE_COMMAND = coverage run --branch --concurrency=thread,gevent -m pytest
REPORT_COVERAGE_COMMAND = coverage html --show-contexts --title "Coverage for ${SHA}"
EXPORT_COMMAND = python src/export_spec.py

RUFF_COMMAND = ruff
ISORT_COMMAND = isort
MYPY_COMMAND = mypy

DOCKER_EXEC = docker-compose run --rm app
COVERAGE_DOCKER_EXEC = docker-compose run --rm -u root app

# ###############
# Local
Expand Down Expand Up @@ -55,6 +58,16 @@ dtest:
${DOCKER_EXEC} \
${TEST_COMMAND} ./

.PHONY: ctest
ctest:
${COVERAGE_DOCKER_EXEC} \
${COVERAGE_COMMAND}

.PHONY: creport
creport:
${COVERAGE_DOCKER_EXEC} \
${REPORT_COVERAGE_COMMAND}


.PHONY: dcheck
dcheck:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This repository is used for the backend of the [MindLogger](https://mindlogger.org/) application stack.

<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/ChildMindInstitute/mindlogger-backend-refactor" target="_blank">
<img src="https://coverage-badge.samuelcolvin.workers.dev/ChildMindInstitute/mindlogger-backend-refactor.svg" alt="Coverage">
</a>

## Getting Started

* MindLogger Admin - [GitHub Repo](https://github.com/ChildMindInstitute/mindlogger-admin)
Expand Down

0 comments on commit 86d3432

Please sign in to comment.