Adds type hints throughout Hatchet and integrate checks with mypy #681
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: unit tests | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ develop, releases/** ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# TODO: add macos-latest | |
# TODO: change ubuntu-20.04 back to ubuntu-latest when the following issue is resolved: | |
# https://github.com/actions/setup-python/issues/162 | |
os: [ubuntu-20.04] | |
# TODO: add pypy2, pypy3 | |
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python3 dependencies | |
run: | | |
python -m pip install --upgrade pip pytest | |
pip install -r requirements.txt | |
# Optional Dependency for HDF Checkpointing | |
pip install tables | |
python setup.py install | |
python setup.py build_ext --inplace | |
python -m pip list | |
- name: Update Black | |
if: ${{ matrix.python-version == 3.9 }} | |
run: | | |
pip install flake8-pytest-importorskip | |
pip install --upgrade click==8.0.4 | |
pip install black==24.4.2 | |
pip install flake8==4.0.1 | |
- name: Lint and Format Check with Flake8 and Black | |
if: ${{ matrix.python-version == 3.9 }} | |
run: | | |
black --diff --check . | |
flake8 | |
- name: Check License Headers | |
run: | | |
python license.py verify | |
- name: Install coverage tools | |
run: | | |
pip install codecov | |
pip install pytest-cov | |
- name: Clone Caliper | |
uses: actions/checkout@v4 | |
with: | |
repository: LLNL/Caliper | |
path: Caliper | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Caliper | |
working-directory: Caliper | |
run: | | |
echo -e "PWD: $(pwd)" | |
mkdir build && mkdir install | |
cd build | |
cmake -DCMAKE_INSTALL_PREFIX=../install ../ | |
make VERBOSE=1 | |
make install | |
export PATH=$(pwd)/../install/bin:${PATH} | |
echo -e "PATH=${PATH}" | |
cd $GITHUB_WORKSPACE | |
echo -e "PWD:${PWD}" | |
which cali-query | |
# - name: Build Timemory for Python 3.6 | |
# if: ${{ matrix.python-version == 3.6 }} | |
# run: | | |
# python -m pip install --upgrade scikit-build | |
# # python -m pip install --upgrade --no-cache-dir --no-deps -v --pre timemory --install-option=--disable-{c,gotcha,tools} | |
# python -m pip install --upgrade --no-cache-dir --no-deps -v timemory==3.2.0.dev4 --install-option=--disable-{c,gotcha,tools} | |
- name: Test Caliper and Timemory Support with pytest | |
run: | | |
PYTHONPATH=. $(which pytest) --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.HATCHET_CODECOV_TOKEN }} | |
with: | |
directory: ./coverage/reports | |
env_vars: OS,PYTHON | |
files: /home/runner/work/hatchet/hatchet/coverage.xml | |
flags: unittests | |
verbose: true | |
fail_ci_if_error: true |