From 40611647735e1ece8f6ed21f2fab04b71bb4e112 Mon Sep 17 00:00:00 2001 From: erexer <13180883+erexer@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:34:19 -0700 Subject: [PATCH] run tests on all supported python versions, add codecov badge, python versions badge --- .github/workflows/build.yml | 35 ---------------------- .github/workflows/test.yml | 59 +++++++++++++++++++++++++++++++++++++ README.md | 11 ++++--- 3 files changed, 66 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index ebe4fc3..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: build - -on: [push] - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - - env: - OS: ${{ matrix.os }} - PYTHON: '3.9' - - steps: - - - uses: actions/checkout@v1 - - - name: Set up Python - uses: actions/setup-python@master - with: - python-version: 3.9 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - - - name: Test and generate coverage report - run: | - pip install pytest - pip install pytest-cov - pytest --cov=./ --cov-report=xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..afd16ed --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,59 @@ +name: test + +on: + push: + branches: # on all branches except `typos` + - '**' + - '!typos' + paths-ignore: + - 'docs/**' + - 'notebooks/**' + - 'paper/**' + - '.git*' + - 'README.md' + pull_request: + branches: + - '**' + schedule: # Every Monday at 07:00 UTC, 00:00 PT + - cron: '0 7 * * 1' + +jobs: + build: + strategy: + matrix: + python-version: [ "3.9", "3.10" ] + os: [ubuntu-latest] + fail-fast: false + + name: Python ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@master + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install . + + - name: Test and generate coverage report + run: | + pip install pytest + pip install pytest-cov + pytest --cov=./ --cov-report=xml + + - uses: codecov/codecov-action@v4 + with: + files: ./coverage.xml # optional + name: codecov-umbrella # optional + token: ${{ secrets.CODECOV_TOKEN }} # required + + - name: Notify on failure + if: failure() # This step will only run if any previous step fails + run: | + echo "Build or tests failed. Please check the logs." diff --git a/README.md b/README.md index 7915a03..fdd24e0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -[![build](https://github.com/IMMM-SFA/tell/actions/workflows/build.yml/badge.svg)](https://github.com/IMMM-SFA/tell/actions/workflows/build.yml) [![DOI](https://zenodo.org/badge/305802399.svg)](https://zenodo.org/badge/latestdoi/305802399) +[![test](https://github.com/IMMM-SFA/tell/actions/workflows/test.yml/badge.svg)](https://github.com/IMMM-SFA/tell/actions/workflows/test.yml) +[![DOI](https://zenodo.org/badge/305802399.svg)](https://zenodo.org/badge/latestdoi/305802399) +[![codecov](https://codecov.io/gh/IMMM-SFA/tell/graph/badge.svg?token=URP1KWRI6U)](https://codecov.io/gh/IMMM-SFA/tell) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tell?pypiBaseUrl=https%3A%2F%2Fpypi.org&logo=python&logoColor=yellow) ## tell @@ -17,7 +20,7 @@ ### Install `tell` `tell` is available via GitHub repository by using the pip install functionality. `tell` requires a Python version between 3.8 and 4.0 as well as a pip install to import the package. `tell` has been tested on -Windows and Mac platforms. (Note: For those installing on Windows, `tell` is supported by GeoPandas functionality. Please see suggestions for installing GeoPandas on Windows here: +Windows and Mac platforms. (Note: For those installing on Windows, `tell` is supported by GeoPandas functionality. Please see suggestions for installing GeoPandas on Windows here: https://geopandas.org/en/stable/getting_started/install.html) ```bash @@ -34,7 +37,7 @@ New to `tell`? Get familiar with what `tell` is all about in our [Getting Start ### User guide -Our [User Guide](https://immm-sfa.github.io/tell/user_guide.html) provides in-depth information on the key concepts of `tell` and how the model works. +Our [User Guide](https://immm-sfa.github.io/tell/user_guide.html) provides in-depth information on the key concepts of `tell` and how the model works. ### Contributing to `tell` @@ -44,4 +47,4 @@ Whether you find a typo in the documentation, find a bug, or want to develop fun The [API Reference](https://immm-sfa.github.io/tell/modules.html) contains a detailed description of the `tell` API. The reference describes how the methods work and which parameters can be used. It assumes that you have an understanding of the key concepts. ### Contact/Help -Need help with `tell` or have a comment? Please open a [new Issue](https://github.com/IMMM-SFA/tell/issues/new/choose) with your question/comments. +Need help with `tell` or have a comment? Please open a [new Issue](https://github.com/IMMM-SFA/tell/issues/new/choose) with your question/comments.