Skip to content

Commit 2f3b60a

Browse files
committed
chore: add CI - commit and code linting
Signed-off-by: dhmlau <dhmlau@ca.ibm.com>
1 parent f96e589 commit 2f3b60a

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
schedule:
9+
- cron: '0 2 * * 1' # At 02:00 on Monday
10+
11+
permissions: {}
12+
13+
env:
14+
NODE_OPTIONS: --max-old-space-size=4096
15+
16+
jobs:
17+
test:
18+
name: Test
19+
timeout-minutes: 30
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest]
23+
node-version: [20, 22, 24]
24+
include:
25+
- os: windows-latest
26+
node-version: 22 # LTS
27+
- os: macos-latest
28+
node-version: 22 # LTS
29+
fail-fast: false
30+
runs-on: ${{ matrix.os }}
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Use Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
- run: npm install
38+
- name: Run test
39+
run: npm test --ignore-scripts
40+
41+
code-lint:
42+
name: Code Lint
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: actions/setup-node@v4
47+
with:
48+
node-version: 22 # LTS
49+
- run: npm ci --ignore-scripts
50+
- name: Verify code linting
51+
run: npx --no eslint .
52+
53+
commit-lint:
54+
name: Commit Lint
55+
runs-on: ubuntu-latest
56+
if: ${{ github.event.pull_request }}
57+
steps:
58+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
with:
60+
fetch-depth: 0
61+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
62+
with:
63+
node-version: 22 # LTS
64+
- name: Install dependencies
65+
run: npm install
66+
- name: Verify commit linting
67+
run: npx commitlint --from origin/master --to HEAD --verbose

commitlint.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright IBM Corp. and LoopBack contributors 2025. All Rights Reserved.
2+
// Node module: loopback-connector-postgresql
3+
// This file is licensed under the MIT License.
4+
// License text available at https://opensource.org/licenses/MIT
5+
6+
'use strict';
7+
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+
'signed-off-by': [2, 'always', 'Signed-off-by:'],
17+
},
18+
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
"eslint-config-loopback": "^11.0.0",
3232
"jscs": "^3.0.7",
3333
"loopback-datasource-juggler": "^3.23.0",
34-
"mocha": "^5.2.0"
34+
"mocha": "^5.2.0",
35+
"@commitlint/cli": "^19.0.0",
36+
"@commitlint/config-conventional": "^19.0.0"
3537
},
3638
"repository": {
3739
"type": "git",

0 commit comments

Comments
 (0)