Skip to content

Commit 06d1ada

Browse files
authored
chore: add GitHub Actions (#21)
Signed-off-by: Diana Lau <[email protected]>
1 parent 16fab0e commit 06d1ada

File tree

5 files changed

+15778
-1
lines changed

5 files changed

+15778
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
15+
node-version: [12, 14, 16]
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- run: npm install
23+
- run: npm test
24+
code-lint:
25+
name: Code Lint
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 60
28+
steps:
29+
- uses: actions/checkout@v2
30+
- name: Use Node.js 14
31+
uses: actions/setup-node@v2
32+
with:
33+
node-version: 14
34+
- name: Bootstrap project
35+
run: |
36+
npm ci --ignore-scripts
37+
- name: Verify code linting
38+
run: npm run lint
39+
40+
commit-lint:
41+
name: Commit Lint
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 60
44+
steps:
45+
- uses: actions/checkout@v2
46+
with:
47+
fetch-depth: 0
48+
- name: Use Node.js 14
49+
uses: actions/setup-node@v2
50+
with:
51+
node-version: 14
52+
- name: Bootstrap project
53+
run: |
54+
npm ci --ignore-scripts
55+
- name: Verify commit linting
56+
run: npx commitlint --from origin/master --to HEAD --verbose

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=true

commitlint.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright IBM Corp. 2017,2021. All Rights Reserved.
2+
// Node module: loopback-connector-openapi
3+
// This file is licensed under the MIT License.
4+
// License text available at https://opensource.org/licenses/MIT
5+
'use strict';
6+
7+
const isCI = process.env.CI;
8+
module.exports = {
9+
extends: [
10+
'@commitlint/config-conventional',
11+
],
12+
rules: {
13+
'header-max-length': [2, 'always', 100],
14+
'body-leading-blank': [2, 'always'],
15+
'footer-leading-blank': [0, 'always'],
16+
// Only enforce the rule if CI flag is not set. This is useful for release
17+
// commits to skip DCO
18+
'signed-off-by': [isCI ? 0 : 2, 'always', 'Signed-off-by:'],
19+
},
20+
};

0 commit comments

Comments
 (0)