ci.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. name: CI
  2. on:
  3. push:
  4. branches: [main, master]
  5. pull_request:
  6. concurrency:
  7. group: ${{ github.workflow }}-${{ github.ref }}
  8. cancel-in-progress: true
  9. permissions:
  10. contents: read
  11. env:
  12. PRIMARY_NODE_VERSION: '24'
  13. jobs:
  14. node-24:
  15. runs-on: ubuntu-latest
  16. name: node 24 / ${{ matrix.lane }}
  17. env:
  18. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  19. DSH_PUBLINT_CONCURRENCY: ${{ matrix.publint_concurrency }}
  20. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.coverage_max_workers }}
  21. DSH_ESLINT_CACHE: ${{ matrix.eslint_cache }}
  22. strategy:
  23. fail-fast: false
  24. matrix:
  25. include:
  26. - lane: static
  27. command: pnpm run check:ci:static
  28. gate_concurrency: '4'
  29. publint_concurrency: '8'
  30. coverage_max_workers: ''
  31. eslint_cache: ''
  32. - lane: lint
  33. command: pnpm run check:ci:lint
  34. gate_concurrency: '1'
  35. publint_concurrency: '8'
  36. coverage_max_workers: ''
  37. eslint_cache: '1'
  38. - lane: coverage
  39. command: pnpm run check:ci:coverage
  40. gate_concurrency: '1'
  41. publint_concurrency: '8'
  42. coverage_max_workers: '4'
  43. eslint_cache: ''
  44. - lane: snapshot
  45. command: pnpm run check:ci:snapshot
  46. gate_concurrency: '1'
  47. publint_concurrency: '8'
  48. coverage_max_workers: ''
  49. eslint_cache: ''
  50. - lane: artifacts
  51. command: pnpm run check:ci:artifacts
  52. gate_concurrency: '3'
  53. publint_concurrency: '8'
  54. coverage_max_workers: ''
  55. eslint_cache: ''
  56. steps:
  57. - uses: actions/checkout@v6
  58. - uses: actions/setup-node@v6
  59. with:
  60. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  61. - name: Enable corepack (pnpm)
  62. run: corepack enable
  63. - name: Resolve pnpm store path
  64. id: pnpm-store
  65. run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  66. - uses: actions/cache@v4
  67. with:
  68. path: ${{ steps.pnpm-store.outputs.path }}
  69. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  70. restore-keys: |
  71. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  72. - name: Install (immutable)
  73. run: pnpm install --frozen-lockfile
  74. - uses: actions/cache@v4
  75. if: matrix.lane == 'lint'
  76. with:
  77. path: .cache/eslint
  78. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  79. restore-keys: |
  80. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-
  81. - name: Run gates
  82. run: ${{ matrix.command }}
  83. node-compat:
  84. runs-on: ubuntu-latest
  85. name: node ${{ matrix.node }}
  86. env:
  87. DSH_GATE_CONCURRENCY: '2'
  88. strategy:
  89. fail-fast: false
  90. matrix:
  91. node: ['22.19', 24, 26]
  92. steps:
  93. - uses: actions/checkout@v6
  94. - uses: actions/setup-node@v6
  95. with:
  96. node-version: ${{ matrix.node }}
  97. - name: Enable corepack (pnpm)
  98. run: corepack enable
  99. - name: Resolve pnpm store path
  100. id: pnpm-store
  101. run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  102. - uses: actions/cache@v4
  103. with:
  104. path: ${{ steps.pnpm-store.outputs.path }}
  105. key: ${{ runner.os }}-node-${{ matrix.node }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  106. restore-keys: |
  107. ${{ runner.os }}-node-${{ matrix.node }}-pnpm-
  108. - name: Install (immutable)
  109. run: pnpm install --frozen-lockfile
  110. - name: Run compatibility gates
  111. run: pnpm run check:node-compat
  112. # Single stable required check for branch protection: require "all checks
  113. # passed" instead of enumerating matrix legs whose names change as lanes and
  114. # node versions evolve. Every other job in THIS workflow must be listed in
  115. # `needs` (`needs` cannot reach across workflow files; e2e.yml stays its own
  116. # check). `if: always()` is load-bearing: without it a failed dependency
  117. # would SKIP this job, and GitHub counts a skipped required check as passing
  118. # — so this job always runs and fails on any non-success result, including
  119. # 'cancelled' and 'skipped'.
  120. all-checks-passed:
  121. name: all checks passed
  122. runs-on: ubuntu-latest
  123. needs: [node-24, node-compat]
  124. if: always()
  125. steps:
  126. - name: Fail if any needed job did not succeed
  127. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  128. run: |
  129. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  130. exit 1
  131. - name: All checks passed
  132. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"