Using a build matrix to reduce code

I’m working on a pull request for the Geany project. Right now, this code from .travis.yml on L8-19 runs 12 different jobs. Is there a way to use a build matrix to reduce the lines of code?