diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..459dae36 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,43 @@ +name: Codecov + +on: + push: + branches: + - main + paths: + - 'agentstack/**/*.py' + pull_request: + branches: + - main + paths: + - 'agentstack/**/*.py' + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Run tests with tox + run: tox + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: true diff --git a/tests/test_agents_config.py b/tests/test_agents_config.py index 5b110192..58811a95 100644 --- a/tests/test_agents_config.py +++ b/tests/test_agents_config.py @@ -22,10 +22,10 @@ def tearDown(self): def test_empty_file(self): config = AgentConfig("agent_name") assert config.name == "agent_name" - assert config.role is "" - assert config.goal is "" - assert config.backstory is "" - assert config.llm is "" + assert config.role == "" + assert config.goal == "" + assert config.backstory == "" + assert config.llm == "" def test_read_minimal_yaml(self): shutil.copy(BASE_PATH / "fixtures/agents_min.yaml", self.project_dir / AGENTS_FILENAME) diff --git a/tests/test_tasks_config.py b/tests/test_tasks_config.py index 498ea9c8..394b8ced 100644 --- a/tests/test_tasks_config.py +++ b/tests/test_tasks_config.py @@ -22,17 +22,17 @@ def tearDown(self): def test_empty_file(self): config = TaskConfig("task_name") assert config.name == "task_name" - assert config.description is "" - assert config.expected_output is "" - assert config.agent is "" + assert config.description == "" + assert config.expected_output == "" + assert config.agent == "" def test_read_minimal_yaml(self): shutil.copy(BASE_PATH / "fixtures/tasks_min.yaml", self.project_dir / TASKS_FILENAME) config = TaskConfig("task_name") assert config.name == "task_name" - assert config.description is "" - assert config.expected_output is "" - assert config.agent is "" + assert config.description == "" + assert config.expected_output == "" + assert config.agent == "" def test_read_maximal_yaml(self): shutil.copy(BASE_PATH / "fixtures/tasks_max.yaml", self.project_dir / TASKS_FILENAME) diff --git a/tox.ini b/tox.ini index 6c6a966b..a29b10e8 100644 --- a/tox.ini +++ b/tox.ini @@ -10,10 +10,25 @@ envlist = py310,py311,py312 deps = pytest parameterized + coverage mypy: mypy commands = - pytest -v {posargs} - mypy: mypy agentops + coverage run --source=. --omit="**/tmp/**,./tmp/**/*" -m pytest -v {posargs} + coverage report -m + coverage xml + mypy: mypy agentstack setenv = AGENTSTACK_TELEMETRY_OPT_OUT = 1 - AGENTSTACK_UPDATE_DISABLE = 1 \ No newline at end of file + AGENTSTACK_UPDATE_DISABLE = 1 + +[coverage:run] +branch = True +source = . +omit = + **/tmp/** + ./tmp/**/* + +[coverage:report] +omit = + **/tmp/** + ./tmp/**/*