CUNY-CL / udtube

Neural morphological analyzer
Apache License 2.0
3 stars 3 forks source link

Automatic tests/formatting #31

Closed kylebgorman closed 4 weeks ago

kylebgorman commented 3 months ago

We should use standard continuous integration stuff for formatting, tests, installability. I can copy this from my other projects with minimal modifications.

DanielYakubov commented 3 months ago

Can I have a little more context here?

kylebgorman commented 3 months ago

The following continuous integration should run when a PR is created or modified:

  1. Linting with flake8, black (with the latter you can just test whether it would reflow lines), and maybe mypy
  2. Build the package and confirm it could be uploaded to PyPI
  3. Run a suite of pytest unit tests. Since this is going to run on CPU, probably, you want to stick to toy data sets.

Steps 1-2 can be run on arbitrary versions of Python; step 3 should be run separately for each Python version supported and only should fire if steps 1-2 suceed.

In the past in "my lab" we've done this with CircleCI; here's an example of how it's configured.

DanielYakubov commented 2 months ago

Thanks. I'll handle & tap you on the shoulder if anything is needed.

kylebgorman commented 1 month ago

In #54 I automated our tests with CircleCI continuous integration. (The ones we have so far, which just cover the edit script and CoNLL-U modules.) The way this works is as follows:

  1. Using the most recent Python (3.12 now) it checks out the repo and then runs black and flake8 and checks the pyproject.toml metadata by trying to turn it into an uploadable package via twine.
  2. Then, assuming no errors in the previous phase, for each of the supported Python versions, it runs the unit tests.

So now if you add additional unit tests (either with unittest or pytest, it doesn't care) it will run those also when you generate a PR (and on every subsequent commit to that PR).