ci: update envirnoment

see: https://github.com/loopbackio/cicd/issues/2
see: https://github.com/loopbackio/cicd/issues/6
see: https://github.com/loopbackio/cicd/issues/4

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
This commit is contained in:
Rifa Achrinza 2021-12-08 12:53:42 +08:00
parent 24654b5016
commit bfed6a0257
3 changed files with 33 additions and 29 deletions

View File

@ -20,35 +20,28 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
node-version: [10, 12, 14, 16] node-version: [10, 12, 14, 16, 17]
include: include:
- os: macos-latest - os: macos-latest
node_version: 14 node_version: 16
- os: windows-latest - os: windows-latest
node_version: 14 node_version: 16
fail-fast: false fail-fast: false
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }} 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 - name: Bootstrap project
run: npm ci --ignore-scripts run: npm ci --ignore-scripts
- name: Run tests - name: Run tests
run: npm test --ignore-scripts run: npm run-script test:ci
- name: Publish coverage report to Coveralls - name: Publish coverage report to Coveralls
uses: coverallsapp/github-action@master uses: coverallsapp/github-action@master
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.os }}-node@${{ matrix.node-version }} flag-name: run-${{ matrix.os }}-node@${{ matrix.node-version }}
path-to-lcov: ${{ github.workspace }}/coverage/lcov.info
parallel: true parallel: true
posttest: posttest:
@ -66,11 +59,11 @@ jobs:
name: Code Lint name: Code Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Use Node.js 14 - name: Use Node.js 16
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 14 node-version: 16
- name: Bootstrap project - name: Bootstrap project
run: npm ci --ignore-scripts run: npm ci --ignore-scripts
- name: Verify code linting - name: Verify code linting
@ -80,17 +73,25 @@ jobs:
name: Commit Lint name: Commit Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Use Node.js 14 - name: Use Node.js 16
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 14 node-version: 16
- name: Bootstrap project - name: Bootstrap project
run: npm ci --ignore-scripts run: npm ci --ignore-scripts
- name: Verify commit linting - name: Verify commit linting
run: npx --no-install commitlint --from origin/master --to HEAD --verbose run: |
npx \
--no-install \
--package=@commitlint/cli \
-- \
commitlint \
--from=origin/master \
--to=HEAD \
--verbose
codeql: codeql:
name: CodeQL name: CodeQL
@ -100,7 +101,7 @@ jobs:
security-events: write security-events: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v1 uses: github/codeql-action/init@v1

View File

@ -1,16 +1,18 @@
branches: branches:
only: master only:
- master
arch: arch:
- arm64 - arm64
- ppc64le - ppc64le
- s390x - s390x
os: linux
dist: bionic
language: node_js language: node_js
node_js: node_js:
- 10 - 10
- 12 - 12
- 14 - 14
- 16 - 16
install: - 17
- npm install --global npm install: npm ci --ignore-scripts
- npm ci --ignore-scripts script: npm run-script test:ci
script: npm test --ignore-scripts

View File

@ -20,7 +20,8 @@
"lint": "eslint .", "lint": "eslint .",
"lint:fix": "eslint . --fix", "lint:fix": "eslint . --fix",
"posttest": "npm run lint", "posttest": "npm run lint",
"test": "nyc --reporter=lcov mocha" "test": "npm run test:ci",
"test:ci": "nyc --reporter=lcov mocha"
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {