1
0

test.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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: Install ffmpeg
  50. if: runner.os == 'Linux'
  51. run: |
  52. sudo apt-get update
  53. sudo apt-get install --yes ffmpeg
  54. - name: Cache Turbo
  55. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  56. with:
  57. path: node_modules/.cache/turbo
  58. key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-${{ github.sha }}
  59. restore-keys: |
  60. turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-
  61. turbo-${{ runner.os }}-
  62. - name: Run unit tests
  63. timeout-minutes: 20
  64. run: GITHUB_ACTIONS=false bun turbo test
  65. env:
  66. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
  67. - name: Verify compiled service lifecycle
  68. if: always()
  69. timeout-minutes: 10
  70. working-directory: packages/cli
  71. run: |
  72. bun run script/build.ts --single --skip-install
  73. bun run script/service-smoke.ts
  74. - name: Setup Node build runtime
  75. if: always()
  76. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  77. with:
  78. node-version: "26.4.0"
  79. - name: Verify Node build
  80. if: always()
  81. timeout-minutes: 15
  82. working-directory: packages/cli
  83. run: |
  84. bun run script/build-node.ts --single --skip-install --outdir=dist/node
  85. bun run script/service-smoke.ts --node
  86. - name: Check generated client
  87. if: runner.os == 'Linux'
  88. working-directory: packages/client
  89. run: bun run check:generated
  90. - name: Check generated documentation
  91. if: runner.os == 'Linux'
  92. working-directory: packages/www
  93. run: bun run check:generated
  94. e2e:
  95. name: e2e (${{ matrix.settings.name }})
  96. if: github.ref_name != 'v2' && github.head_ref != 'v2'
  97. strategy:
  98. fail-fast: false
  99. matrix:
  100. settings:
  101. - name: linux
  102. host: blacksmith-4vcpu-ubuntu-2404
  103. - name: windows
  104. host: blacksmith-4vcpu-windows-2025
  105. runs-on: ${{ matrix.settings.host }}
  106. env:
  107. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  108. defaults:
  109. run:
  110. shell: bash
  111. steps:
  112. - name: Checkout repository
  113. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  114. with:
  115. token: ${{ secrets.GITHUB_TOKEN }}
  116. - name: Setup Node
  117. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  118. with:
  119. # Playwright 1.59 hangs while extracting Chromium with Node 24.16.
  120. node-version: "24.15"
  121. - name: Setup Bun
  122. uses: ./.github/actions/setup-bun
  123. - name: Read Playwright version
  124. id: playwright-version
  125. run: |
  126. version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
  127. echo "version=$version" >> "$GITHUB_OUTPUT"
  128. - name: Cache Playwright browsers
  129. id: playwright-cache
  130. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  131. with:
  132. path: ${{ github.workspace }}/.playwright-browsers
  133. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  134. - name: Install Playwright system dependencies
  135. if: runner.os == 'Linux'
  136. working-directory: packages/app
  137. run: bunx playwright install-deps chromium
  138. - name: Install Playwright browsers
  139. if: steps.playwright-cache.outputs.cache-hit != 'true'
  140. working-directory: packages/app
  141. run: bunx playwright install chromium
  142. - name: Run app e2e tests
  143. run: bun --cwd packages/app test:e2e:local
  144. env:
  145. CI: true
  146. timeout-minutes: 30
  147. - name: Upload Playwright artifacts
  148. if: always()
  149. uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  150. with:
  151. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  152. if-no-files-found: ignore
  153. retention-days: 7
  154. path: |
  155. packages/app/e2e/test-results
  156. packages/app/e2e/playwright-report