11# .github/workflows/ci.yml
22
3- name : Python Application CI
3+ name : Continuous Integration
44
55on :
66 push :
7- branches : [ main ]
7+ branches : [main]
88 pull_request :
9- branches : [ main ]
9+ branches : [main]
1010
1111jobs :
12- build-and-test :
12+ lint-and-format :
13+ name : " Lint & Format"
1314 runs-on : ubuntu-latest
14-
1515 steps :
16- - name : Check out code
16+ - name : " Checkout code"
1717 uses : actions/checkout@v4
1818
19- - name : Set up Python 3.11
19+ - name : " Set up Python"
2020 uses : actions/setup-python@v5
2121 with :
22- python-version : ' 3.11'
22+ python-version : " 3.11.9 "
2323
24- - name : Install Graphviz
24+ - name : " Install Poetry "
2525 run : |
26- sudo apt-get update
27- sudo apt-get install -y graphviz graphviz-dev libgraphviz-dev pkg-config
26+ curl -sSL https://install.python-poetry.org | python3 -
27+ echo "$HOME/.local/bin" >> $GITHUB_PATH
28+
29+ - name : " Configure Poetry"
30+ run : |
31+ poetry config virtualenvs.create true
32+ poetry config virtualenvs.in-project true
33+
34+ - name : " Cache Poetry dependencies"
35+ uses : actions/cache@v4
36+ with :
37+ path : .venv
38+ key : poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
39+ restore-keys : |
40+ poetry-${{ runner.os }}-
41+
42+ - name : " Install dependencies"
43+ run : poetry install
44+
45+ - name : " Run Linter & Formatter"
46+ run : |
47+ poetry run ruff check .
48+ poetry run ruff format --check .
49+
50+ type-check :
51+ name : " Type Checking"
52+ runs-on : ubuntu-latest
53+ steps :
54+ - name : " Checkout code"
55+ uses : actions/checkout@v4
56+
57+ - name : " Set up Python"
58+ uses : actions/setup-python@v5
59+ with :
60+ python-version : " 3.11.9"
2861
29- - name : Install dependencies
62+ - name : " Install Poetry "
3063 run : |
31- python -m pip install --upgrade pip
32- # Install ALL packages in editable mode to build the correct environment
33- # This makes all sub-repos available.
34- pip install -e ./agent-core -e ./agent-concurrent -e ./agent-engine -e ./agent-persist -e ./agent-sim
35- pip install -e ".[dev]"
64+ curl -sSL https://install.python-poetry.org | python3 -
65+ echo "$HOME/.local/bin" >> $GITHUB_PATH
3666
37- - name : Lint with Ruff
67+ - name : " Configure Poetry "
3868 run : |
39- ruff check .
69+ poetry config virtualenvs.create true
70+ poetry config virtualenvs.in-project true
4071
41- - name : Check formatting with Ruff
72+ - name : " Cache Poetry dependencies"
73+ uses : actions/cache@v4
74+ with :
75+ path : .venv
76+ key : poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
77+ restore-keys : |
78+ poetry-${{ runner.os }}-
79+
80+ - name : " Install dependencies"
81+ run : poetry install
82+
83+ - name : " Run Type Checker"
84+ run : poetry run mypy agent-core agent-engine agent-concurrent agent-persist agent-sim
85+
86+ test :
87+ name : " Tests"
88+ runs-on : ubuntu-latest
89+ steps :
90+ - name : " Checkout code"
91+ uses : actions/checkout@v4
92+
93+ - name : " Set up Python"
94+ uses : actions/setup-python@v5
95+ with :
96+ python-version : " 3.11.9"
97+
98+ - name : " Install Graphviz"
4299 run : |
43- # Have ruff format check the entire project, not just a single 'src' folder.
44- ruff format --diff .
100+ sudo apt-get update
101+ sudo apt-get install -y graphviz graphviz-dev libgraphviz-dev pkg-config
45102
46- - name : Type check with Mypy
103+ - name : " Install Poetry "
47104 run : |
48- # Only check packages that have Python files and aren't excluded
49- mypy agent-core/src agent-engine/src agent-concurrent/src agent-persist/src
105+ curl -sSL https://install.python-poetry.org | python3 -
106+ echo "$HOME/.local/bin" >> $GITHUB_PATH
50107
51- - name : Run tests with Pytest
108+ - name : " Configure Poetry "
52109 run : |
53- # This command is fine. Pytest will now work because the 'Install dependencies'
54- # step has correctly set up the environment.
55- pytest
110+ poetry config virtualenvs.create true
111+ poetry config virtualenvs.in-project true
112+
113+ - name : " Cache Poetry dependencies"
114+ uses : actions/cache@v4
115+ with :
116+ path : .venv
117+ key : poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
118+ restore-keys : |
119+ poetry-${{ runner.os }}-
120+
121+ - name : " Install dependencies"
122+ run : poetry install
123+
124+ - name : " Run Tests"
125+ run : poetry run pytest
0 commit comments