Skip to content

Commit

Permalink
Merge pull request #24 from axioma-ai-labs/23-add-tests
Browse files Browse the repository at this point in the history
Add tests
  • Loading branch information
gromdimon authored Dec 26, 2024
2 parents 8fb9514 + 3ce15f5 commit 598dcf5
Show file tree
Hide file tree
Showing 26 changed files with 1,018 additions and 36 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/ci-lint.yml

This file was deleted.

70 changes: 70 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
Lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: 'true'

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pipenv"
cache-dependency-path: |
Pipfile.lock
- name: Install pipenv and deps
run: |
python -m pip install --upgrade pipenv wheel
make deps
- name: Lint source code
run: make lint

Unit-Test:
runs-on: ubuntu-latest
needs:
- Lint
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: 'true'

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pipenv"
cache-dependency-path: |
Pipfile.lock
- name: Install pipenv and deps
run: |
python -m pip install --upgrade pipenv wheel
make deps
- name: Install dependencies
run: make deps

- name: Run tests
run: make test-ci

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
flags: main
token: ${{ secrets.CODECOV_TOKEN }}
slug: axioma-ai-labs/aa-core
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DIRS_PYTHON := src
DIRS_PYTHON := src tests

.PHONY: help
help:
Expand All @@ -10,6 +10,8 @@ help:
@echo " format Format source code"
@echo " lint Run lint checks"
@echo " run Run the agent"
@echo " test Run tests"
@echo " test-ci Run tests in CI"

.PHONY: deps
deps:
Expand Down Expand Up @@ -50,6 +52,22 @@ lint-mypy:
run:
pipenv run python -m src.main

.PHONY: test
test:
pipenv run pytest \
--cov-report term-missing \
--cov-report lcov \
--cov=src \
tests/

.PHONY: test-ci
test-ci:
pipenv run pytest \
--cov-report term-missing \
--cov-report lcov \
--cov=src \
tests/

# .PHONY: jupyternotebook
# jupyternotebook:
# pipenv run \
Expand Down
3 changes: 3 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ mkdocs = "*"
mkdocs-material = "*"
mkdocs-macros-plugin = "*"
mkdocs-awesome-pages-plugin = "*"
pytest-cov = "*"

[dev-packages]
mypy = "*"
isort = "*"
ruff = "*"
pytest = "*"
pytest-asyncio = "*"

[requires]
python_version = "3.12"
147 changes: 146 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# For more configuration details:
# https://docs.codecov.io/docs/codecov-yaml

# Check if this file is valid by running in bash:
# curl -X POST --data-binary @.codecov.yml https://codecov.io/validate

# Coverage configuration
# ----------------------
coverage:
status:
patch: false

range: 70..90 # First number represents red, and second represents green
# (default is 70..100)
round: down # up, down, or nearest
precision: 2 # Number of decimal places, between 0 and 5

# Ignoring Paths
# --------------
# which folders/files to ignore
ignore:
- "test/*"

# Pull request comments:
# ----------------------
# Diff is the Coverage Diff of the pull request.
# Files are the files impacted by the pull request
comment:
layout: diff, files # accepted in any order: reach, diff, flags, and/or files
Loading

0 comments on commit 598dcf5

Please sign in to comment.