test.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. e2e:
  86. name: e2e (${{ matrix.settings.name }})
  87. if: github.ref_name != 'v2' && github.head_ref != 'v2'
  88. strategy:
  89. fail-fast: false
  90. matrix:
  91. settings:
  92. - name: linux
  93. host: blacksmith-4vcpu-ubuntu-2404
  94. - name: windows
  95. host: blacksmith-4vcpu-windows-2025
  96. runs-on: ${{ matrix.settings.host }}
  97. env:
  98. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  99. defaults:
  100. run:
  101. shell: bash
  102. steps:
  103. - name: Checkout repository
  104. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  105. with:
  106. token: ${{ secrets.GITHUB_TOKEN }}
  107. - name: Setup Node
  108. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  109. with:
  110. # Playwright 1.59 hangs while extracting Chromium with Node 24.16.
  111. node-version: "24.15"
  112. - name: Setup Bun
  113. uses: ./.github/actions/setup-bun
  114. - name: Read Playwright version
  115. id: playwright-version
  116. run: |
  117. version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
  118. echo "version=$version" >> "$GITHUB_OUTPUT"
  119. - name: Cache Playwright browsers
  120. id: playwright-cache
  121. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  122. with:
  123. path: ${{ github.workspace }}/.playwright-browsers
  124. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  125. - name: Install Playwright system dependencies
  126. if: runner.os == 'Linux'
  127. working-directory: packages/app
  128. run: bunx playwright install-deps chromium
  129. - name: Install Playwright browsers
  130. if: steps.playwright-cache.outputs.cache-hit != 'true'
  131. working-directory: packages/app
  132. run: bunx playwright install chromium
  133. - name: Run app e2e tests
  134. run: bun --cwd packages/app test:e2e:local
  135. env:
  136. CI: true
  137. timeout-minutes: 30
  138. - name: Upload Playwright artifacts
  139. if: always()
  140. uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  141. with:
  142. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  143. if-no-files-found: ignore
  144. retention-days: 7
  145. path: |
  146. packages/app/e2e/test-results
  147. packages/app/e2e/playwright-report