Skip to content

Commit 5aa2d71

Browse files
committed
ci: update pipelines
Signed-off-by: Rifa Achrinza <[email protected]>
1 parent cc5557b commit 5aa2d71

File tree

7 files changed

+9272
-15
lines changed

7 files changed

+9272
-15
lines changed

.github/codeql/codeql-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
paths-ignore: [test]

.github/workflows/ci.yaml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [master]
9+
schedule:
10+
- cron: '0 2 * * 1' # At 02:00 on Monday
11+
12+
jobs:
13+
test:
14+
name: Test
15+
timeout-minutes: 15
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest]
19+
node-version: [10, 12, 14, 16]
20+
include:
21+
- os: macos-latest
22+
node-version: 14
23+
- os: windows-latest
24+
node-version: 14
25+
fail-fast: false
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- uses: actions/checkout@v2
29+
with:
30+
fetch-depth: 0
31+
- name: Use Node.js ${{ matrix.node-version }}
32+
uses: actions/setup-node@v2
33+
with:
34+
node-version: ${{ matrix.node-version }}
35+
- name: Update NPM
36+
run: npm install --global npm
37+
- name: Bootstrap project
38+
run: npm ci --ignore-scripts
39+
- name: Build project
40+
run: npm run build
41+
- name: Run tests
42+
run: npm test --ignore-scripts
43+
- name: Generate coverage report
44+
run: npx --no-install nyc report --reporter=lcov
45+
- name: Publish coverage report to Coveralls
46+
uses: coverallsapp/github-action@master
47+
with:
48+
flag-name: run-${{ matrix.os }}-node@${{ matrix.node-version }}
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
parallel: true
51+
52+
posttest:
53+
name: Post-Test
54+
needs: test
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Coveralls finished
58+
uses: coverallsapp/github-action@master
59+
with:
60+
github-token: ${{ secrets.github_token }}
61+
parallel-finished: true
62+
63+
code-lint:
64+
name: Code Lint
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v2
68+
with:
69+
fetch-depth: 0
70+
- name: Use Node.js 14
71+
uses: actions/setup-node@v2
72+
with:
73+
node-version: 14
74+
- name: Update NPM
75+
run: npm install --global npm
76+
- name: Bootstrap project
77+
run: npm ci --ignore-scripts
78+
- name: Build project
79+
run: npm run build
80+
- name: Verify code linting
81+
run: npm run lint
82+
83+
commit-lint:
84+
name: Commit Lint
85+
runs-on: ubuntu-latest
86+
if: ${{ github.event.pull_request }}
87+
steps:
88+
- uses: actions/checkout@v2
89+
with:
90+
fetch-depth: 0
91+
- name: Use Node.js 14
92+
uses: actions/setup-node@v2
93+
with:
94+
node-version: 14
95+
- name: Update NPM
96+
run: npm install --global npm
97+
- name: Bootstrap project
98+
run: npm ci --ignore-scripts
99+
- name: Verify commit linting
100+
run: npx --no-install commitlint --from origin/master --to HEAD --verbose
101+
102+
codeql:
103+
name: CodeQL
104+
runs-on: ubuntu-latest
105+
steps:
106+
- name: Checkout repository
107+
uses: actions/checkout@v2
108+
109+
- name: Initialize CodeQL
110+
uses: github/codeql-action/init@v1
111+
with:
112+
languages: 'javascript'
113+
config-file: ./.github/codeql/codeql-config.yaml
114+
115+
- name: Perform CodeQL Analysis
116+
uses: github/codeql-action/analyze@v1

.npmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
package-lock=false
1+
package-lock=true
2+
scripts-prepend-node-path=true

.travis.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
sudo: false
1+
branches:
2+
only:
3+
- master
4+
arch:
5+
- arm64
6+
- ppc64le
7+
- s390x
28
language: node_js
9+
before_install: npm install --global npm
10+
script:
11+
- npm run --ignore-scripts build
12+
- npm test --ignore-scripts
313
node_js:
4-
- "10"
5-
- "12"
6-
- "14"
7-
8-
after_success: npm run coverage
14+
- 10
15+
- 12
16+
- 14
17+
- 16

commitlint.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright IBM Corp. 2017,2021. All Rights Reserved.
2+
// Node module: loopback-datasource-juggler
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+
const isCI = process.env.CI;
9+
module.exports = {
10+
extends: [
11+
'@commitlint/config-conventional',
12+
],
13+
rules: {
14+
'header-max-length': [2, 'always', 100],
15+
'body-leading-blank': [2, 'always'],
16+
'footer-leading-blank': [0, 'always'],
17+
// Only enforce the rule if CI flag is not set. This is useful for release
18+
// commits to skip DCO
19+
'signed-off-by': [isCI ? 0 : 2, 'always', 'Signed-off-by:'],
20+
},
21+
};

0 commit comments

Comments
 (0)