rschmukler/agenda

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Run Test
on: [push, pull_request, workflow_dispatch]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14, 16, 18]
        mongodb-version: [3.6, 4.4, 5.0, 6.0]
    steps:
      - name: Git checkout
        uses: actions/checkout@v2

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

      - name: Start MongoDB
        uses: supercharge/mongodb-github-action@1.6.0
        with:
          mongodb-version: ${{ matrix.mongodb-version }}

      - name: Cache node modules
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          # npm cache files are stored in `~/.npm` on Linux/macOS
          path: ~/.npm
          key: ${{ runner.os }}-build-agenda-${{ hashFiles('**/package-lock.lock') }}
          restore-keys: |
            ${{ runner.os }}-build-agenda-

      - name: Update npm
        run: npm -g install npm@latest

      - name: Install Packages
        run: npm install

      - name: Run Lint
        run: npm run lint

      - name: Build
        run: npm run build
        env:
          CI: true

      - name: Test
        run: npm run test
        env:
          CI: true