test.yml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: test
  2. on:
  3. push:
  4. branches:
  5. - dev
  6. pull_request:
  7. workflow_dispatch:
  8. jobs:
  9. unit:
  10. name: unit (linux)
  11. runs-on: blacksmith-4vcpu-ubuntu-2404
  12. defaults:
  13. run:
  14. shell: bash
  15. steps:
  16. - name: Checkout repository
  17. uses: actions/checkout@v4
  18. with:
  19. token: ${{ secrets.GITHUB_TOKEN }}
  20. - name: Setup Bun
  21. uses: ./.github/actions/setup-bun
  22. - name: Configure git identity
  23. run: |
  24. git config --global user.email "[email protected]"
  25. git config --global user.name "opencode"
  26. - name: Run unit tests
  27. run: bun turbo test
  28. e2e:
  29. name: e2e (${{ matrix.settings.name }})
  30. needs: unit
  31. strategy:
  32. fail-fast: false
  33. matrix:
  34. settings:
  35. - name: linux
  36. host: blacksmith-4vcpu-ubuntu-2404
  37. playwright: bunx playwright install --with-deps
  38. - name: windows
  39. host: blacksmith-4vcpu-windows-2025
  40. playwright: bunx playwright install
  41. runs-on: ${{ matrix.settings.host }}
  42. env:
  43. PLAYWRIGHT_BROWSERS_PATH: 0
  44. defaults:
  45. run:
  46. shell: bash
  47. steps:
  48. - name: Checkout repository
  49. uses: actions/checkout@v4
  50. with:
  51. token: ${{ secrets.GITHUB_TOKEN }}
  52. - name: Setup Bun
  53. uses: ./.github/actions/setup-bun
  54. - name: Install Playwright browsers
  55. working-directory: packages/app
  56. run: ${{ matrix.settings.playwright }}
  57. - name: Run app e2e tests
  58. run: bun --cwd packages/app test:e2e:local
  59. env:
  60. CI: true
  61. timeout-minutes: 30
  62. - name: Upload Playwright artifacts
  63. if: failure()
  64. uses: actions/upload-artifact@v4
  65. with:
  66. name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
  67. if-no-files-found: ignore
  68. retention-days: 7
  69. path: |
  70. packages/app/e2e/test-results
  71. packages/app/e2e/playwright-report
  72. required:
  73. name: test (linux)
  74. runs-on: blacksmith-4vcpu-ubuntu-2404
  75. needs:
  76. - unit
  77. - e2e
  78. if: always()
  79. steps:
  80. - name: Verify upstream test jobs passed
  81. run: |
  82. echo "unit=${{ needs.unit.result }}"
  83. echo "e2e=${{ needs.e2e.result }}"
  84. test "${{ needs.unit.result }}" = "success"
  85. test "${{ needs.e2e.result }}" = "success"