ci: update pipelines

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
This commit is contained in:
Rifa Achrinza 2021-08-28 21:20:40 +08:00
parent cc5557bd11
commit 5aa2d71a23
7 changed files with 9272 additions and 15 deletions

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

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

116
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,116 @@
name: CI
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
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
- os: windows-latest
node-version: 14
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: Update NPM
run: npm install --global npm
- name: Bootstrap project
run: npm ci --ignore-scripts
- name: Build project
run: npm run build
- name: Run tests
run: npm test --ignore-scripts
- name: Generate coverage report
run: npx --no-install nyc report --reporter=lcov
- name: Publish coverage report to Coveralls
uses: coverallsapp/github-action@master
with:
flag-name: run-${{ matrix.os }}-node@${{ matrix.node-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
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
with:
fetch-depth: 0
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14
- name: Update NPM
run: npm install --global npm
- name: Bootstrap project
run: npm ci --ignore-scripts
- name: Build project
run: npm run build
- 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: Update NPM
run: npm install --global npm
- 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
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,8 +1,17 @@
sudo: false branches:
only:
- master
arch:
- arm64
- ppc64le
- s390x
language: node_js language: node_js
before_install: npm install --global npm
script:
- npm run --ignore-scripts build
- npm test --ignore-scripts
node_js: node_js:
- "10" - 10
- "12" - 12
- "14" - 14
- 16
after_success: npm run coverage

21
commitlint.config.js Normal file
View File

@ -0,0 +1,21 @@
// Copyright IBM Corp. 2017,2021. All Rights Reserved.
// Node module: loopback-datasource-juggler
// 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:'],
},
};

9107
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,22 +28,24 @@
"depd": "./lib/browser.depd.js" "depd": "./lib/browser.depd.js"
}, },
"scripts": { "scripts": {
"coverage": "nyc report --reporter=text-lcov | coveralls",
"lint": "eslint .", "lint": "eslint .",
"tsc": "tsc -p tsconfig.json --outDir dist", "build": "npm run build-ts-types",
"build-ts-types": "tsc -p tsconfig.json --outDir dist",
"test": "nyc mocha", "test": "nyc mocha",
"posttest": "npm run tsc && npm run lint" "posttest": "npm run tsc && npm run lint"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^10.0.8", "@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@types/node": "^10.17.60",
"async-iterators": "^0.2.2", "async-iterators": "^0.2.2",
"bson": "^4.0.1", "bson": "^4.0.1",
"coveralls": "^3.0.1", "eslint": "^7.32.0",
"eslint": "^7.11.0", "eslint-config-loopback": "^13.1.0",
"eslint-config-loopback": "^13.0.0", "eslint-plugin-mocha": "^9.0.0",
"loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing", "loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing",
"mocha": "^8.1.3", "mocha": "^8.4.0",
"nyc": "^15.0.0", "nyc": "^15.1.0",
"should": "^13.2.3", "should": "^13.2.3",
"typescript": "^4.0.3" "typescript": "^4.0.3"
}, },