Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Commit a5a9d5c

Browse files
authored
Enhance CI workflow by adding linting job and ensuring dependencies a… (#31)
* Enhance CI workflow by adding linting job and ensuring dependencies are cached * fix? * Refactor CI workflow to streamline Poetry installation and remove redundant pip upgrade step * well. Better makefile * Add poetry as a dependency in pyproject.toml and use poetry sync
1 parent cc347e8 commit a5a9d5c

4 files changed

Lines changed: 1201 additions & 19 deletions

File tree

.github/workflows/workflow.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,45 @@ on:
55
branches: [ main ]
66

77
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ["3.13"]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Install poetry
16+
run: pipx install poetry
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
cache: 'poetry' # Cache Poetry dependencies
22+
- name: Install dependencies
23+
run: |
24+
poetry sync --no-root
25+
- name: Run linters
26+
run: |
27+
poetry run make lint
28+
829
test:
930
runs-on: ubuntu-latest
31+
needs: lint
1032
strategy:
1133
matrix:
1234
python-version: ["3.13"]
1335

1436
steps:
1537
- uses: actions/checkout@v4
38+
- name: Install poetry
39+
run: pipx install poetry
1640
- name: Set up Python ${{ matrix.python-version }}
1741
uses: actions/setup-python@v5
1842
with:
1943
python-version: ${{ matrix.python-version }}
44+
cache: 'poetry' # Cache Poetry dependencies
2045
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install poetry
24-
poetry install
46+
run: poetry sync
2547
- name: Run tests and check coverage
2648
run: |
2749
poetry run pytest ./tests --cov=python_chat --cov=./tests --cov-report term-missing --cov-fail-under=85

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ PYTHON_VERSION ?= 3.13
99
$(VENV)/bin/python -m pip install poetry
1010

1111
.install-deps:
12-
$(VENV)/bin/poetry install
12+
poetry run poetry install
1313

1414
.install-pre-commit:
15-
$(VENV)/bin/poetry run pre-commit install
15+
poetry run pre-commit install
1616

1717
init:
1818
@echo "Creating virtual environment..."
@@ -32,20 +32,20 @@ clean:
3232
rm -rf *.egg-info
3333

3434
pretty:
35-
$(VENV)/bin/ruff check --fix-only .
36-
$(VENV)/bin/ruff format .
35+
poetry run ruff check --fix-only .
36+
poetry run ruff format .
3737

3838
ruff-lint:
39-
$(VENV)/bin/ruff check .
39+
poetry run ruff check .
4040

4141
mypy:
42-
$(VENV)/bin/mypy --install-types --non-interactive .
42+
poetry run mypy --install-types --non-interactive .
4343

4444

4545
lint: ruff-lint mypy
4646

4747
test:
48-
$(VENV)/bin/pytest ./tests
48+
poetry run pytest ./tests
4949

5050
test-cov:
51-
$(VENV)/bin/pytest ./tests --cov=python_chat --cov=./tests --cov-report term-missing --cov-fail-under=85
51+
poetry run pytest ./tests --cov=python_chat --cov=./tests --cov-report term-missing --cov-fail-under=85

0 commit comments

Comments
 (0)