Skip to content

Commit 7b39f58

Browse files
committed
Add GitHub workflows
1 parent 98c2fb5 commit 7b39f58

File tree

4 files changed

+145
-3
lines changed

4 files changed

+145
-3
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '**'
9+
pull_request: {}
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
name: Lint ${{ matrix.python-version }}
15+
if: false
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ['3.10', '3.11', '3.12', '3.13']
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: astral-sh/setup-uv@v4
24+
with:
25+
enable-cache: true
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install dependencies
29+
run: uv sync --group testing
30+
31+
- name: Run formatting
32+
run: uv run ruff format --diff
33+
continue-on-error: true
34+
35+
- name: Run linting
36+
run: uv run ruff check --output-format=github
37+
38+
test:
39+
runs-on: ${{ matrix.os }}
40+
name: Test ${{ matrix.python-version }}
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
45+
python-version: ['3.10', '3.11', '3.12', '3.13']
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- uses: astral-sh/setup-uv@v4
50+
with:
51+
enable-cache: true
52+
python-version: ${{ matrix.python-version }}
53+
54+
- name: Install Poetry
55+
uses: snok/install-poetry@v1
56+
with:
57+
version: 1.8.2
58+
59+
- name: Install dependencies
60+
run: poetry install
61+
62+
- run: mkdir coverage
63+
64+
- name: Run tests
65+
run: make test

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
sources = coagent tests
2+
3+
.PHONY: .uv ## Check that uv is installed
4+
.uv:
5+
@uv -V || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
6+
7+
.PHONY: format ## Auto-format python source files
8+
format: .uv
9+
uv run ruff check --fix $(sources)
10+
uv run ruff format $(sources)
11+
12+
.PHONY: lint ## Lint python source files
13+
lint: .uv
14+
uv run ruff check $(sources)
15+
uv run ruff format --check $(sources)
16+
17+
.PHONY: test ## Run all tests
18+
test: .uv
19+
uv run pytest --durations=10

pyproject.toml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
[project]
2+
name = "coagent"
3+
version = "0.0.1"
4+
description = ""
5+
authors = ["Your Name <[email protected]>"]
6+
requires-python = ">=3.10"
7+
18
[tool.poetry]
29
name = "coagent"
310
version = "0.0.1"
@@ -25,13 +32,55 @@ useLibraryCodeForTypes = true
2532
exclude = [".cache"]
2633

2734
[tool.ruff]
28-
# https://beta.ruff.rs/docs/configuration/
29-
select = ['E', 'W', 'F', 'I', 'B', 'C4', 'ARG', 'SIM']
30-
ignore = ['W291', 'W292', 'W293']
35+
# https://docs.astral.sh/ruff/configuration/
36+
line-length = 120
37+
extend-exclude = ['coagent/agents/aswarm']
38+
39+
[tool.ruff.format]
40+
exclude = ['coagent/agents/aswarm']
41+
42+
[tool.ruff.lint]
43+
select = [
44+
'F', # Pyflakes
45+
'E', # pycodestyle (Error)
46+
# 'I', # isort
47+
# 'D', # pydocstyle
48+
# 'UP', # pyupgrade
49+
'YTT', # flake8-2020
50+
'B', # flake8-bugbear
51+
'T10', # flake8-debugger
52+
# 'T20', # flake8-print
53+
'C4', # flake8-comprehensions
54+
'PYI006', # flake8-pyi
55+
'PYI062', # flake8-pyi
56+
'PYI063', # flake8-pyi
57+
'PYI066', # flake8-pyi
58+
]
59+
ignore = [
60+
'B007',
61+
'B011',
62+
'B012',
63+
'B028',
64+
'B904',
65+
'C401',
66+
'C408',
67+
'E501',
68+
'F401',
69+
'F841',
70+
]
3171

3272
[tool.poetry.scripts]
3373
coagent = "coagent.cli:main.main"
3474

75+
[dependency-groups]
76+
linting = [
77+
"ruff",
78+
]
79+
testing = [
80+
"pytest",
81+
"pytest-cov",
82+
]
83+
3584
[build-system]
3685
requires = ["poetry-core>=1.0.0"]
3786
build-backend = "poetry.core.masonry.api"

tests/core/test_util.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from coagent.core.util import get_func_args
2+
3+
4+
def func(a: int, b: str, c: float) -> None:
5+
pass
6+
7+
8+
def test_get_func_args():
9+
assert get_func_args(func) == {"a", "b", "c"}

0 commit comments

Comments
 (0)