Skip to content

Commit

Permalink
ci: refresh settings and workflow (#146)
Browse files Browse the repository at this point in the history
- Enable unit testing (except in the Purrr project - those UT require AK
context)
- Add various optional but important linters to Ruff
- Don't pin pytest and ruff versions, no point in updating it from time
to time like in the AK repo
  • Loading branch information
daabr committed Jan 7, 2025
1 parent c6d020a commit 8a8bf34
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Continuous Integration workflow. For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# https://docs.astral.sh/ruff/integrations/#github-actions

Expand All @@ -17,20 +16,24 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint & format with ruff
run: |
ruff check --output-format github .
ruff format --check .
- name: Test with pytest
run: pytest -v --ignore=purrr .

- name: Verify README.md is up to date
run: |
# If this check fails, run "python update_projects_table.py", and add "README.md" to this PR.
python update_projects_table.py
git diff --name-only --exit-code README.md
# (Enable this step once we have unit tests)
# - name: Test with pytest
# run: pytest -v
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Add "test" once we have unit tests
all: deps format lint # test
all: deps lint format test

deps:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

format: deps
Expand All @@ -11,6 +11,6 @@ lint: deps
ruff check --fix --output-format full .

test: deps
pytest -v
pytest -v --ignore=purrr .

.PHONY: all deps format lint test
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool.ruff]
src = ["./**"]
target-version = "py312"

[tool.ruff.lint]
# https://docs.astral.sh/ruff/rules/
extend-select = ["B", "C4", "D101", "D2", "D3", "DTZ", "E5", "I", "N", "PTH", "Q", "S", "UP", "W"]
ignore = ["D213", "S113", "S311", "S314", "S4"]
# TODO: BLE, D100, S113
# MAYBE: D4, ANN, S314, FBT, CPY, TRY

[tool.ruff.lint.isort]
force-sort-within-sections = true
lines-after-imports = 2
order-by-type = false
known-third-party = ["discord", "github"]

force-single-line = true
single-line-exclusions = ["autokitteh.atlassian", "autokitteh.google", "datetime", "typing"]

[tool.ruff.lint.pydocstyle]
convention = "google"
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest ~= 8.2
ruff ~= 0.5
pytest
ruff

0 comments on commit 8a8bf34

Please sign in to comment.