test.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. name: test
  2. on:
  3. push:
  4. branches:
  5. - dev
  6. - v2
  7. pull_request:
  8. workflow_dispatch:
  9. concurrency:
  10. # Keep every run on dev so cancelled checks do not pollute the default branch
  11. # commit history. PRs and other branches still share a group and cancel stale runs.
  12. group: ${{ case(github.ref == 'refs/heads/dev', format('{0}-{1}', github.workflow, github.run_id), format('{0}-{1}', github.workflow, github.event.pull_request.number || github.ref)) }}
  13. cancel-in-progress: true
  14. permissions:
  15. contents: read
  16. checks: write
  17. env:
  18. FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
  19. jobs:
  20. unit:
  21. name: unit (${{ matrix.settings.name }})
  22. strategy:
  23. fail-fast: false
  24. matrix:
  25. settings:
  26. - name: linux
  27. host: blacksmith-4vcpu-ubuntu-2404
  28. - name: windows
  29. host: blacksmith-4vcpu-windows-2025
  30. runs-on: ${{ matrix.settings.host }}
  31. defaults:
  32. run:
  33. shell: bash
  34. steps:
  35. - name: Checkout repository
  36. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  37. with:
  38. token: ${{ secrets.GITHUB_TOKEN }}
  39. - name: Setup Node
  40. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  41. with:
  42. node-version: "24"
  43. - name: Setup Bun
  44. uses: ./.github/actions/setup-bun
  45. - name: Configure git identity
  46. run: |
  47. git config --global user.email "bot@opencode.ai"
  48. git config --global user.name "opencode"
  49. - name: Cache Turbo
  50. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  51. with:
  52. path: node_modules/.cache/turbo
  53. key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-${{ github.sha }}
  54. restore-keys: |
  55. turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-
  56. turbo-${{ runner.os }}-
  57. - name: Run unit tests
  58. timeout-minutes: 20
  59. run: GITHUB_ACTIONS=false bun turbo test
  60. env:
  61. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
  62. - name: Verify compiled service lifecycle
  63. if: always()
  64. timeout-minutes: 10
  65. working-directory: packages/cli
  66. run: |
  67. bun run script/build.ts --single --skip-install
  68. bun run script/service-smoke.ts
  69. - name: Setup Node build runtime
  70. if: always()
  71. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  72. with:
  73. node-version: "26.4.0"
  74. - name: Verify Node build
  75. if: always()
  76. timeout-minutes: 15
  77. working-directory: packages/cli
  78. run: |
  79. bun run script/build-node.ts --single --skip-install --outdir=dist/node
  80. bun run script/service-smoke.ts --node
  81. - name: Check generated client
  82. if: runner.os == 'Linux'
  83. working-directory: packages/client
  84. run: bun run check:generated
  85. - name: Check generated documentation
  86. if: runner.os == 'Linux'
  87. working-directory: packages/www
  88. run: bun run check:generated
  89. e2e:
  90. name: e2e (${{ matrix.settings.name }})
  91. if: github.ref_name != 'v2' && github.head_ref != 'v2'
  92. strategy:
  93. fail-fast: false
  94. matrix:
  95. settings:
  96. - name: linux
  97. host: blacksmith-4vcpu-ubuntu-2404
  98. - name: windows
  99. host: blacksmith-4vcpu-windows-2025
  100. runs-on: ${{ matrix.settings.host }}
  101. env:
  102. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  103. defaults:
  104. run:
  105. shell: bash
  106. steps:
  107. - name: Checkout repository
  108. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  109. with:
  110. token: ${{ secrets.GITHUB_TOKEN }}
  111. - name: Setup Node
  112. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  113. with:
  114. # Playwright 1.59 hangs while extracting Chromium with Node 24.16.
  115. node-version: "24.15"
  116. - name: Setup Bun
  117. uses: ./.github/actions/setup-bun
  118. - name: Read Playwright version
  119. id: playwright-version
  120. run: |
  121. version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
  122. echo "version=$version" >> "$GITHUB_OUTPUT"
  123. - name: Cache Playwright browsers
  124. id: playwright-cache
  125. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  126. with:
  127. path: ${{ github.workspace }}/.playwright-browsers
  128. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  129. - name: Install Playwright system dependencies
  130. if: runner.os == 'Linux'
  131. working-directory: packages/app
  132. run: bunx playwright install-deps chromium
  133. - name: Install Playwright browsers
  134. if: steps.playwright-cache.outputs.cache-hit != 'true'
  135. working-directory: packages/app
  136. run: bunx playwright install chromium
  137. - name: Run app e2e tests
  138. run: bun --cwd packages/app test:e2e:local
  139. env:
  140. CI: true
  141. timeout-minutes: 30
  142. - name: Upload Playwright artifacts
  143. if: always()
  144. uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  145. with:
  146. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  147. if-no-files-found: ignore
  148. retention-days: 7
  149. path: |
  150. packages/app/e2e/test-results
  151. packages/app/e2e/playwright-report