bayesiains / nflows

Normalizing flows in PyTorch
MIT License
845 stars 118 forks source link

Create GitHub workflow for unit test suite #35

Closed MilesCranmer closed 2 years ago

MilesCranmer commented 3 years ago

This PR sets up a GitHub workflow to run the test suite, and will enable the test suite for every new commit without needing to do it on your own machine. It took a few hours to work out some configuration issues but it finally seems to work.

The GitHub action will install a specific version of PyTorch, and then run the test suite in /tests using unittest discover. (FYI github actions are free for public repositories.)

Everything seems to work for PyTorch 1.8, 1.7, and 1.6. However, I have to skip one test for 1.6.

The tests run on ubuntu-latest for Python 3.7. Initially I had it set up for windows and macOS as well, but it turns out that specifying PyTorch versions for a list of operating systems is a bit difficult, so I am leaving it to ubuntu, and just the cpu version.

This workflow will execute on any new commits to master, as well as any pull requests. You can also set up code coverage pretty easily with this, after linking the repo to, e.g., coveralls or codecov.

Cheers, Miles

MilesCranmer commented 3 years ago

Here's an example run for PyTorch 1.8: https://github.com/MilesCranmer/nflows/runs/2054171709?check_suite_focus=true

arturbekasov commented 2 years ago

Cleaning up old PRs: sorry we never got to this one, Miles. I've enabled a simple build/test workflow since.