Skip to content

Commit

Permalink
Merge pull request #84 from seapagan/add_tests
Browse files Browse the repository at this point in the history
Setup Testing - 80% coverage
  • Loading branch information
seapagan committed Jun 2, 2023
2 parents 242898b + c3ca6b3 commit 22d480e
Show file tree
Hide file tree
Showing 18 changed files with 1,792 additions and 295 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Tests

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
# ---------------------------------------------------------------------- #
# checkout repo and setup Python #
# ---------------------------------------------------------------------- #
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# ---------------------------------------------------------------------- #
# install and configure poetry #
# ---------------------------------------------------------------------- #
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
# ---------------------------------------------------------------------- #
# load cached venv if cache exists #
# ---------------------------------------------------------------------- #
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key:
venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version
}}-${{ hashFiles('**/poetry.lock') }}
# ---------------------------------------------------------------------- #
# install dependencies if cache does not exist #
# ---------------------------------------------------------------------- #
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

# ---------------------------------------------------------------------- #
# run Pytest #
# ---------------------------------------------------------------------- #
- name: Test with pytest
run: |
poetry run pytest --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-python-${{ matrix.python-version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,4 @@ cython_debug/
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

openapi.json
test.db
Loading

0 comments on commit 22d480e

Please sign in to comment.