Skip to content

Commit b2a551e

Browse files
authored
ci: add commitlint job (#209)
- migrate from circle to github actions - make repo commitizen friendly - drop node 10 support
1 parent 37fdf3b commit b2a551e

File tree

13 files changed

+3779
-5054
lines changed

13 files changed

+3779
-5054
lines changed

.circleci/config.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ jobs:
4040
- codecov/upload:
4141
file: coverage/*.json
4242
- *persist_to_workspace
43-
publish:
44-
executor: daneel
45-
steps:
46-
- *attach_workspace
47-
- checkout
48-
- run: npm run semantic-release
4943

5044
workflows:
5145
build:
@@ -54,10 +48,3 @@ workflows:
5448
filters:
5549
branches:
5650
only: /.*/
57-
- publish:
58-
context: pi
59-
requires:
60-
- build
61-
filters:
62-
branches:
63-
only: master

.commitlintrc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
extends:
2+
- "@commitlint/config-conventional"
3+
rules:
4+
body-max-line-length: [1, "always", 100]

.czrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"path": "cz-conventional-changelog"
3+
}

.github/workflows/ci-cd.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
branches:
8+
- master
9+
10+
jobs:
11+
lint-commits:
12+
if: github.event_name == 'pull_request'
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: 14
23+
cache: "npm"
24+
- run: npm ci --ignore-scripts
25+
- run: npx commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD
26+
27+
build:
28+
runs-on: ubuntu-latest
29+
30+
strategy:
31+
matrix:
32+
# add/remove versions as we move support forward
33+
node-version: [12, 14, 16]
34+
35+
steps:
36+
- uses: actions/checkout@v2
37+
- name: Use Node.js ${{ matrix.node-version }}
38+
uses: actions/setup-node@v2
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
cache: "npm"
42+
- run: npm ci
43+
- run: npm run lint
44+
- run: npm run test:unit
45+
46+
release:
47+
needs: build
48+
49+
# don't run on forks
50+
if: ${{ github.repository_owner == 'SmartThingsCommunity' && github.ref == 'refs/heads/master' }}
51+
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/checkout@v2
56+
- name: Setup Node.js
57+
uses: actions/setup-node@v2
58+
with:
59+
node-version: 14
60+
cache: "npm"
61+
- run: npm ci
62+
- name: Release
63+
env:
64+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
65+
GITHUB_TOKEN: ${{ secrets.PI_GITHUB_TOKEN }}
66+
GIT_AUTHOR_NAME: smartthingspi
67+
GIT_AUTHOR_EMAIL: pi-team@smartthings.com
68+
GIT_COMMITTER_NAME: smartthingspi
69+
GIT_COMMITTER_EMAIL: pi-team@smartthings.com
70+
run: npx semantic-release

.releaserc.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
plugins:
2+
- "@semantic-release/commit-analyzer"
3+
- "@semantic-release/release-notes-generator"
4+
- "@semantic-release/github"
5+
- - "@semantic-release/changelog"
6+
- changelogFile: docs/CHANGELOG.md
7+
- "@semantic-release/npm"
8+
- - "@semantic-release/git"
9+
- assets: ["docs", "package.json"]
10+
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
11+
preset: conventionalcommits

.sgcrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"cSpell.words": [
3+
"commitlint",
4+
"conventionalcommits",
35
"hideable"
46
]
57
}

CONTRIBUTING.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ We're always looking for more opinions on discussions in the issue tracker. It's
3030
- Use a clear and descriptive title for the pull request and commits
3131
- We use [semantic-release](https://www.npmjs.com/package/semantic-release) to automatically generate release
3232
notes, versions and publish releases. This requires commit messages must be formatted properly using
33-
[Angular's git commit guidelines](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines).
34-
- As a convenience, a tool called `semantic-git-commit-cli` is installed in node_modules so you can commit using
35-
`npx sgc` instead of `git commit`. This tool will ask a series of questions and generate a properly-formatted
36-
commit message for you. You can still run `git commit` and format the message properly yourself if you prefer.
33+
[conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/). Our CI will check this and fail any PRs that are formatted incorrectly.
34+
- This repo is [commitizen friendly](https://github.com/commitizen/cz-cli), so you can use the `cz` cli to help create your commits.
3735
- Lint and test before submitting the pull request by running `$ npm test`
3836
- Write a convincing description of why we should land your pull request. Answer _why_ it's needed and provide use-cases.
3937
- Make the pull request from a [topic branch](https://github.com/dchelimsky/rspec/wiki/Topic-Branches) (not master)
40-
- You might be asked to do changes to your pull request. There's never a need to open another pull request – [just update the existing one.](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md)
38+
- You might be asked to do changes to your pull request. There's never a need to open another pull request – [just update the existing one.](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md)
4139

4240
## [Finding contributions to work on](labels/help%20wanted)
4341

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<p align="center">
44
<a href="https://www.npmjs.com/package/@smartthings/smartapp"><img src="https://badgen.net/npm/v/@smartthings/smartapp"/></a>
55
<a href="https://www.npmjs.com/package/@smartthings/smartapp"><img src="https://badgen.net/npm/license/@smartthings/smartapp"/></a>
6-
<a href="https://circleci.com/gh/SmartThingsCommunity/smartapp-sdk-nodejs/tree/master"><img src="https://circleci.com/gh/SmartThingsCommunity/smartapp-sdk-nodejs.svg?style=svg"/></a>
76
<a href="https://codecov.io/gh/SmartThingsCommunity/smartapp-sdk-nodejs"><img src="https://codecov.io/gh/SmartThingsCommunity/smartapp-sdk-nodejs/branch/master/graph/badge.svg"/></a>
87
<a href="https://status.badgen.net/"><img src="https://badgen.net/xo/status/@smartthings/smartapp"/></a>
98
<a href="https://lgtm.com/projects/g/SmartThingsCommunity/smartapp-sdk-nodejs/context:javascript"><img alt="Language grade: JavaScript" src="https://img.shields.io/lgtm/grade/javascript/g/SmartThingsCommunity/smartapp-sdk-nodejs.svg?logo=lgtm&logoWidth=18"/></a>

config/release.config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)