test.yml 4.8 KB

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