Skip to content

Commit

Permalink
Tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mbging committed Apr 11, 2024
1 parent fa0f7d3 commit 25be066
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4 # required for codecov
-
name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -21,5 +22,25 @@ jobs:
- name: Pull Docker image
run: docker pull mjbourgeon/fastdocx-api:latest

- name: Run container in detached mode
run: docker run -d --name fastdocxapi mjbourgeon/fastdocx-api sleep infinity

- name: Install dependencies
run: docker exec $(docker ps -aqf "name=fastdocxapi") pip install -r requirements.dev.txt

- name: Run tests
run: docker run --rm mjbourgeon/fastdocx-api /bin/bash -c "pip install -r requirements.dev.txt ; pytest -v app/"
run: docker exec $(docker ps -aqf "name=fastdocxapi") pytest --cov=app/ app/ --cov-report=xml

- name: Copy coverage file before upload
run: docker cp $(docker ps -aqf "name=fastdocxapi"):/coverage.xml .

- name: Cleanup
run: docker stop fastdocxapi && docker rm fastdocxapi

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
disable_search: true
verbose: true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
[![typedlib_mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://www.mypy-lang.org)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
![GitHub Actions Workflow Status](https://github.com/mbging/fastdocx-api/actions/workflows/lint.yaml/badge.svg)
![GitHub Actions Workflow Status](https://github.com/mbging/fastdocx-api/actions/workflows/docker-hub.yaml/badge.svg)
![GitHub Actions Workflow Status](https://github.com/mbging/fastdocx-api/actions/workflows/test.yaml/badge.svg)
![GitHub Actions Workflow Status](https://github.com/mbging/fastdocx-api/actions/workflows/lint.yaml/badge.svg)

[![codecov](https://codecov.io/gh/mbging/fastdocx-api/graph/badge.svg?token=3FSG83E16C)](https://codecov.io/gh/mbging/fastdocx-api)

A FastAPI based project to generate DOCX and PDF documents from a DOCX template, JSON data and images.

Expand Down
2 changes: 2 additions & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
certifi==2024.2.2
click==8.1.7
coverage==7.4.4
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
Expand All @@ -10,6 +11,7 @@ packaging==24.0
pluggy==1.4.0
pytest==8.1.1
pytest-asyncio==0.23.6
pytest-cov==5.0.0
python-dotenv==1.0.1
python-multipart==0.0.9
ruff==0.3.5

0 comments on commit 25be066

Please sign in to comment.