test.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. include-hidden-files: true
  69. if-no-files-found: ignore
  70. retention-days: 7
  71. path: packages/*/.artifacts/unit/junit.xml
  72. e2e:
  73. name: e2e (${{ matrix.settings.name }})
  74. strategy:
  75. fail-fast: false
  76. matrix:
  77. settings:
  78. - name: linux
  79. host: blacksmith-4vcpu-ubuntu-2404
  80. - name: windows
  81. host: blacksmith-4vcpu-windows-2025
  82. runs-on: ${{ matrix.settings.host }}
  83. env:
  84. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  85. defaults:
  86. run:
  87. shell: bash
  88. steps:
  89. - name: Checkout repository
  90. uses: actions/checkout@v4
  91. with:
  92. token: ${{ secrets.GITHUB_TOKEN }}
  93. - name: Setup Bun
  94. uses: ./.github/actions/setup-bun
  95. - name: Read Playwright version
  96. id: playwright-version
  97. run: |
  98. version=$(node -e 'console.log(require("./packages/app/package.json").devDependencies["@playwright/test"])')
  99. echo "version=$version" >> "$GITHUB_OUTPUT"
  100. - name: Cache Playwright browsers
  101. id: playwright-cache
  102. uses: actions/cache@v4
  103. with:
  104. path: ${{ github.workspace }}/.playwright-browsers
  105. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  106. - name: Install Playwright system dependencies
  107. if: runner.os == 'Linux'
  108. working-directory: packages/app
  109. run: bunx playwright install-deps chromium
  110. - name: Install Playwright browsers
  111. if: steps.playwright-cache.outputs.cache-hit != 'true'
  112. working-directory: packages/app
  113. run: bunx playwright install chromium
  114. - name: Run app e2e tests
  115. run: bun --cwd packages/app test:e2e:local
  116. env:
  117. CI: true
  118. PLAYWRIGHT_JUNIT_OUTPUT: e2e/junit-${{ matrix.settings.name }}.xml
  119. timeout-minutes: 30
  120. - name: Upload Playwright artifacts
  121. if: always()
  122. uses: actions/upload-artifact@v4
  123. with:
  124. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  125. if-no-files-found: ignore
  126. retention-days: 7
  127. path: |
  128. packages/app/e2e/junit-*.xml
  129. packages/app/e2e/test-results
  130. packages/app/e2e/playwright-report