test.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. name: 'test'
  2. on: workflow_call
  3. permissions:
  4. contents: read # to fetch code (actions/checkout)
  5. jobs:
  6. unit-test:
  7. runs-on: ubuntu-latest
  8. env:
  9. PUPPETEER_SKIP_DOWNLOAD: 'true'
  10. steps:
  11. - uses: actions/checkout@v6
  12. - name: Install pnpm
  13. uses: pnpm/action-setup@v4.2.0
  14. - name: Install Node.js
  15. uses: actions/setup-node@v6
  16. with:
  17. node-version-file: '.node-version'
  18. cache: 'pnpm'
  19. - run: pnpm install
  20. - name: Run unit tests
  21. run: pnpm run test-unit
  22. unit-test-windows:
  23. runs-on: windows-latest
  24. env:
  25. PUPPETEER_SKIP_DOWNLOAD: 'true'
  26. steps:
  27. - uses: actions/checkout@v6
  28. - name: Install pnpm
  29. uses: pnpm/action-setup@v4.2.0
  30. - name: Install Node.js
  31. uses: actions/setup-node@v6
  32. with:
  33. node-version-file: '.node-version'
  34. cache: 'pnpm'
  35. - run: pnpm install
  36. - name: Run compiler unit tests
  37. run: pnpm run test-unit compiler
  38. - name: Run ssr unit tests
  39. run: pnpm run test-unit server-renderer
  40. e2e-test:
  41. runs-on: ubuntu-latest
  42. steps:
  43. - uses: actions/checkout@v6
  44. - name: Setup cache for Chromium binary
  45. uses: actions/cache@v5
  46. with:
  47. path: ~/.cache/puppeteer
  48. key: chromium-${{ hashFiles('pnpm-lock.yaml') }}
  49. - name: Install pnpm
  50. uses: pnpm/action-setup@v4.2.0
  51. - name: Install Node.js
  52. uses: actions/setup-node@v6
  53. with:
  54. node-version-file: '.node-version'
  55. cache: 'pnpm'
  56. - run: pnpm install
  57. - run: node node_modules/puppeteer/install.mjs
  58. - name: Run e2e tests
  59. run: pnpm run test-e2e
  60. - name: verify treeshaking
  61. run: node scripts/verify-treeshaking.js
  62. lint-and-test-dts:
  63. runs-on: ubuntu-latest
  64. env:
  65. PUPPETEER_SKIP_DOWNLOAD: 'true'
  66. steps:
  67. - uses: actions/checkout@v6
  68. - name: Install pnpm
  69. uses: pnpm/action-setup@v4.2.0
  70. - name: Install Node.js
  71. uses: actions/setup-node@v6
  72. with:
  73. node-version-file: '.node-version'
  74. cache: 'pnpm'
  75. - run: pnpm install
  76. - name: Run eslint
  77. run: pnpm run lint
  78. - name: Run prettier
  79. run: pnpm run format-check
  80. - name: Run tsc
  81. run: pnpm run check
  82. - name: Run type declaration tests
  83. run: pnpm run test-dts