I do have a Python project using TravisCI with a build matrix resulting in 4 jobs.
I do run linters in my unit tests, no matter that this is unusual I like it.
The point is that running linters 4 times on the same code is waste of resources (free credits from TravisCI) and CO2.
How can I run the linter just one time. Where to specify that in my .travis.yml?
To have the linter only run once, you can simplify the lint job to:
- name: "lint"
- pip install pylint
- python -m pylint common qt
pylint on the
qt code, no need for tests. This by design will run
pylint once before the build matrix, without rerunning linting for every build job as you’ve stated that this is the problem you’re having in the OP.
The build matrix jobs can stay focused on running tests and coverage for the different Python versions.
I recommend caching
pylint between builds to speed it up and run linting on pull requests only to reduce overhead. This can be done with simple branch conditionals.
That is not an option because then I have to run the CI. But the linter do run in my own local environment as a unit tests.
In the end I think I will separate the tests in several categories to selectively run them.
The second option would be yes; rewrite backintime/.travis.yml at dev · bit-team/backintime · GitHub in stages and have a separate linter stage defined.