ci: update ci

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
This commit is contained in:
Rifa Achrinza 2021-09-26 19:18:04 +08:00
parent 2fb7979f04
commit af3d05478e
7 changed files with 9563 additions and 17 deletions

1
.github/codeql/codeql-config.yaml vendored Normal file
View File

@ -0,0 +1 @@
paths-ignore: [test]

View File

@ -1,4 +1,4 @@
name: Continuous Integration
name: CI
on:
push:
@ -7,21 +7,106 @@ on:
pull_request:
branches:
- master
schedule:
- cron: '0 2 * * 1' # At 02:00 on Monday
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
test:
name: Test
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
node-version: [10, 12, 14]
os: [ubuntu-latest]
node-version: [10, 12, 14, 16]
include:
- os: macos-latest
node_version: 14
- os: windows-latest
node_version: 14
fail-fast: false
steps:
- name: Git checkout
uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Update NPM
if: matrix.os != 'macos-latest'
run: npm install --global npm
- name: Update NPM (macOS)
if: matrix.os == 'macos-latest'
run: npm install --global --force npm
- name: Bootstrap project
run: npm ci --ignore-scripts
- name: Run tests
run: npm test --ignore-scripts
- name: Publish coverage report to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.os }}-node@${{ matrix.node-version }}
path-to-lcov: ${{ github.workspace }}/coverage/lcov.info
parallel: true
- run: npm install
- run: npm test
posttest:
name: Post-Test
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
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
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 --no-install commitlint --from origin/master --to HEAD --verbose
codeql:
name: CodeQL
runs-on: ubuntu-latest
permissions:
# See: https://github.com/github/codeql-action/blob/008b2cc71c4cf3401f45919d8eede44a65b4a322/README.md#usage
security-events: write
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.yaml
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

3
.npmrc
View File

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

View File

@ -1,6 +1,16 @@
sudo: false
branches:
only: master
arch:
- arm64
- ppc64le
- s390x
language: node_js
node_js:
- "10"
- "12"
- "14"
- 10
- 12
- 14
- 16
install:
- npm install --global npm
- npm ci --ignore-scripts
script: npm test --ignore-scripts

18
commitlint.config.js Normal file
View File

@ -0,0 +1,18 @@
// Copyright IBM Corp. 2012,2021. All Rights Reserved.
// Node module: loopback-connector
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
'use strict';
module.exports = {
extends: [
'@commitlint/config-conventional',
],
rules: {
'header-max-length': [2, 'always', 100],
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [0, 'always'],
'signed-off-by': [2, 'always', 'Signed-off-by:'],
},
};

9428
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"posttest": "npm run lint",
"test": "mocha"
"test": "nyc --reporter=lcov mocha"
},
"license": "MIT",
"dependencies": {
@ -32,12 +32,15 @@
"uuid": "^8.3.0"
},
"devDependencies": {
"@commitlint/config-conventional": "^13.1.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"commitlint": "^13.1.0",
"eslint": "^7.7.0",
"eslint-config-loopback": "^13.1.0",
"loopback-datasource-juggler": "^3.32.0",
"mocha": "^8.1.1"
"mocha": "^8.1.1",
"nyc": "^15.1.0"
},
"ci": {
"downstreamIgnoreList": [