ci.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. steps:
  16. - uses: actions/checkout@v3
  17. - name: Install pnpm
  18. uses: pnpm/action-setup@v2
  19. - name: Set node version to 18
  20. uses: actions/setup-node@v3
  21. with:
  22. node-version: 18
  23. cache: 'pnpm'
  24. - run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
  25. - name: Run unit tests
  26. run: pnpm run test-unit
  27. e2e-test:
  28. runs-on: ubuntu-latest
  29. if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
  30. steps:
  31. - uses: actions/checkout@v3
  32. - name: Setup cache for Chromium binary
  33. uses: actions/cache@v3
  34. with:
  35. path: ~/.cache/puppeteer/chrome
  36. key: chromium-${{ hashFiles('pnpm-lock.yaml') }}
  37. - name: Install pnpm
  38. uses: pnpm/action-setup@v2
  39. - name: Set node version to 18
  40. uses: actions/setup-node@v3
  41. with:
  42. node-version: 18
  43. cache: 'pnpm'
  44. - run: pnpm install
  45. - name: Run e2e tests
  46. run: pnpm run test-e2e
  47. lint-and-test-dts:
  48. runs-on: ubuntu-latest
  49. if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
  50. steps:
  51. - uses: actions/checkout@v3
  52. - name: Install pnpm
  53. uses: pnpm/action-setup@v2
  54. - name: Set node version to 18
  55. uses: actions/setup-node@v3
  56. with:
  57. node-version: 18
  58. cache: 'pnpm'
  59. - run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
  60. - name: Run eslint
  61. run: pnpm run lint
  62. # - name: Run prettier
  63. # run: pnpm run format-check
  64. - name: Run type declaration tests
  65. run: pnpm run test-dts
  66. size:
  67. runs-on: ubuntu-latest
  68. if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
  69. env:
  70. CI_JOB_NUMBER: 1
  71. steps:
  72. - uses: actions/checkout@v3
  73. - name: Install pnpm
  74. uses: pnpm/action-setup@v2
  75. - name: Set node version to 18
  76. uses: actions/setup-node@v3
  77. with:
  78. node-version: 18
  79. cache: 'pnpm'
  80. - run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
  81. - run: pnpm run size