From dd8e309c7501e8b3bbe2e4c75fee2de4bb002f46 Mon Sep 17 00:00:00 2001 From: Ngure Nyaga Date: Wed, 7 Jul 2021 08:17:06 +0300 Subject: [PATCH] chore: add coveralls coverage badges --- .github/workflows/ci.yml | 22 +++++++++++++--------- README.md | 3 ++- requirements/base.txt | 1 + 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd39de47..9ab5ea68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ env: CELERY_BROKER_URL: ${{ secrets.CELERY_BROKER_URL }} GOOGLE_APPLICATION_CREDENTIALS: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}" DJANGO_GCP_STORAGE_BUCKET_NAME: ${{ secrets.DJANGO_GCP_STORAGE_BUCKET_NAME }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: linter: @@ -70,6 +71,7 @@ jobs: mypy . pytest: + needs: linter runs-on: ubuntu-latest # Service containers to run with `container-job` @@ -108,21 +110,23 @@ jobs: env: SECRET_PASSPHRASE: ${{ secrets.SECRET_PASSPHRASE }} - - name: Install Python requirements + - name: Install requirements run: | pip install -r requirements/local.txt && pip install -r requirements/production.txt + npm ci - - name: Install NodeJS requirements - run: npm ci - - - name: Run migrations + - name: Set up Django run: | python manage.py migrate - - - name: Collect static files - run: | python manage.py collectstatic --noinput - - name: Run tests + - name: Run tests and collect coverage run: | pytest + coveralls --service=github + + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true diff --git a/README.md b/README.md index 7addb7a2..1c231d39 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ PEPFAR Monitoring, Learning and Evaluation Field Reporting Database for PEPFAR Monitoring, Learning and Evaluation. -![example workflow](https://github.com/savannahghi/mle/actions/workflows/ci.yml/badge.svg) +![Linting and Tests](https://github.com/savannahghi/mle/actions/workflows/ci.yml/badge.svg) +[![Coverage Status](https://coveralls.io/repos/github/savannahghi/mle/badge.svg?branch=main)](https://coveralls.io/github/savannahghi/mle?branch=main) Environment variables --------------------- diff --git a/requirements/base.txt b/requirements/base.txt index 810bc943..bd6f9134 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -13,6 +13,7 @@ uvicorn[standard]==0.14.0 # https://github.com/encode/uvicorn django-phonenumber-field~=5.2.0 phonenumbers~=8.12.26 Fraction~=1.5.1 +coveralls~=3.1.0 # Django # ------------------------------------------------------------------------------