feat: update CI pipeline

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
This commit is contained in:
Rifa Achrinza 2021-07-22 13:07:51 +08:00
parent f37080c9dc
commit b8f45c99cb
No known key found for this signature in database
GPG Key ID: 20BEC73FE57F7CF2
8 changed files with 6105 additions and 14 deletions

2
.github/codeql/codeql-config.yml vendored Normal file
View File

@ -0,0 +1,2 @@
paths-ignore:
- '**/test/**'

28
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: "CodeQL"
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 13 * * 6'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: 'javascript'
config-file: ./.github/codeql/codeql-config.yml
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -0,0 +1,74 @@
name: Continuous Integration
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 2 * * 1' # At 02:00 on Monday
env:
NODE_OPTIONS: --max-old-space-size=4096
jobs:
test:
name: Test
timeout-minutes: 15
strategy:
matrix:
os: [ubuntu-latest]
node-version: [10, 12, 14, 16]
include:
- os: macos-latest
node-version: 14 # LTS
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Bootstrap project
run: |
npm ci --ignore-scripts
- uses: Yuri6037/Action-FakeTTY@v1.1
- name: Run tests
run: faketty npm test --ignore-scripts
code-lint:
name: Code Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14
- name: Bootstrap project
run: |
npm ci --ignore-scripts
- name: Verify code linting
run: npm run lint
commit-lint:
name: Commit Lint
runs-on: ubuntu-latest
if: ${{ github.event.pull_request }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14
- name: Bootstrap project
run: |
npm ci --ignore-scripts
- name: Verify commit linting
run: npx commitlint --from origin/master --to HEAD --verbose

3
.npmrc
View File

@ -1 +1,2 @@
package-lock=false
package-lock=true
scripts-prepend-node-path=true

View File

@ -1,6 +1,6 @@
sudo: false
arch:
- ppc64le
- s390x
- arm64
language: node_js
node_js:
- "10"
- "12"
- "14"
node_js: [10, 12, 14, 16]

20
commitlint.config.js Normal file
View File

@ -0,0 +1,20 @@
// Copyright IBM Corp. 2017,2018. All Rights Reserved.
// Node module: loopback-next
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
'use strict';
const isCI = process.env.CI;
module.exports = {
extends: [
'@commitlint/config-conventional',
],
rules: {
'header-max-length': [2, 'always', 100],
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [0, 'always'],
// Only enforce the rule if CI flag is not set. This is useful for release
// commits to skip DCO
'signed-off-by': [isCI ? 0 : 2, 'always', 'Signed-off-by:'],
},
};

5970
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,6 @@
"posttest": "npm run lint"
},
"dependencies": {
"@types/express": "^4.16.0",
"accepts": "^1.3.3",
"debug": "^4.1.1",
"ejs": "^3.1.3",
@ -27,20 +26,17 @@
"strong-globalize": "^6.0.1"
},
"devDependencies": {
"@commitlint/config-conventional": "^12.1.4",
"@types/express": "^4.17.13",
"chai": "^4.1.2",
"eslint": "^7.0.0",
"eslint-config-loopback": "^13.1.0",
"express": "^4.16.3",
"mocha": "^7.1.2",
"supertest": "^4.0.2"
"mocha": "^9.0.2",
"supertest": "^6.1.4"
},
"browser": {
"strong-error-handler": false
},
"ci": {
"downstreamIgnoreList": [
"dashboard-controller"
]
},
"author": "IBM Corp."
}