ci.yml 3.4 KB

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