pr.yaml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: pull-request
  2. on:
  3. pull_request:
  4. branches: [ main ]
  5. push:
  6. branches: [ main ]
  7. jobs:
  8. test:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@v2
  12. - uses: actions/setup-node@v2
  13. with:
  14. node-version: 'lts/*'
  15. cache: 'npm'
  16. - name: Cache Node modules
  17. uses: actions/cache@v3
  18. id: npm-cache
  19. with:
  20. path: ~/.npm
  21. key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
  22. restore-keys: |
  23. ${{ runner.os }}-node-
  24. - name: Install dependencies
  25. run: |
  26. npm install
  27. sudo npx playwright install-deps
  28. - name: Lint
  29. run: npm run lint
  30. - name: Test
  31. run: npm test
  32. - name: Benchmark
  33. run: npm run benchmark | tee benchmark.txt
  34. - name: Download previous benchmark data
  35. uses: actions/cache@v3
  36. with:
  37. path: ./cache
  38. key: ${{ runner.os }}-benchmark
  39. - name: Store benchmark result
  40. uses: benchmark-action/github-action-benchmark@v1
  41. with:
  42. tool: 'benchmarkjs'
  43. output-file-path: benchmark.txt
  44. external-data-json-path: ./cache/benchmark-data.json
  45. github-token: ${{ secrets.GITHUB_TOKEN }}
  46. alert-threshold: '150%'
  47. comment-on-alert: true
  48. fail-on-alert: true
  49. alert-comment-cc-users: '@Stuk'