test.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. jobs:
  16. unit:
  17. name: unit (${{ matrix.settings.name }})
  18. strategy:
  19. fail-fast: false
  20. matrix:
  21. settings:
  22. - name: linux
  23. host: blacksmith-4vcpu-ubuntu-2404
  24. - name: windows
  25. host: blacksmith-4vcpu-windows-2025
  26. runs-on: ${{ matrix.settings.host }}
  27. defaults:
  28. run:
  29. shell: bash
  30. steps:
  31. - name: Checkout repository
  32. uses: actions/checkout@v4
  33. with:
  34. token: ${{ secrets.GITHUB_TOKEN }}
  35. - name: Setup Bun
  36. uses: ./.github/actions/setup-bun
  37. - name: Configure git identity
  38. run: |
  39. git config --global user.email "[email protected]"
  40. git config --global user.name "opencode"
  41. - name: Run unit tests
  42. run: bun turbo test
  43. env:
  44. # Bun 1.3.11 intermittently crashes on Windows during test teardown
  45. # inside the native @parcel/watcher binding. Unit CI does not rely on
  46. # the live watcher backend there, so disable it for that platform.
  47. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
  48. e2e:
  49. name: e2e (${{ matrix.settings.name }})
  50. strategy:
  51. fail-fast: false
  52. matrix:
  53. settings:
  54. - name: linux
  55. host: blacksmith-4vcpu-ubuntu-2404
  56. - name: windows
  57. host: blacksmith-4vcpu-windows-2025
  58. runs-on: ${{ matrix.settings.host }}
  59. env:
  60. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  61. defaults:
  62. run:
  63. shell: bash
  64. steps:
  65. - name: Checkout repository
  66. uses: actions/checkout@v4
  67. with:
  68. token: ${{ secrets.GITHUB_TOKEN }}
  69. - name: Setup Bun
  70. uses: ./.github/actions/setup-bun
  71. - name: Read Playwright version
  72. id: playwright-version
  73. run: |
  74. version=$(node -e 'console.log(require("./packages/app/package.json").devDependencies["@playwright/test"])')
  75. echo "version=$version" >> "$GITHUB_OUTPUT"
  76. - name: Cache Playwright browsers
  77. id: playwright-cache
  78. uses: actions/cache@v4
  79. with:
  80. path: ${{ github.workspace }}/.playwright-browsers
  81. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  82. - name: Install Playwright system dependencies
  83. if: runner.os == 'Linux'
  84. working-directory: packages/app
  85. run: bunx playwright install-deps chromium
  86. - name: Install Playwright browsers
  87. if: steps.playwright-cache.outputs.cache-hit != 'true'
  88. working-directory: packages/app
  89. run: bunx playwright install chromium
  90. - name: Run app e2e tests
  91. run: bun --cwd packages/app test:e2e:local
  92. env:
  93. CI: true
  94. PLAYWRIGHT_JUNIT_OUTPUT: e2e/junit-${{ matrix.settings.name }}.xml
  95. timeout-minutes: 30
  96. - name: Upload Playwright artifacts
  97. if: always()
  98. uses: actions/upload-artifact@v4
  99. with:
  100. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  101. if-no-files-found: ignore
  102. retention-days: 7
  103. path: |
  104. packages/app/e2e/junit-*.xml
  105. packages/app/e2e/test-results
  106. packages/app/e2e/playwright-report