jeffy-g/rm-cstyle-cmts

View on GitHub
.github/workflows/nodejs.yml

Summary

Maintainability
Test Coverage
# This workflow will do a clean install of node dependencies, 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 ]

jobs:
  build:

    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        node-version: [18.x, 20.x]
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
    - name: checkout
      uses: actions/checkout@v4
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}

    - name: Cache node modules
      id: cache-node
      uses: actions/cache@v4
      with:
        path: |
          ~/cache
          !~/cache/exclude
          **/node_modules
        key: node-${{ hashFiles('**/yarn.lock') }}
        restore-keys: |
          node-

    - name: check cache
      if: steps.cache-node.outputs.cache-hit != 'true'
      run: yarn install

    - name: lint, build
      run: |
        echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        echo '                   lint -> build'
        echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        npm run all

    - name: Run benchmark
      run: |
        echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        echo '                   run benchmark'
        echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        npm run bench
        npm run benchmark

    - name: Run tests
      run: |
        echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        echo '                     run tests'
        echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        npm run test