mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
83 lines
2.4 KiB
YAML
83 lines
2.4 KiB
YAML
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
|
|
name: Node.js CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master" ]
|
|
pull_request:
|
|
branches: [ "master" ]
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]
|
|
node-version: [8.x, 10.x, 12.x, 14.x, 16.x, 18.x]
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
include:
|
|
- node-version: 8.x
|
|
npm-i: "eslint@6.x eslint-config-airbnb-base@14.x eslint-config-prettier@6.x eslint-plugin-prettier@3.x fs-extra@8.x nyc@14.x tap@14.x"
|
|
|
|
- node-version: 10.x
|
|
npm-i: "eslint@7.x fs-extra@9.x nyc@14.x tap@14.x"
|
|
|
|
- node-version: 12.x
|
|
npm-i: "fs-extra@10.x nyc@14.x tap@14.x"
|
|
|
|
- node-version: 14.x
|
|
npm-i: "nyc@14.x tap@14.x"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
|
|
- name: Configure npm
|
|
run: npm config set loglevel error
|
|
|
|
- name: Get npm version
|
|
id: npm-version
|
|
run: |
|
|
npm -v
|
|
npmMajorVer=$(npm -v | cut -d. -f1)
|
|
echo "major=$npmMajorVer" >> $GITHUB_OUTPUT
|
|
|
|
- name: Disable prettier on older Node.js (8.x, 10.x, 12.x)
|
|
run: |
|
|
sed -i '/"prettier": "prettier/d' package.json
|
|
if: contains(fromJson('["8.x", "10.x", "12.x"]'), matrix.node-version)
|
|
|
|
- name: Install downgraded modules ${{ matrix.npm-i }}
|
|
run: |
|
|
npm install --save-dev ${{ matrix.npm-i }}
|
|
if [ ${{ steps.npm-version.outputs.major }} -le 5 ]; then
|
|
npm install
|
|
fi
|
|
if: matrix.npm-i != ''
|
|
|
|
- run: npm install
|
|
if: matrix.npm-i == '' && steps.npm-version.outputs.major <= 5
|
|
|
|
- run: npm ci
|
|
if: matrix.npm-i == '' && steps.npm-version.outputs.major > 5
|
|
|
|
- name: List dependencies
|
|
run: npm ls --depth=0 --dev && npm ls --depth=0 --prod
|
|
|
|
- run: npm run build --if-present
|
|
- run: npm test
|
|
- run: npm run typings
|