-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create dynamic GitHub Actions matrix to test against PyBaMM #193
Create dynamic GitHub Actions matrix to test against PyBaMM #193
Conversation
Hi, @BradyPlanden – I would appreciate a review even though this is a work-in-progress PR before I add further changes – I am noticing that we have a lower bound on the PyBaMM version in I am currently figuring out a method to include the PyBaMM version in |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #193 +/- ##
========================================
Coverage 94.56% 94.57%
========================================
Files 44 44
Lines 1823 1826 +3
========================================
+ Hits 1724 1727 +3
Misses 99 99 ☔ View full report in Codecov by Sentry. |
I see that #187 is changing up some of the configuration to add GitHub Actions' M1 runners, so I am happy to either wait till that is complete or complete this earlier (there won't be any conflicts though). Also, PyBaMM 24.1 brings Python 3.12 support, does the PyBOP team have plans to add that soon? I ask this because it would limit the matrix configuration here by a bit later on – PyBaMM versions earlier than 24.1 would have to be excluded from the jobs for Python 3.12 in that case owing to the lack of support. |
In the last three commits, I have done exactly what I suggested above, i.e., setting The workflow run on my fork can be accessed here: https://github.com/agriyakhetarpal/PyBOP/actions/runs/7874163448. PyBaMM 23.5, 23.9, and 24.1 are being tested on Linux, macOS, and Windows – with Python versions 3.8–3.11. Edit: I am not sure how to fix the failing tests though since I do not know how PyBOP works, feel free to take this onwards from here! |
Excellent, thanks for the additions @agriyakhetarpal. This looks great. We will need to sort out our failing tests for varying PyBaMM versions, but I think the right move is to pull the three most recent PyBaMM versions to test against. Any more than that and it becomes quite the challenge to maintain.
Yes, I think with PyBaMM supporting 3.12, we should now be able to start testing against 3.12. @martinjrobins, mind taking a look at this one before it's merged? |
Thanks for the review, @BradyPlanden! Does this require a CHANGELOG entry? Also, I'm happy to rebase the changes here depending on if #188 gets merged first |
Yes, please add a changelog entry. Thanks! |
I just glanced at the failing tests for PyBaMM 23.5, here: https://github.com/agriyakhetarpal/PyBOP/actions/runs/7889580638. I think it is coming from the fact that PyBOP tries to load a parameter set as a JSON object from # Check if values is a named parameter set
if isinstance(values, str) and values in pybamm.parameter_sets.keys():
values = pybamm.parameter_sets[values]
values.pop("chemistry", None)
self.update(values, check_already_exists=False)
else:
raise ValueError("Invalid Parameter Value") and therefore PyBaMM 23.5 just ends up loading the following physical constants, without raising a {
"Ideal gas constant [J.K-1.mol-1]": pybamm.constants.R.value,
"Faraday constant [C.mol-1]": pybamm.constants.F.value,
"Boltzmann constant [J.K-1]": pybamm.constants.k_b.value,
"Electron charge [C]": pybamm.constants.q_e.value,
} My recommendation to fix this failing test would be to implement this check in the PyBOP codebase itself too, I can go ahead and make these changes as required in this PR and add another CHANGELOG entry for this. Please let me know what works! |
Thanks for investigating this further @agriyakhetarpal. I believe we had this check implemented previously, but with a pybamm update it became redundant, happy to have it back it to support previous pybamm versions. Let's proceed with adding it to the |
Coverage is already up for this, this is just for PyBaMM 23.5
Addressed in 937aea4 by adding this check inside the function itself (coverage passes both on CodeCov and locally). Scheduled tests with PyBaMM v23.5 are passing here: https://github.com/agriyakhetarpal/PyBOP/actions/runs/7901745176 and this should be good to merge following @martinjrobins's review. BTW, I noticed that PyBOP does not use |
Thanks for sorting this @agriyakhetarpal!
Yes, we did use pytest-xdist (locally) for a while, but the addition of our plotly manager caused problems as the tests became order dependent. I haven't seen an easy way to deal with order dependent tests with xdist, I think you can limit threads to single files, but I believe I still ran into issues. Please open an issue on this and we can proceed, it would be great to have it sorted on the github actions.
That would be great, it's fallen by the wayside, if you want to take a look at the current issue and try to sort it out that would be great. I'm going to go ahead and merge this PR, thanks again. |
@all-contributors add @agriyakhetarpal to code and infrastructure |
I've put up a pull request to add @agriyakhetarpal! 🎉 |
Patch for #193 - Add matrix to M-series runner
Description
This PR adds a helper script that is invoked in the GitHub Actions workflows for the scheduled tests. This will extract the last three versions of PyBaMM from PyPI and test PyBOP against them according to the set CRON schedule.
This PR is currently a work-in-progress:
I have tested this and the script is working: https://github.com/agriyakhetarpal/PyBOP/actions/runs/7863984356
For 3 operating systems, 4 Python versions, and 3 versions of PyBaMM; this shall generate 36 individual jobs. The JSON output is as follows:
Output from running script – displayed as prettified and formatted JSON:
nox
configuration innoxfile.py
Closes #123