test.yml 4.5 KB

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