test.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 --output-logs=errors-only --log-order=grouped --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. e2e:
  66. name: e2e (${{ matrix.settings.name }})
  67. strategy:
  68. fail-fast: false
  69. matrix:
  70. settings:
  71. - name: linux
  72. host: blacksmith-4vcpu-ubuntu-2404
  73. - name: windows
  74. host: blacksmith-4vcpu-windows-2025
  75. runs-on: ${{ matrix.settings.host }}
  76. env:
  77. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  78. defaults:
  79. run:
  80. shell: bash
  81. steps:
  82. - name: Checkout repository
  83. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  84. with:
  85. token: ${{ secrets.GITHUB_TOKEN }}
  86. - name: Setup Node
  87. uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  88. with:
  89. node-version: "24"
  90. - name: Setup Bun
  91. uses: ./.github/actions/setup-bun
  92. - name: Read Playwright version
  93. id: playwright-version
  94. run: |
  95. version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
  96. echo "version=$version" >> "$GITHUB_OUTPUT"
  97. - name: Cache Playwright browsers
  98. id: playwright-cache
  99. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  100. with:
  101. path: ${{ github.workspace }}/.playwright-browsers
  102. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  103. - name: Install Playwright system dependencies
  104. if: runner.os == 'Linux'
  105. working-directory: packages/app
  106. run: bunx playwright install-deps chromium
  107. - name: Install Playwright browsers
  108. if: steps.playwright-cache.outputs.cache-hit != 'true'
  109. working-directory: packages/app
  110. run: bunx playwright install chromium
  111. - name: Run app e2e tests
  112. run: bun --cwd packages/app test:e2e:local
  113. env:
  114. CI: true
  115. timeout-minutes: 30
  116. - name: Upload Playwright artifacts
  117. if: always()
  118. uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  119. with:
  120. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  121. if-no-files-found: ignore
  122. retention-days: 7
  123. path: |
  124. packages/app/e2e/test-results
  125. packages/app/e2e/playwright-report