unit-test.yml 787 B

123456789101112131415161718192021222324252627282930313233
  1. name: Unit Tests
  2. on: [pull_request, push]
  3. jobs:
  4. prepare_matrix:
  5. runs-on: ubuntu-latest
  6. outputs:
  7. versions: ${{ steps.generate-matrix.outputs.lts }}
  8. steps:
  9. - name: Select all current LTS versions of Node.js
  10. id: generate-matrix
  11. uses: msimerson/node-lts-versions@v1
  12. test:
  13. needs:
  14. - prepare_matrix
  15. strategy:
  16. matrix:
  17. node-version: ${{ fromJSON(needs.prepare_matrix.outputs.versions) }}
  18. runs-on: macos-latest
  19. steps:
  20. - uses: actions/checkout@v3
  21. - uses: actions/setup-node@v3
  22. with:
  23. node-version: ${{ matrix.node-version }}
  24. - run: npm install --no-package-lock
  25. name: Install dev dependencies
  26. - run: npm run lint
  27. name: Run linter
  28. - run: npm run test
  29. name: Run unit tests