chore: enable mypy; actions cleanup (#21)

* chore: eenable mypy

* chore: Update MyPy command in typecheck.yml workflow

* fix caching. makefile lint improvements

* chore: Fix sed command in typecheck.yml workflow

* chore: Update sed command in typecheck.yml workflow

* chore: Update Python version to 3.10 in typecheck.yml workflow

* remove pretty

* pipefail
This commit is contained in:
Daniel Chalef 2024-08-22 15:10:24 -07:00 committed by GitHub
parent 1f1652f56c
commit c90b4e01ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 70 additions and 30 deletions

43
.github/workflows/typecheck.yml vendored Normal file
View file

@ -0,0 +1,43 @@
name: MyPy Type Check
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
mypy:
runs-on: depot-ubuntu-22.04
environment: development
steps:
- uses: actions/checkout@v4
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.0
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --with dev
- name: Run MyPy
shell: bash
run: |
set -o pipefail
poetry run mypy . --show-column-numbers --show-error-codes | sed -E '
s/^(.*):([0-9]+):([0-9]+): (error|warning): (.+) \[(.+)\]/::error file=\1,line=\2,endLine=\2,col=\3,title=\6::\5/;
s/^(.*):([0-9]+):([0-9]+): note: (.+)/::notice file=\1,line=\2,endLine=\2,col=\3,title=Note::\4/;
'

View file

@ -2,9 +2,9 @@ name: Unit Tests
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
jobs:
test:
@ -12,30 +12,26 @@ jobs:
environment:
name: development
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Load cached Poetry installation
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Run non-integration tests
env:
PYTHONPATH: ${{ github.workspace }}
run: |
poetry run pytest -m "not integration"
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Load cached Poetry installation
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Run non-integration tests
env:
PYTHONPATH: ${{ github.workspace }}
run: |
poetry run pytest -m "not integration"

View file

@ -22,7 +22,8 @@ format:
# Lint code
lint:
$(RUFF) check
# $(MYPY) .
$(MYPY) --install-types --non-interactive .
$(MYPY) . --show-column-numbers --show-error-codes --pretty
# Run tests
test: