Home > Mobile >  Running GitHub build tests locally
Running GitHub build tests locally

Time:04-11

I'm a newbie, I'm afraid, and have newbie questions.

I have used python for simple scripts and automation for a while, but am challenging myself to go deeper by contributing to some open source projects on GitHub.

It's been fun, but also nerve-wracking to make dumb mistakes in such a public environment.

Sometimes one of my changes causes an error that is caught by one of the automated tests that the GitHub project runs when a PR is submitted. I'd like to catch those myself, if possible, before submitting the PR. Is there a way for me to run the same build tests locally on my own machine?

Any other best practice suggestions for doing open-source contributions without asking for too much time/help from maintainers is also appreciated.

CodePudding user response:

Act works most of the time but is a bit limited on the types of images it can use.

I really feel you on this one, would be nice if there were tools for this :/

CodePudding user response:

Running the entire build locally doesn't really make sense. Especially not for just the tests.

Github and most open source repositories have a contribution guidelines. Github especially has CONTRIBUTING.md to allow repo owners demonstrate how to contribute.

For example:

  • CPython has a testing section on their readme.
  • Django has a contributing section and how to run the test suite in their readme.

Most proper open source projects would have explanations on how to run tests/builds locally.

Do not, however feel ashamed over something like broken tests. This is what version control systems are for. Make 10 mistakes, fix the bug/add the feature, make 20 mistakes afterwards. You can just make typos and fix them in the next commit. It doesn't matter. Just rebase your branch after you added what you needed to add and you are good to go. Making mistakes is nothing to be ashamed especially since we have tools to fix those mistakes easily.


Why not act?

Act is OK. It is a nice tool that I myself use. But you don't need to run entire workflow just for tests when you can run tests without it, and it is not really a small tool.

The problem with act is that it is only for github actions, which is only one of the many CI tools.

Travis, CircleCI, Jenkins, ...

It's better to just read the project you are contributing to and follow their guidelines.

  • Related