test.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. e2e:
  44. name: e2e (${{ matrix.settings.name }})
  45. strategy:
  46. fail-fast: false
  47. matrix:
  48. settings:
  49. - name: linux
  50. host: blacksmith-4vcpu-ubuntu-2404
  51. - name: windows
  52. host: blacksmith-4vcpu-windows-2025
  53. runs-on: ${{ matrix.settings.host }}
  54. env:
  55. PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
  56. defaults:
  57. run:
  58. shell: bash
  59. steps:
  60. - name: Checkout repository
  61. uses: actions/checkout@v4
  62. with:
  63. token: ${{ secrets.GITHUB_TOKEN }}
  64. - name: Setup Bun
  65. uses: ./.github/actions/setup-bun
  66. - name: Read Playwright version
  67. id: playwright-version
  68. run: |
  69. version=$(node -e 'console.log(require("./packages/app/package.json").devDependencies["@playwright/test"])')
  70. echo "version=$version" >> "$GITHUB_OUTPUT"
  71. - name: Cache Playwright browsers
  72. id: playwright-cache
  73. uses: actions/cache@v4
  74. with:
  75. path: ${{ github.workspace }}/.playwright-browsers
  76. key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
  77. - name: Install Playwright system dependencies
  78. if: runner.os == 'Linux'
  79. working-directory: packages/app
  80. run: bunx playwright install-deps chromium
  81. - name: Install Playwright browsers
  82. if: steps.playwright-cache.outputs.cache-hit != 'true'
  83. working-directory: packages/app
  84. run: bunx playwright install chromium
  85. - name: Run app e2e tests
  86. run: bun --cwd packages/app test:e2e:local
  87. env:
  88. CI: true
  89. timeout-minutes: 30
  90. - name: Upload Playwright artifacts
  91. if: failure()
  92. uses: actions/upload-artifact@v4
  93. with:
  94. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  95. if-no-files-found: ignore
  96. retention-days: 7
  97. path: |
  98. packages/app/e2e/test-results
  99. packages/app/e2e/playwright-report