Skip to content

Commit

Permalink
chore: add and configure husky and conventional-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dbouwman committed Feb 16, 2022
1 parent 1ea7437 commit a2be371
Show file tree
Hide file tree
Showing 4 changed files with 42,574 additions and 28,741 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build, Test, Release

# On pushes to master (i.e. merging a PR)
# run all tests, on win, macos, linux, on node 12 & 14
on:
push:
branches:
# UMCOMMENT BEFORE WE MERGE BETA -> MASTER
# - master -
- beta
# Dont run if it's just markdown or doc files
paths-ignore:
- "**.md"
- "docs/**"

jobs:
# First, build and test on multiple os's
# and multuple versions of node
build_and_test:
name: Build and Test

runs-on: ${{ matrix.os }}

# PRs will run tests on node 14,16 on ubuntu, macos and windows
# so for the release, we're just running node 16@ubuntu
strategy:
matrix:
os: [ubuntu-latest]
node: [16]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Install
run: npm ci

- name: Build
run: npm run build

- name: Test in Chrome
run: npm run test:chrome:ci

- name: Test in Node
run: npm run test:node

- uses: codecov/codecov-action@v1
with:
directory: ./coverage

# If the build and test works, run a release
release:
name: Release
needs: [build_and_test]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.13

- name: Install
run: npm ci

- name: Build
run: npm run build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run release
40 changes: 40 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@


const Configuration = {
/*
* Resolve and load @commitlint/config-conventional from node_modules.
* Referenced packages must be installed
*/
extends: ['@commitlint/config-lerna-scopes', '@commitlint/config-conventional'],
/*
* Resolve and load conventional-changelog-atom from node_modules.
* Referenced packages must be installed
*/
// parserPreset: 'conventional-changelog-atom',
/*
* Resolve and load @commitlint/format from node_modules.
* Referenced package must be installed
*/
formatter: '@commitlint/format',
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {
'type-enum': [2, 'always', ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']],
},
/*
* Functions that return true if commitlint should ignore the given message.
*/
ignores: [
// empty commit messages
(commit) => commit === '',
// pr feedback
(commit) => /^PR:/i.test(commit)
],
/*
* Whether commitlint uses the default ignore rules.
*/
defaultIgnores: true,
};

module.exports = Configuration;
Loading

0 comments on commit a2be371

Please sign in to comment.