ci.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. name: 'ci'
  2. on:
  3. push:
  4. branches:
  5. - '**'
  6. pull_request:
  7. branches:
  8. - main
  9. - minor
  10. permissions:
  11. contents: read # to fetch code (actions/checkout)
  12. jobs:
  13. unit-test:
  14. runs-on: ubuntu-latest
  15. if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
  16. env:
  17. PUPPETEER_SKIP_DOWNLOAD: 'true'
  18. steps:
  19. - uses: actions/checkout@v4
  20. - name: Install pnpm
  21. uses: pnpm/action-setup@v4.0.0
  22. - name: Install Node.js
  23. uses: actions/setup-node@v4
  24. with:
  25. node-version-file: '.node-version'
  26. cache: 'pnpm'
  27. - run: pnpm install
  28. - name: Run unit tests
  29. run: pnpm run test-unit
  30. unit-test-windows:
  31. runs-on: windows-latest
  32. if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
  33. env:
  34. PUPPETEER_SKIP_DOWNLOAD: 'true'
  35. steps:
  36. - uses: actions/checkout@v4
  37. - name: Install pnpm
  38. uses: pnpm/action-setup@v4.0.0
  39. - name: Install Node.js
  40. uses: actions/setup-node@v4
  41. with:
  42. node-version-file: '.node-version'
  43. cache: 'pnpm'
  44. - run: pnpm install
  45. - name: Run compiler unit tests
  46. run: pnpm run test-unit compiler
  47. - name: Run ssr unit tests
  48. run: pnpm run test-unit server-renderer
  49. e2e-test:
  50. runs-on: ubuntu-latest
  51. if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
  52. steps:
  53. - uses: actions/checkout@v4
  54. - name: Setup cache for Chromium binary
  55. uses: actions/cache@v4
  56. with:
  57. path: ~/.cache/puppeteer
  58. key: chromium-${{ hashFiles('pnpm-lock.yaml') }}
  59. - name: Install pnpm
  60. uses: pnpm/action-setup@v4.0.0
  61. - name: Install Node.js
  62. uses: actions/setup-node@v4
  63. with:
  64. node-version-file: '.node-version'
  65. cache: 'pnpm'
  66. - run: pnpm install
  67. - run: node node_modules/puppeteer/install.mjs
  68. - name: Run e2e tests
  69. run: pnpm run test-e2e
  70. - name: verify treeshaking
  71. run: node scripts/verify-treeshaking.js
  72. lint-and-test-dts:
  73. runs-on: ubuntu-latest
  74. if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
  75. env:
  76. PUPPETEER_SKIP_DOWNLOAD: 'true'
  77. steps:
  78. - uses: actions/checkout@v4
  79. - name: Install pnpm
  80. uses: pnpm/action-setup@v4.0.0
  81. - name: Install Node.js
  82. uses: actions/setup-node@v4
  83. with:
  84. node-version-file: '.node-version'
  85. cache: 'pnpm'
  86. - run: pnpm install
  87. - name: Run eslint
  88. run: pnpm run lint
  89. - name: Run prettier
  90. run: pnpm run format-check
  91. - name: Run type declaration tests
  92. run: pnpm run test-dts
  93. # benchmarks:
  94. # runs-on: ubuntu-latest
  95. # if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
  96. # env:
  97. # PUPPETEER_SKIP_DOWNLOAD: 'true'
  98. # steps:
  99. # - uses: actions/checkout@v4
  100. # - name: Install pnpm
  101. # uses: pnpm/action-setup@v3.0.0
  102. # - name: Install Node.js
  103. # uses: actions/setup-node@v4
  104. # with:
  105. # node-version-file: '.node-version'
  106. # cache: 'pnpm'
  107. # - run: pnpm install
  108. # - name: Run benchmarks
  109. # uses: CodSpeedHQ/action@v2
  110. # with:
  111. # run: pnpm vitest bench --run
  112. # token: ${{ secrets.CODSPEED_TOKEN }}