code-qa.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. name: Code QA Roo Code
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches: [main]
  6. pull_request:
  7. types: [opened, reopened, ready_for_review, synchronize]
  8. branches: [main]
  9. jobs:
  10. check-translations:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout code
  14. uses: actions/checkout@v4
  15. - name: Setup Node.js and pnpm
  16. uses: ./.github/actions/setup-node-pnpm
  17. - name: Verify all translations are complete
  18. run: node scripts/find-missing-translations.js
  19. knip:
  20. runs-on: ubuntu-latest
  21. steps:
  22. - name: Checkout code
  23. uses: actions/checkout@v4
  24. - name: Setup Node.js and pnpm
  25. uses: ./.github/actions/setup-node-pnpm
  26. - name: Run knip checks
  27. run: pnpm knip
  28. compile:
  29. runs-on: ubuntu-latest
  30. steps:
  31. - name: Checkout code
  32. uses: actions/checkout@v4
  33. - name: Setup Node.js and pnpm
  34. uses: ./.github/actions/setup-node-pnpm
  35. - name: Lint
  36. run: pnpm lint
  37. - name: Check types
  38. run: pnpm check-types
  39. unit-test:
  40. name: platform-unit-test (${{ matrix.name }})
  41. runs-on: ${{ matrix.os }}
  42. strategy:
  43. matrix:
  44. include:
  45. - os: ubuntu-latest
  46. name: ubuntu-latest
  47. - os: windows-latest
  48. name: windows-latest
  49. steps:
  50. - name: Checkout code
  51. uses: actions/checkout@v4
  52. - name: Setup Node.js and pnpm
  53. uses: ./.github/actions/setup-node-pnpm
  54. - name: Run unit tests
  55. run: pnpm test
  56. check-openrouter-api-key:
  57. runs-on: ubuntu-latest
  58. outputs:
  59. exists: ${{ steps.openrouter-api-key-check.outputs.defined }}
  60. steps:
  61. - name: Check if OpenRouter API key exists
  62. id: openrouter-api-key-check
  63. shell: bash
  64. run: |
  65. if [ "${{ secrets.OPENROUTER_API_KEY }}" != '' ]; then
  66. echo "defined=true" >> $GITHUB_OUTPUT;
  67. else
  68. echo "defined=false" >> $GITHUB_OUTPUT;
  69. fi
  70. integration-test:
  71. runs-on: ubuntu-latest
  72. needs: [check-openrouter-api-key]
  73. if: needs.check-openrouter-api-key.outputs.exists == 'true'
  74. steps:
  75. - name: Checkout code
  76. uses: actions/checkout@v4
  77. - name: Setup Node.js and pnpm
  78. uses: ./.github/actions/setup-node-pnpm
  79. - name: Create .env.local file
  80. working-directory: apps/vscode-e2e
  81. run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.local
  82. - name: Set VS Code test version
  83. run: echo "VSCODE_VERSION=1.101.2" >> $GITHUB_ENV
  84. - name: Cache VS Code test runtime
  85. uses: actions/cache@v4
  86. with:
  87. path: apps/vscode-e2e/.vscode-test
  88. key: ${{ runner.os }}-vscode-test-${{ env.VSCODE_VERSION }}
  89. - name: Pre-download VS Code test runtime with retry
  90. working-directory: apps/vscode-e2e
  91. run: |
  92. for attempt in 1 2 3; do
  93. echo "Download attempt $attempt of 3..."
  94. node -e "
  95. const { downloadAndUnzipVSCode } = require('@vscode/test-electron');
  96. downloadAndUnzipVSCode({ version: process.env.VSCODE_VERSION || '1.101.2' })
  97. .then(() => {
  98. console.log('✅ VS Code test runtime downloaded successfully');
  99. process.exit(0);
  100. })
  101. .catch(err => {
  102. console.error('❌ Failed to download VS Code (attempt $attempt):', err);
  103. process.exit(1);
  104. });
  105. " && break || {
  106. if [ $attempt -eq 3 ]; then
  107. echo "All download attempts failed"
  108. exit 1
  109. fi
  110. echo "Retrying in 5 seconds..."
  111. sleep 5
  112. }
  113. done
  114. - name: Run integration tests
  115. working-directory: apps/vscode-e2e
  116. run: xvfb-run -a pnpm test:ci