Skip to content

Commit c7263c5

Browse files
committed
ci(travis): fix travis matrix, minor style fixes
1 parent a4fe96e commit c7263c5

8 files changed

+272
-12
lines changed

.travis.yml

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,88 @@
1+
stages:
2+
- test
3+
- commitlint
4+
- name: release
5+
if: branch = master AND type != pull_request
6+
17
sudo: required
28
cache: bundler
39
language: ruby
410

511
services:
612
- docker
713

8-
before_install:
9-
- bundle install
10-
14+
# Make sure the instances listed below match up with
15+
# the `platforms` defined in `kitchen.yml`
16+
# NOTE: Please try to select up to six instances that add some meaningful
17+
# testing of the formula's behaviour. If possible, try to refrain from
18+
# the classical "chosing all the instances because I want to test on
19+
# another/all distro/s" trap: it will just add time to the testing (see
20+
# the discussion on #121). As an example, the set chosen below covers
21+
# the most used distros families, systemd and non-systemd and the latest
22+
# three supported Saltstack versions with python2 and 3."
23+
# As for `kitchen.yml`, that should still contain all of the platforms,
24+
# to allow for comprehensive local testing
25+
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118
26+
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121
1127
env:
1228
matrix:
13-
- INSTANCE: deb-debian-9
14-
- INSTANCE: ubu16-ubuntu-1604
15-
- INSTANCE: ubu18-ubuntu-1804
16-
- INSTANCE: rpm-centos-7
17-
- INSTANCE: fed-fedora
18-
- INSTANCE: sus-opensuse-leap-salt-minion
29+
- INSTANCE: deb-debian-9-develop-py3
30+
# - INSTANCE: default-ubuntu-1804-develop-py3
31+
# - INSTANCE: default-centos-7-develop-py3
32+
# - INSTANCE: default-fedora-29-develop-py3
33+
# - INSTANCE: default-opensuse-leap-15-develop-py3
34+
# - INSTANCE: default-debian-9-2019-2-py3
35+
- INSTANCE: deb-ubuntu-1804-2019-2-py3
36+
- INSTANCE: rpm-centos-7-2019-2-py3
37+
# - INSTANCE: default-fedora-29-2019-2-py3
38+
# - INSTANCE: default-opensuse-leap-15-2019-2-py3
39+
# - INSTANCE: default-debian-9-2018-3-py2
40+
# - INSTANCE: default-ubuntu-1604-2018-3-py2
41+
# - INSTANCE: default-centos-7-2018-3-py2
42+
- INSTANCE: rpm-fedora-29-2018-3-py2
43+
# TODO: Use this when fixed instead of `opensuse-leap-42`
44+
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
45+
# - INSTANCE: default-opensuse-leap-15-2018-3-py2
46+
- INSTANCE: rpm-opensuse-leap-42-2018-3-py2
47+
# - INSTANCE: default-debian-8-2017-7-py2
48+
# - INSTANCE: default-ubuntu-1604-2017-7-py2
49+
# TODO: Enable after improving the formula to work with other than `systemd`
50+
- INSTANCE: rpm-centos-6-2017-7-py2
51+
# - INSTANCE: default-fedora-28-2017-7-py2
52+
# - INSTANCE: default-opensuse-leap-42-2017-7-py2
1953

2054
script:
2155
- bundle exec kitchen verify ${INSTANCE}
56+
57+
jobs:
58+
include:
59+
# Define the commitlint stage
60+
- stage: commitlint
61+
language: node_js
62+
node_js: lts/*
63+
before_install: skip
64+
script:
65+
- npm install @commitlint/config-conventional -D
66+
- npm install @commitlint/travis-cli -D
67+
- commitlint-travis
68+
# Define the release stage that runs semantic-release
69+
- stage: release
70+
language: node_js
71+
node_js: lts/*
72+
before_install: skip
73+
script:
74+
# Update `AUTHORS.md`
75+
- export MAINTAINER_TOKEN=${GH_TOKEN}
76+
- go get github.com/myii/maintainer
77+
- maintainer contributor
78+
79+
# Install all dependencies required for `semantic-release`
80+
- npm install @semantic-release/changelog@3 -D
81+
- npm install @semantic-release/exec@3 -D
82+
- npm install @semantic-release/git@7 -D
83+
deploy:
84+
provider: script
85+
skip_cleanup: true
86+
script:
87+
# Run `semantic-release`
88+
- npx semantic-release@15

FORMULA

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: apt
1+
name: packages
22
os: Debian, Ubuntu, Raspbian
33
os_family: Debian
44
version: 0.8.1
55
release: 1
66
minimum_version: 2017.7
7-
summary: Packages formula
7+
summary: packages formula
88
description: Simple formula to install different types of packages
99
top_level_dir: packages

docs/CONTRIBUTING.rst

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
.. _contributing:
2+
3+
How to contribute
4+
=================
5+
6+
This document will eventually outline all aspects of guidance to make your contributing experience a fruitful and enjoyable one.
7+
What it already contains is information about *commit message formatting* and how that directly affects the numerous automated processes that are used for this repo.
8+
It also covers how to contribute to this *formula's documentation*.
9+
10+
.. contents:: **Table of Contents**
11+
12+
Overview
13+
--------
14+
15+
Submitting a pull request is more than just code!
16+
To achieve a quality product, the *tests* and *documentation* need to be updated as well.
17+
An excellent pull request will include these in the changes, wherever relevant.
18+
19+
Commit message formatting
20+
-------------------------
21+
22+
Since every type of change requires making Git commits,
23+
we will start by covering the importance of ensuring that all of your commit
24+
messages are in the correct format.
25+
26+
Automation of multiple processes
27+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
29+
This formula uses `semantic-release <https://github.com/semantic-release/semantic-release>`_ for automating numerous processes such as bumping the version number appropriately, creating new tags/releases and updating the changelog.
30+
The entire process relies on the structure of commit messages to determine the version bump, which is then used for the rest of the automation.
31+
32+
Full details are available in the upstream docs regarding the `Angular Commit Message Conventions <https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines>`_.
33+
The key factor is that the first line of the commit message must follow this format:
34+
35+
.. code-block::
36+
37+
type(scope): subject
38+
39+
40+
* E.g. ``docs(contributing): add commit message formatting instructions``.
41+
42+
Besides the version bump, the changelog and release notes are formatted accordingly.
43+
So based on the example above:
44+
45+
..
46+
47+
.. raw:: html
48+
49+
<h3>Documentation</h3>
50+
51+
* **contributing:** add commit message formatting instructions
52+
53+
54+
* The ``type`` translates into a ``Documentation`` sub-heading.
55+
* The ``(scope):`` will be shown in bold text without the brackets.
56+
* The ``subject`` follows the ``scope`` as standard text.
57+
58+
Linting commit messages in Travis CI
59+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
This formula uses `commitlint <https://github.com/conventional-changelog/commitlint>`_ for checking commit messages during CI testing.
62+
This ensures that they are in accordance with the ``semantic-release`` settings.
63+
64+
For more details about the default settings, refer back to the ``commitlint`` `reference rules <https://conventional-changelog.github.io/commitlint/#/reference-rules>`_.
65+
66+
Relationship between commit type and version bump
67+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68+
69+
This formula applies some customisations to the defaults, as outlined in the table below,
70+
based upon the `type <https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#type>`_ of the commit:
71+
72+
.. list-table::
73+
:name: commit-type-vs-version-bump
74+
:header-rows: 1
75+
:stub-columns: 0
76+
:widths: 1,2,3,1,1
77+
78+
* - Type
79+
- Heading
80+
- Description
81+
- Bump (default)
82+
- Bump (custom)
83+
* - ``build``
84+
- Build System
85+
- Changes related to the build system
86+
- –
87+
-
88+
* - ``chore``
89+
- –
90+
- Changes to the build process or auxiliary tools and libraries such as
91+
documentation generation
92+
- –
93+
-
94+
* - ``ci``
95+
- Continuous Integration
96+
- Changes to the continuous integration configuration
97+
- –
98+
-
99+
* - ``docs``
100+
- Documentation
101+
- Documentation only changes
102+
- –
103+
- 0.0.1
104+
* - ``feat``
105+
- Features
106+
- A new feature
107+
- 0.1.0
108+
-
109+
* - ``fix``
110+
- Bug Fixes
111+
- A bug fix
112+
- 0.0.1
113+
-
114+
* - ``perf``
115+
- Performance Improvements
116+
- A code change that improves performance
117+
- 0.0.1
118+
-
119+
* - ``refactor``
120+
- Code Refactoring
121+
- A code change that neither fixes a bug nor adds a feature
122+
- –
123+
- 0.0.1
124+
* - ``revert``
125+
- Reverts
126+
- A commit used to revert a previous commit
127+
- –
128+
- 0.0.1
129+
* - ``style``
130+
- Styles
131+
- Changes that do not affect the meaning of the code (white-space,
132+
formatting, missing semi-colons, etc.)
133+
- –
134+
- 0.0.1
135+
* - ``test``
136+
- Tests
137+
- Adding missing or correcting existing tests
138+
- –
139+
- 0.0.1
140+
141+
Use ``BREAKING CHANGE`` to trigger a ``major`` version change
142+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143+
144+
Adding ``BREAKING CHANGE`` to the footer of the extended description of the commit message will **always** trigger a ``major`` version change, no matter which type has been used.
145+
This will be appended to the changelog and release notes as well.
146+
To preserve good formatting of these notes, the following format is prescribed:
147+
148+
* ``BREAKING CHANGE: <explanation in paragraph format>.``
149+
150+
An example of that:
151+
152+
.. code-block:: git
153+
154+
...
155+
156+
BREAKING CHANGE: With the removal of all of the `.sls` files under
157+
`packages package`, this formula no longer supports the installation of
158+
packages.

packages/defaults.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=yaml
3+
---
34
packages:
45
tmpdir: /tmp/saltstack-packages-formula-archives
56
remote_pkgs: {}

packages/osfamilymap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=yaml
3+
---
34
Suse:
45
pips:
56
required:

packages/osmap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
Fedora:
25
pkgs:
36
required:

pillar.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ packages:
3232
- libpython2.7-dev
3333
- python-pip
3434
wanted:
35-
- dxpy
35+
- shuft
3636
- attrs
3737
unwanted:
3838
- campbel

pre-commit_semantic-release.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
###############################################################################
4+
# (A) Update `FORMULA` with `${nextRelease.version}`
5+
###############################################################################
6+
sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA
7+
8+
9+
###############################################################################
10+
# (B) Use `m2r` to convert automatically produced `.md` docs to `.rst`
11+
###############################################################################
12+
13+
# Install `m2r`
14+
sudo -H pip install m2r
15+
16+
# Copy and then convert the `.md` docs
17+
cp *.md docs/
18+
cd docs/
19+
m2r --overwrite *.md
20+
21+
# Change excess `H1` headings to `H2` in converted `CHANGELOG.rst`
22+
sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst
23+
sed -i -e '1,4s/-/=/g' CHANGELOG.rst
24+
25+
# Use for debugging output, when required
26+
# cat AUTHORS.rst
27+
# cat CHANGELOG.rst
28+
29+
# Return back to the main directory
30+
cd ..

0 commit comments

Comments
 (0)