GEUS-Glaciology-and-Climate / pypromice

Process AWS data from L0 (raw logger) through Lx (end user)
https://pypromice.readthedocs.io
GNU General Public License v2.0
12 stars 4 forks source link

Unit testing triggered on PRs #101

Closed PennyHow closed 1 year ago

PennyHow commented 1 year ago

.github/unit_test.yml performs pypromice unit testing on PR and manual triggers, as a Github Action. It should appear as a workflow that is ran on, for example, this pull request. If the workflow fails then the pull request can not be executed until it is successful.

Unit tests are performed with Python 3.8, 3.9 and 3.10 environments to test for cross-compatibility. All unit tests should pass currently.

In the beginning, I had some problems with pypromice.get. It just hasn't been updated in a while and the unit tests were failing, so I updated that.

The other problem I had was with a dependency of xarray for the xr.ffill function. The dependency, bottleneck, was not installed on set up of each of the Python environments. This set up is pretty standard for pypromice, so I am not sure what is going wrong other than it is installing a newer version of xarray that only includes bottleneck as an optional dependency. It just means I have to specify pip install bottleneck outside of the pypromice dependencies in .github/unit_test.yml like so:

      - name: Install dependencies
        shell: bash
        run: |
          python -m pip install --upgrade pip
          pip install Bottleneck
          cd $GITHUB_WORKSPACE
          pip install . 

If this is a problem in future pypromice set-ups then perhaps we will also need to specify bottleneck in the pypromice dependencies here:

https://github.com/GEUS-Glaciology-and-Climate/pypromice/blob/89fe4e44b274a04b775b343e617f2144a375e03c/setup.py#L33

I plan on working on an additional Action next that actually runs pypromice with our actual AWS data. Then we will have two pretty robust tests on pull requests - a basic unit test, and a more thorough test with real data.

PennyHow commented 1 year ago

I've just seen it triggers the checks on push and pull requests, so it's done double work! I'll take out the push trigger and only have it trigger on pull requests.

patrickjwright commented 1 year ago

oh boy, this is exciting