test.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  36. with:
  37. token: ${{ secrets.GITHUB_TOKEN }}
  38. - name: Setup Node
  39. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  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@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  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. timeout-minutes: 20
  58. run: bun turbo test:ci --log-order=stream --log-prefix=task
  59. env:
  60. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
  61. - name: Run HttpApi exerciser gates
  62. if: runner.os == 'Linux'
  63. working-directory: packages/opencode
  64. run: bun run test:httpapi
  65. - name: Publish unit reports
  66. if: always()
  67. uses: mikepenz/action-junit-report@bccf2e31636835cf0874589931c4116687171386 # v6.4.0
  68. with:
  69. report_paths: packages/*/.artifacts/unit/junit.xml
  70. check_name: "unit results (${{ matrix.settings.name }})"
  71. detailed_summary: true
  72. include_time_in_summary: true
  73. fail_on_failure: false
  74. - name: Upload unit artifacts
  75. if: always()
  76. uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  77. with:
  78. name: unit-${{ matrix.settings.name }}-${{ github.run_attempt }}
  79. include-hidden-files: true
  80. if-no-files-found: ignore
  81. retention-days: 7
  82. path: packages/*/.artifacts/unit/junit.xml
  83. e2e:
  84. name: e2e (${{ matrix.settings.name }})
  85. strategy:
  86. fail-fast: false
  87. matrix:
  88. settings:
  89. - name: linux
  90. host: blacksmith-4vcpu-ubuntu-2404
  91. - name: windows
  92. host: blacksmith-4vcpu-windows-2025
  93. runs-on: ${{ matrix.settings.host }}
  94. env:
  95. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  96. defaults:
  97. run:
  98. shell: bash
  99. steps:
  100. - name: Checkout repository
  101. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  102. with:
  103. token: ${{ secrets.GITHUB_TOKEN }}
  104. - name: Setup Node
  105. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  106. with:
  107. node-version: "24"
  108. - name: Setup Bun
  109. uses: ./.github/actions/setup-bun
  110. - name: Read Playwright version
  111. id: playwright-version
  112. run: |
  113. version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
  114. echo "version=$version" >> "$GITHUB_OUTPUT"
  115. - name: Cache Playwright browsers
  116. id: playwright-cache
  117. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  118. with:
  119. path: ${{ github.workspace }}/.playwright-browsers
  120. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  121. - name: Install Playwright system dependencies
  122. if: runner.os == 'Linux'
  123. working-directory: packages/app
  124. run: bunx playwright install-deps chromium
  125. - name: Install Playwright browsers
  126. if: steps.playwright-cache.outputs.cache-hit != 'true'
  127. working-directory: packages/app
  128. run: bunx playwright install chromium
  129. - name: Run app e2e tests
  130. run: bun --cwd packages/app test:e2e:local
  131. env:
  132. CI: true
  133. PLAYWRIGHT_JUNIT_OUTPUT: e2e/junit-${{ matrix.settings.name }}.xml
  134. timeout-minutes: 30
  135. - name: Upload Playwright artifacts
  136. if: always()
  137. uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  138. with:
  139. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  140. if-no-files-found: ignore
  141. retention-days: 7
  142. path: |
  143. packages/app/e2e/junit-*.xml
  144. packages/app/e2e/test-results
  145. packages/app/e2e/playwright-report