Skip to content

Commit

Permalink
CI: add task typecheck that runs pytype
Browse files Browse the repository at this point in the history
  • Loading branch information
johnyf committed Dec 9, 2023
1 parent 84e9343 commit 07cb1a7
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,41 @@ jobs:
pushd examples/
python _test_examples.py
popd
typecheck:
name: Static analysis of Python code
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [
'3.10',
]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Prepare typechecking environment
run: |
./.github/workflows/setup_typecheck_env.sh
- name: Statically analyze `dd`
run: |
pytype -k \
dd/*.py \
-x dd/__init__.py
- name: Statically analyze setup files
run: |
pip install -U \
cython \
gitpython
pytype -k \
setup.py \
install.py \
# download.py
- name: Statically analyze `examples/`
run: |
pip uninstall -y dd
python install.py --yes \
--ignore-requires-python
pytype -k \
examples/*.py
25 changes: 25 additions & 0 deletions .github/workflows/setup_typecheck_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash


# Prepare for typechecking.


set -x
set -e
# upgrade build dependencies
pip install \
--ignore-installed \
--upgrade \
pip \
setuptools \
wheel
# install `dd` dependencies
python setup.py sdist
pip install \
--ignore-requires-python \
dist/dd-*.tar.gz
pip uninstall --yes dd
# install typechecking tools
pip install \
--upgrade \
pytype

0 comments on commit 07cb1a7

Please sign in to comment.