-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
Add Makefile & Docker for running tests locally #19981
Add Makefile & Docker for running tests locally #19981
Conversation
3ee124a
to
a00cb6f
Compare
Very interesting! I will try this out today. |
a00cb6f
to
fe1bb27
Compare
I have been playing with this PR this morning. You can find a whole discussion on Discord here: https://discordapp.com/channels/461605380783472640/496524752211410952/772558074912571442 This seems to be working really well. It is much easier to use than trying to figure out how to script together tests for local runs on your own. Until now I have still been using a Travis file along with something called What Would Travis Do?! I'm using this on Windows, though so there is one huge caveat. Docker runs in WSL2. WSL2 has terrible performance when accessing files from the "Windows" drive. Each test took about 3 minutes, versus 45 seconds when using WSL1 (with my old method) By moving my Marlin folder into the "Linux" drive it is really fast, about 25 seconds per test. I haven't tried this yet, but here is an article from Microsoft describing how to configure VS Code to use the Windows front-end and WSL2 back-end. That should be able to provide what feels native on Windows, but gives you proper WSL2 performance. |
@costas-basdekis first of all: it's a great PR and it will be a very good addition to Marlin. I would like to ask a few questions: 1 - Why docker? I mean, PIO already setup for us the development environment in our actual platform. This allow us to just run the tests locally, without any VM or Docker. 2 - Why Makefile? The standard user (I think even the most advanced ones) just use PIO to build and test. Maybe we should just update the test scripts to be able to easily run it. Or, even more fun: integrate with VS Code or PIO, to run the tests. 3 - PIO have some support for testing. I never took a look myself. It have support for unit testing, for example. Maybe we should take a look if there anything we can integrate. https://docs.platformio.org/en/latest/plus/unit-testing.html |
* Add Makefile with targets: * For a single or all tets * For CI, local, or docker * Add Dockerfile and docker-compose configuration
fe1bb27
to
3ce8667
Compare
Thanks @rhapsodyv!
In the end, Docker & Makefile have made my (and other teammates') lives very easy, because they standardise and make it easy for newcomers to find their bearings - and I went through a frustrating couple of hours today trying to figure out why Also since Docker is optional, if your local setup is working fine, this should make things easier anyway. Let me know what you think |
I think I like the Docker approach. I've certainly had issues because I was happily using Python 2 until one script in one environment started needing Python 3 features. |
I've just been using my |
I didn't realise that those scripts were there @thinkyhead I'm happy to merge those scripts, or pick only one version. The reason I added the ones I did, is that I wanted to match closely the ones that run on CI, and they seem to be quite simpler than the |
The main advantage of Currently you can run a single test in place using a command like:
|
To do that use `ONLY_TEST=<The description of the test>`
I haven't added this here For example, if you wanted to run make tests-single-local TEST_TARGET=BIGTRE_GTR_V1_0 ONLY_TEST="BigTreeTech GTR 8 Extruders with Auto-Fan and Mixed TMC Drivers" A bit shorter: make tests-single-local TEST_TARGET=BIGTREE_GTR_V1_0 ONLY_TEST="mixed TMC" Which means if you want to test mixed TMC drivers for all tests (which matches 5 tests total) you can do: make tests-all-local ONLY_TEST="mixed TMC" Of course that's still more verbose than |
If we can make the script accept an integer value for " |
I've now added the ability to use the index of the test in a file: make tests-single-local TEST_TARGET=BIGTREE_GTR_V1_0 ONLY_TEST=1 If |
4274255
to
a97a1ae
Compare
* Add Makefile with targets: * For a single or all tets * For CI, local, or docker * Add Dockerfile and docker-compose configuration
To do that use `ONLY_TEST=<The description of the test>`
9c60c82
to
647697c
Compare
647697c
to
77e946e
Compare
@thinkyhead We could be using PlatformIO custom targets and get rid most of the I've done something like that for unit tests in one of my own branches |
Thanks for the merge @thinkyhead ! Let me know if I can support any further in the various scripts we currently employ, perhaps in using PIO to simplify and convert shell scripts & makefile scripts to PIO Python commands |
@costas-basdekis — Any possibility we can move some of the items that were added to the root folder to |
Thanks for the merge! @thinkyhead We could move everything except the Also, if we move the So my suggestion is to move everything except |
Description
Running
make
gives:Benefits
There isn't a very clear way to run all tests locally, and this makes these commands easy to find and run.
Also, since different environments can have different Python versions, etc, a Dockerfile and a docker-compose configuration are provided, to standardise the running, regardless of where are they run
Configurations
No special configurations are necessary
Related Issues
Can't find a related issue