test.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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: GITHUB_ACTIONS=false bun turbo test
  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. # Playwright 1.59 hangs while extracting Chromium with Node 24.16.
  90. node-version: "24.15"
  91. - name: Setup Bun
  92. uses: ./.github/actions/setup-bun
  93. - name: Read Playwright version
  94. id: playwright-version
  95. run: |
  96. version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
  97. echo "version=$version" >> "$GITHUB_OUTPUT"
  98. - name: Cache Playwright browsers
  99. id: playwright-cache
  100. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  101. with:
  102. path: ${{ github.workspace }}/.playwright-browsers
  103. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  104. - name: Install Playwright system dependencies
  105. if: runner.os == 'Linux'
  106. working-directory: packages/app
  107. run: bunx playwright install-deps chromium
  108. - name: Install Playwright browsers
  109. if: steps.playwright-cache.outputs.cache-hit != 'true'
  110. working-directory: packages/app
  111. run: bunx playwright install chromium
  112. - name: Run app e2e tests
  113. run: bun --cwd packages/app test:e2e:local
  114. env:
  115. CI: true
  116. timeout-minutes: 30
  117. - name: Upload Playwright artifacts
  118. if: always()
  119. uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  120. with:
  121. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  122. if-no-files-found: ignore
  123. retention-days: 7
  124. path: |
  125. packages/app/e2e/test-results
  126. packages/app/e2e/playwright-report