Merge pull request #169 from log4js-node/dependabot/npm_and_yarn/babe… #261
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: "[email protected] [email protected]" | |
- node-version: 10.x | |
npm-i: "[email protected] [email protected]" | |
- node-version: 12.x | |
npm-i: "[email protected]" | |
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: 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 |