ci.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. name: CI
  2. on:
  3. pull_request:
  4. push:
  5. branches:
  6. - main
  7. - master
  8. - "releases/*"
  9. permissions:
  10. contents: read
  11. env:
  12. CI: true
  13. jobs:
  14. test:
  15. name: Test
  16. if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
  17. runs-on: ${{ matrix.os }}
  18. strategy:
  19. matrix:
  20. os:
  21. - ubuntu-latest
  22. - macos-latest
  23. - windows-latest
  24. timeout-minutes: 20
  25. steps:
  26. - name: Checkout code
  27. uses: actions/checkout@v4
  28. with:
  29. fetch-depth: 0
  30. - name: Install pnpm
  31. uses: pnpm/action-setup@v4
  32. - name: Use Node.js ${{ matrix.node-version }}
  33. uses: actions/setup-node@v4
  34. with:
  35. node-version: ${{ matrix.node-version }}
  36. cache: "pnpm"
  37. - name: Install dependencies
  38. run: pnpm install
  39. # - name: Check Git version
  40. # run: git --version
  41. # - name: Setup mock Git user
  42. # run: git config --global user.email "you@example.com" && git config --global user.name "Your Name"
  43. - name: Vitest tests
  44. run: pnpm run test
  45. # - name: Upload coverage
  46. # uses: codecov/codecov-action@v4
  47. # with:
  48. # token: ${{ secrets.CODECOV_TOKEN }}
  49. lint:
  50. name: Lint
  51. if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
  52. runs-on: ${{ matrix.os }}
  53. strategy:
  54. matrix:
  55. os:
  56. - ubuntu-latest
  57. - macos-latest
  58. - windows-latest
  59. steps:
  60. - name: Checkout code
  61. uses: actions/checkout@v4
  62. with:
  63. fetch-depth: 0
  64. - name: Install pnpm
  65. uses: pnpm/action-setup@v4
  66. - name: Use Node.js ${{ matrix.node-version }}
  67. uses: actions/setup-node@v4
  68. with:
  69. node-version: ${{ matrix.node-version }}
  70. cache: "pnpm"
  71. - name: Install dependencies
  72. run: pnpm install
  73. - name: Lint
  74. run: pnpm run lint
  75. # check:
  76. # name: Typecheck
  77. # runs-on: ubuntu-latest
  78. # timeout-minutes: 20
  79. # steps:
  80. # - uses: actions/checkout@v4
  81. # - uses: ./.github/actions/ci-setup
  82. # - name: Typecheck
  83. # run: pnpm check:type
  84. ci-ok:
  85. name: CI OK
  86. runs-on: ubuntu-latest
  87. if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]') && always()
  88. # needs: [test, check, lint]
  89. needs: [test, lint]
  90. env:
  91. FAILURE: ${{ contains(join(needs.*.result, ','), 'failure') }}
  92. steps:
  93. - name: Check for failure
  94. run: |
  95. echo $FAILURE
  96. if [ "$FAILURE" = "false" ]; then
  97. exit 0
  98. else
  99. exit 1
  100. fi