test.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. name: test
  2. on:
  3. push:
  4. branches:
  5. - dev
  6. pull_request:
  7. workflow_dispatch:
  8. concurrency:
  9. # Keep every run on dev so cancelled checks do not pollute the default branch
  10. # commit history. PRs and other branches still share a group and cancel stale runs.
  11. 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)) }}
  12. cancel-in-progress: true
  13. permissions:
  14. contents: read
  15. checks: write
  16. env:
  17. FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
  18. jobs:
  19. unit:
  20. name: unit (${{ matrix.settings.name }})
  21. strategy:
  22. fail-fast: false
  23. matrix:
  24. settings:
  25. - name: linux
  26. host: blacksmith-4vcpu-ubuntu-2404
  27. - name: windows
  28. host: blacksmith-4vcpu-windows-2025
  29. runs-on: ${{ matrix.settings.host }}
  30. defaults:
  31. run:
  32. shell: bash
  33. steps:
  34. - name: Checkout repository
  35. uses: actions/checkout@v4
  36. with:
  37. token: ${{ secrets.GITHUB_TOKEN }}
  38. - name: Setup Node
  39. uses: actions/setup-node@v4
  40. with:
  41. node-version: "24"
  42. - name: Setup Bun
  43. uses: ./.github/actions/setup-bun
  44. - name: Configure git identity
  45. run: |
  46. git config --global user.email "bot@opencode.ai"
  47. git config --global user.name "opencode"
  48. - name: Cache Turbo
  49. uses: actions/cache@v4
  50. with:
  51. path: node_modules/.cache/turbo
  52. key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-${{ github.sha }}
  53. restore-keys: |
  54. turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-
  55. turbo-${{ runner.os }}-
  56. - name: Run unit tests
  57. run: bun turbo test:ci
  58. env:
  59. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
  60. - name: Run HttpApi exerciser gates
  61. if: runner.os == 'Linux'
  62. working-directory: packages/opencode
  63. run: bun run test:httpapi
  64. - name: Publish unit reports
  65. if: always()
  66. uses: mikepenz/action-junit-report@v6
  67. with:
  68. report_paths: packages/*/.artifacts/unit/junit.xml
  69. check_name: "unit results (${{ matrix.settings.name }})"
  70. detailed_summary: true
  71. include_time_in_summary: true
  72. fail_on_failure: false
  73. - name: Upload unit artifacts
  74. if: always()
  75. uses: actions/upload-artifact@v4
  76. with:
  77. name: unit-${{ matrix.settings.name }}-${{ github.run_attempt }}
  78. include-hidden-files: true
  79. if-no-files-found: ignore
  80. retention-days: 7
  81. path: packages/*/.artifacts/unit/junit.xml
  82. e2e:
  83. name: e2e (${{ matrix.settings.name }})
  84. strategy:
  85. fail-fast: false
  86. matrix:
  87. settings:
  88. - name: linux
  89. host: blacksmith-4vcpu-ubuntu-2404
  90. - name: windows
  91. host: blacksmith-4vcpu-windows-2025
  92. runs-on: ${{ matrix.settings.host }}
  93. env:
  94. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  95. defaults:
  96. run:
  97. shell: bash
  98. steps:
  99. - name: Checkout repository
  100. uses: actions/checkout@v4
  101. with:
  102. token: ${{ secrets.GITHUB_TOKEN }}
  103. - name: Setup Node
  104. uses: actions/setup-node@v4
  105. with:
  106. node-version: "24"
  107. - name: Setup Bun
  108. uses: ./.github/actions/setup-bun
  109. - name: Read Playwright version
  110. id: playwright-version
  111. run: |
  112. version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
  113. echo "version=$version" >> "$GITHUB_OUTPUT"
  114. - name: Cache Playwright browsers
  115. id: playwright-cache
  116. uses: actions/cache@v4
  117. with:
  118. path: ${{ github.workspace }}/.playwright-browsers
  119. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  120. - name: Install Playwright system dependencies
  121. if: runner.os == 'Linux'
  122. working-directory: packages/app
  123. run: bunx playwright install-deps chromium
  124. - name: Install Playwright browsers
  125. if: steps.playwright-cache.outputs.cache-hit != 'true'
  126. working-directory: packages/app
  127. run: bunx playwright install chromium
  128. - name: Run app e2e tests
  129. run: bun --cwd packages/app test:e2e:local
  130. env:
  131. CI: true
  132. PLAYWRIGHT_JUNIT_OUTPUT: e2e/junit-${{ matrix.settings.name }}.xml
  133. timeout-minutes: 30
  134. - name: Upload Playwright artifacts
  135. if: always()
  136. uses: actions/upload-artifact@v4
  137. with:
  138. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  139. if-no-files-found: ignore
  140. retention-days: 7
  141. path: |
  142. packages/app/e2e/junit-*.xml
  143. packages/app/e2e/test-results
  144. packages/app/e2e/playwright-report