22# vim: ft=yaml
33---
44{%- from tplroot ~ "/libcimatrix.jinja" import format_ci_matrix with context %}
5+ # # Machine config
56dist : {{ travis.dist }}
6- stages :
7- {%- if platforms and not use_cirrus_ci %}
8- - test
9- {%- endif %}
10- - lint
11- - name : release
12- if : branch = master AND type != pull_request
137{%- if platforms and not use_cirrus_ci %}
14-
158sudo : required
16- cache : bundler
17- language : ruby
18-
199services :
2010 - docker
2111{%- set travis_addons = travis.addons %}
@@ -29,59 +19,80 @@ addons:
2919# yamllint enable rule:indentation
3020{%- endif %}
3121
32- # Make sure the instances listed below match up with
33- # the `platforms` defined in `kitchen.yml`
34- {%- if semrel_formula == 'template' %}
35- # NOTE: Please try to select up to six instances that add some meaningful
36- # testing of the formula's behaviour. If possible, try to refrain from
37- # the classical "chosing all the instances because I want to test on
38- # another/all distro/s" trap: it will just add time to the testing (see
39- # the discussion on #121). As an example, the set chosen below covers
40- # the most used distros families, systemd and non-systemd and the latest
41- # three supported Saltstack versions with python2 and 3.
42- # As for `kitchen.yml`, that should still contain all of the platforms,
43- # to allow for comprehensive local testing
44- # Ref: https://github.com/saltstack-formulas/template-formula/issues/118
45- # Ref: https://github.com/saltstack-formulas/template-formula/issues/121
46- {%- endif %}
47- env :
48- matrix :
49- {%- if semrel_formula == 'salt' %}
50- # The ordering used below has been selected based on the time required in Travis
51- # The slower ones are kept as high up as possible, to run concurrently rather than
52- # slow down the entire run at the end (i.e. `centos-6` and `opensuse`)
53- # However, the groupings needed to be maintained in some semblance of order
54- # so this is a best-effort matrix, in the circumstances
55- {%- endif %}
56- {{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula) }}
22+ # # Language and cache config
23+ language : ruby
24+ cache : bundler
5725
26+ # # Script to run for the test stage
5827script :
5928 {%- for pre_cmd in script_kitchen.pre %}
6029 - {{ pre_cmd }}
6130 {%- endfor %}
62- - {{ script_kitchen.bin }} {{ script_kitchen.cmd }} ${INSTANCE}
31+ - {{ script_kitchen.bin }} {{ script_kitchen.cmd }} " ${INSTANCE}"
6332 {%- for post_cmd in script_kitchen.post %}
6433 - {{ post_cmd }}
6534 {%- endfor %}
6635{%- endif %}
6736
37+ # # Stages and jobs matrix
38+ stages :
39+ - test
40+ - name : release
41+ if : branch = master AND type != pull_request
6842jobs :
6943 include :
70- # Define the `lint` stage (runs `yamllint` and `commitlint`)
71- - stage : lint
72- language : node_js
44+ # # Define the test stage that runs the linters (and testing matrix, if applicable)
45+
46+ # Run all of the linters in a single job
47+ - language : node_js
7348 node_js : lts/*
49+ env : ' Lint: salt-lint, yamllint, rubocop & commitlint'
7450 before_install : skip
7551 script :
52+ # Install and run `salt-lint`
53+ - pip install --user salt-lint
54+ - git ls-files | grep '\.sls$\|\.jinja$\|\.j2$\|\.tmpl$'
55+ | xargs -I {} salt-lint {}
7656 # Install and run `yamllint`
7757 # Need at least `v1.17.0` for the `yaml-files` setting
7858 - pip install --user yamllint>=1.17.0
7959 - yamllint -s .
60+ # Install and run `rubocop`
61+ - gem install rubocop
62+ - rubocop -d
8063 # Install and run `commitlint`
8164 - npm install @commitlint/config-conventional -D
8265 - npm install @commitlint/travis-cli -D
8366 - commitlint-travis
84- # Define the release stage that runs `semantic-release`
67+
68+ {%- if platforms and not use_cirrus_ci %}
69+
70+ # # Define the rest of the matrix based on Kitchen testing
71+ # Make sure the instances listed below match up with
72+ # the `platforms` defined in `kitchen.yml`
73+ {%- if semrel_formula == 'template' %}
74+ # NOTE: Please try to select up to six instances that add some meaningful
75+ # testing of the formula's behaviour. If possible, try to refrain from
76+ # the classical "chosing all the instances because I want to test on
77+ # another/all distro/s" trap: it will just add time to the testing (see
78+ # the discussion on #121). As an example, the set chosen below covers
79+ # the most used distros families, systemd and non-systemd and the latest
80+ # three supported Saltstack versions with python2 and 3.
81+ # As for `kitchen.yml`, that should still contain all of the platforms,
82+ # to allow for comprehensive local testing
83+ # Ref: https://github.com/saltstack-formulas/template-formula/issues/118
84+ # Ref: https://github.com/saltstack-formulas/template-formula/issues/121
85+ {%- elif semrel_formula == 'salt' %}
86+ # The ordering used below has been selected based on the time required in Travis
87+ # The slower ones are kept as high up as possible, to run concurrently rather than
88+ # slow down the entire run at the end (i.e. `centos-6` and `opensuse`)
89+ # However, the groupings needed to be maintained in some semblance of order
90+ # so this is a best-effort matrix, in the circumstances
91+ {%- endif %}
92+ {{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, use_new_travis_format=True) }}
93+ {%- endif %}
94+
95+ # # Define the release stage that runs `semantic-release`
8596 - stage : release
8697 language : node_js
8798 node_js : lts/*
0 commit comments