Skip to content

Commit 455190f

Browse files
authored
Merge pull request python-quantities#219 from apdavison/mypy-ci
Add type checking with mypy to CI
2 parents 4b6d3ef + b470064 commit 455190f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,48 @@ jobs:
6767
run: |
6868
PY_IGNORE_IMPORTMISMATCH=1 pytest
6969
python -m doctest README.rst
70+
71+
type-check:
72+
runs-on: ${{ matrix.os }}
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
os: [ ubuntu-latest ]
77+
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
78+
numpy-version: [ "1.22", "1.23", "1.24" ]
79+
steps:
80+
- uses: actions/checkout@v2
81+
82+
- name: Set up Python ${{ matrix.python-version }}
83+
uses: actions/setup-python@v2
84+
with:
85+
python-version: ${{ matrix.python-version }}
86+
87+
- name: Get pip cache dir
88+
id: pip-cache
89+
run: |
90+
echo "::set-output name=dir::$(pip cache dir)"
91+
92+
- name: Cache
93+
uses: actions/cache@v2
94+
with:
95+
path: ${{ steps.pip-cache.outputs.dir }}
96+
key:
97+
${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.numpy-version }}-v1-${{ hashFiles('**/setup.py') }}
98+
restore-keys: |
99+
${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.numpy-version }}-v1-
100+
101+
- name: Install dependencies
102+
run: |
103+
python -m pip install -U pip
104+
python -m pip install -U wheel
105+
python -m pip install "numpy==${{ matrix.numpy-version }}"
106+
python -m pip install -U mypy
107+
108+
- name: Install
109+
run: |
110+
pip install .
111+
112+
- name: Check type information
113+
run: |
114+
mypy quantities

0 commit comments

Comments
 (0)