test.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. name: test
  2. on:
  3. push:
  4. branches:
  5. - dev
  6. pull_request:
  7. workflow_dispatch:
  8. jobs:
  9. test:
  10. name: test (${{ matrix.settings.name }})
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. settings:
  15. - name: linux
  16. host: blacksmith-4vcpu-ubuntu-2404
  17. playwright: bunx playwright install --with-deps
  18. workdir: .
  19. command: |
  20. git config --global user.email "[email protected]"
  21. git config --global user.name "opencode"
  22. bun turbo typecheck
  23. bun turbo test
  24. - name: windows
  25. host: windows-latest
  26. playwright: bunx playwright install
  27. workdir: packages/app
  28. command: bun test:e2e
  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 Bun
  39. uses: ./.github/actions/setup-bun
  40. - name: Install Playwright browsers
  41. working-directory: packages/app
  42. run: ${{ matrix.settings.playwright }}
  43. - name: Seed opencode data
  44. working-directory: packages/opencode
  45. run: bun script/seed-e2e.ts
  46. env:
  47. MODELS_DEV_API_JSON: ${{ github.workspace }}/packages/opencode/test/tool/fixtures/models-api.json
  48. OPENCODE_DISABLE_MODELS_FETCH: "true"
  49. OPENCODE_DISABLE_SHARE: "true"
  50. OPENCODE_DISABLE_LSP_DOWNLOAD: "true"
  51. OPENCODE_DISABLE_DEFAULT_PLUGINS: "true"
  52. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: "true"
  53. OPENCODE_TEST_HOME: ${{ runner.temp }}/opencode-e2e/home
  54. XDG_DATA_HOME: ${{ runner.temp }}/opencode-e2e/share
  55. XDG_CACHE_HOME: ${{ runner.temp }}/opencode-e2e/cache
  56. XDG_CONFIG_HOME: ${{ runner.temp }}/opencode-e2e/config
  57. XDG_STATE_HOME: ${{ runner.temp }}/opencode-e2e/state
  58. OPENCODE_E2E_PROJECT_DIR: ${{ github.workspace }}
  59. OPENCODE_E2E_SESSION_TITLE: "E2E Session"
  60. OPENCODE_E2E_MESSAGE: "Seeded for UI e2e"
  61. OPENCODE_E2E_MODEL: "opencode/gpt-5-nano"
  62. - name: Run opencode server
  63. run: bun run dev -- --print-logs --log-level WARN serve --port 4096 --hostname 0.0.0.0 &
  64. env:
  65. MODELS_DEV_API_JSON: ${{ github.workspace }}/packages/opencode/test/tool/fixtures/models-api.json
  66. OPENCODE_DISABLE_MODELS_FETCH: "true"
  67. OPENCODE_DISABLE_SHARE: "true"
  68. OPENCODE_DISABLE_LSP_DOWNLOAD: "true"
  69. OPENCODE_DISABLE_DEFAULT_PLUGINS: "true"
  70. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: "true"
  71. OPENCODE_TEST_HOME: ${{ runner.temp }}/opencode-e2e/home
  72. XDG_DATA_HOME: ${{ runner.temp }}/opencode-e2e/share
  73. XDG_CACHE_HOME: ${{ runner.temp }}/opencode-e2e/cache
  74. XDG_CONFIG_HOME: ${{ runner.temp }}/opencode-e2e/config
  75. XDG_STATE_HOME: ${{ runner.temp }}/opencode-e2e/state
  76. OPENCODE_CLIENT: "app"
  77. - name: Wait for opencode server
  78. run: |
  79. for i in {1..60}; do
  80. curl -fsS "http://localhost:4096/global/health" > /dev/null && exit 0
  81. sleep 1
  82. done
  83. exit 1
  84. - name: run
  85. working-directory: ${{ matrix.settings.workdir }}
  86. run: ${{ matrix.settings.command }}
  87. env:
  88. CI: true
  89. MODELS_DEV_API_JSON: ${{ github.workspace }}/packages/opencode/test/tool/fixtures/models-api.json
  90. OPENCODE_DISABLE_MODELS_FETCH: "true"
  91. OPENCODE_DISABLE_SHARE: "true"
  92. OPENCODE_DISABLE_LSP_DOWNLOAD: "true"
  93. OPENCODE_DISABLE_DEFAULT_PLUGINS: "true"
  94. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: "true"
  95. OPENCODE_TEST_HOME: ${{ runner.temp }}/opencode-e2e/home
  96. XDG_DATA_HOME: ${{ runner.temp }}/opencode-e2e/share
  97. XDG_CACHE_HOME: ${{ runner.temp }}/opencode-e2e/cache
  98. XDG_CONFIG_HOME: ${{ runner.temp }}/opencode-e2e/config
  99. XDG_STATE_HOME: ${{ runner.temp }}/opencode-e2e/state
  100. PLAYWRIGHT_SERVER_HOST: "localhost"
  101. PLAYWRIGHT_SERVER_PORT: "4096"
  102. VITE_OPENCODE_SERVER_HOST: "localhost"
  103. VITE_OPENCODE_SERVER_PORT: "4096"
  104. OPENCODE_CLIENT: "app"
  105. timeout-minutes: 30