Skip to content

Commit

Permalink
makefile and github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdai committed Jul 23, 2024
1 parent 502c5a6 commit a5085fb
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Linting
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: get code
uses: actions/checkout@v4
- name: install poetry
run: pipx install poetry
- name: setup python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- name: install deps
run: |
poetry env use "3.10"
poetry install --no-interaction
- name: Install pre-commit
shell: bash
run: poetry run pip install pre-commit
- name: lint and format
run: |
poetry run make lint
25 changes: 25 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Unit Tests
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: get code
uses: actions/checkout@v4
- name: install poetry
run: pipx install poetry
- name: setup python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- name: test
run: |
poetry run make test
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
help: ## Show all Makefile targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}'

format: ## Run code autoformatters (black).
pre-commit install
git ls-files | xargs pre-commit run black --files

lint: ## Run linters: pre-commit (black, ruff, codespell) and mypy
pre-commit install && git ls-files | xargs pre-commit run --show-diff-on-failure --files

test: ## Run tests via pytest
poetry env use "3.10" && poetry install --with dev --quiet --no-interaction && poetry run pytest tests
7 changes: 7 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[mypy]
warn_return_any = True
warn_unused_configs = True
disallow_untyped_defs = True
ignore_missing_imports = True
explicit_package_bases = True
mypy_path = "snowflake_cybersyn_demo"

0 comments on commit a5085fb

Please sign in to comment.