osl-incubator / makim

Make Improved
https://osl-incubator.github.io/makim/
BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

Add matrix strategy for targets #81

Open xmnlab opened 8 months ago

xmnlab commented 8 months ago

In some cases we would like to run a same command for multiples parameters. Currently it is possible using a "for loop" (in bash, or xonsh, etc) or using jinja2 "for loop".

it would be nice to do that using a matrix strategy, similar to what github actions does (for a entire job).

Example:

version: 1.0.0
groups:
  main:
    env-file: .env
    targets:
      print:
        help: print the values from a matrix strategy
        matrix:
          mytext: 
            - text1
            - text2
            - text3
        run: echo {{ matrix.mytext }}

when the command makim main.print is executed, it will run "echo" for each value in mytext list. if more variables is defined in the matrix, it will run the run section for all the combination of variables. the values for each variable in the matrix, should be a list