diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..1779d39af --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,50 @@ +name: Test + +on: + pull_request: + branches: + - v2 # TODO: Remove! + - development + - main + push: + branches: + - main + - development + + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.12"] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + allow-prereleases: true + + - name: Install package and test dependencies + run: | + # TODO: Once we have expressed dependencies in a more standard way: + # python -m pip install .[test] + python -m pip install . + python -m pip install -r requirements-dev.txt + + - name: Type-check package + run: mypy + + - name: Unit test + # TODO: Test behind EDL + run: pytest icepyx/ --verbose --cov app --ignore=icepyx/tests/test_behind_NSIDC_API_login.py --ignore=icepyx/tests/test_auth.py + + - name: Upload coverage report + uses: codecov/codecov-action@v4.5.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 4f4c0a88c..8748a81d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,6 +61,8 @@ version_file = "_icepyx_version.py" version_file_template = 'version = "{version}"' local_scheme = "node-and-date" fallback_version = "unknown" + + # [tool.ruff.format] # docstring-code-format = true # docstring-code-line-length = "dynamic" @@ -98,3 +100,40 @@ ignore = [ # Ignore too many leading '#' for block comment "*/tests/*" = ["E266"] + + +[tool.mypy] +files = "icepyx/." +mypy_path = ["icepyx"] +# TODO: Enable ASAP: +check_untyped_defs = false +# TODO: Then enable: +disallow_untyped_defs = false +disallow_incomplete_defs = false +# TODO: Finally enable (and delete settings above; strict includes them): +strict = false + +[[tool.mypy.overrides]] +# Help us adopt mypy by skipping some modules entirely +# GOAL: Remove this whole section! +module = [ + "icepyx.core.read", + "icepyx.core.query", + "icepyx.core.visualization", + "icepyx.quest.dataset_scripts.argo", + "icepyx.tests.test_Earthdata", +] +ignore_errors = true + +[[tool.mypy.overrides]] +module = [ + "dask.*", + "datashader.*", + "h5py.*", + "holoviews.*", + "geopandas.*", + "geoviews.*", + "pypistats.*", + "shapely.*", +] +ignore_missing_imports = true diff --git a/requirements-dev.txt b/requirements-dev.txt index 66106dab8..8a11cd9e4 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,3 +3,8 @@ pypistats pytest>=4.6 pytest-cov responses +mypy +pandas-stubs +types-docutils +types-requests +types-tqdm