pr_push_checks_node.yaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: Node PR Checks
  2. on:
  3. - pull_request
  4. concurrency:
  5. group: pr-node-${{ github.event.pull_request.number || github.ref }}
  6. cancel-in-progress: true
  7. jobs:
  8. build-npm:
  9. name: Running smoke test npm build
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Checkout code
  13. uses: actions/checkout@v4
  14. with:
  15. fetch-depth: 0
  16. - name: Get changed dashboard files
  17. id: changed-files
  18. uses: tj-actions/changed-files@v35
  19. with:
  20. files: |
  21. dashboard/**
  22. - name: List all changed files
  23. run: |
  24. for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
  25. echo "$file was changed"
  26. done
  27. - name: Setup Node
  28. uses: actions/setup-node@v3
  29. if: steps.changed-files.outputs.any_changed == 'true'
  30. with:
  31. node-version: 16
  32. - name: Setup NPM
  33. if: steps.changed-files.outputs.any_changed == 'true'
  34. working-directory: dashboard
  35. run: |
  36. # installing updated npm
  37. # Verify npm works before capturing and ensure its stderr is inspectable later
  38. version="$(jq -r '.engines.npm' package.json)"
  39. npm --version 2>&1 1>/dev/null
  40. npm_version="$(npm --version)"
  41. echo "Bootstrapping npm $version (replacing $npm_version)..."
  42. npm install --unsafe-perm -g --quiet "npm@$version"
  43. # Verify npm works before capturing and ensure its stderr is inspectable later
  44. npm --version 2>&1 1>/dev/null
  45. echo "npm $(npm --version) installed"
  46. - name: Install NPM Dependencies
  47. if: steps.changed-files.outputs.any_changed == 'true'
  48. working-directory: dashboard
  49. run: |
  50. npm i --legacy-peer-deps
  51. - name: Run NPM Build
  52. if: steps.changed-files.outputs.any_changed == 'true'
  53. working-directory: dashboard
  54. run: |
  55. npm run build