Skip to content

Commit

Permalink
add coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisLuii committed Jan 6, 2024
1 parent a975eb3 commit 86f76ad
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.10 ]
python-version: [ '3.10' ]
services:
postgres:
image: postgres:11
Expand All @@ -140,15 +140,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage
pip install coveralls
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m coverage run -m unittest
coveralls
run: |
python -m unittest discover -s ./tests/test_implementations
46 changes: 46 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This is a basic workflow to help you get started with Actions

name: Coverage

# Controls when the workflow will run
on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Coverage:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@master

- name: Set github token
run: echo "GITHUB_TOKEN=${{ secrets.GIT_TOKEN }}" >> $GITHUB_ENV
- name: Set coveralls token
run: echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
- name: pip install, make coverage
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage
pip install coveralls
python -m coverage run -m unittest ./tests/test_implementations
coveralls

0 comments on commit 86f76ad

Please sign in to comment.