code-qa.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. compile:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout code
  14. uses: actions/checkout@v4
  15. - name: Setup Node.js
  16. uses: actions/setup-node@v4
  17. with:
  18. node-version: '18'
  19. cache: 'npm'
  20. - name: Install dependencies
  21. run: npm run install:all
  22. - name: Compile
  23. run: npm run compile
  24. - name: Check types
  25. run: npm run check-types
  26. - name: Lint
  27. run: npm run lint
  28. unit-test:
  29. runs-on: ubuntu-latest
  30. steps:
  31. - name: Checkout code
  32. uses: actions/checkout@v4
  33. - name: Setup Node.js
  34. uses: actions/setup-node@v4
  35. with:
  36. node-version: '18'
  37. cache: 'npm'
  38. - name: Install dependencies
  39. run: npm run install:all
  40. - name: Run unit tests
  41. run: npm test
  42. check-openrouter-api-key:
  43. runs-on: ubuntu-latest
  44. outputs:
  45. exists: ${{ steps.openrouter-api-key-check.outputs.defined }}
  46. steps:
  47. - name: Check if OpenRouter API key exists
  48. id: openrouter-api-key-check
  49. shell: bash
  50. run: |
  51. if [ "${{ secrets.OPENROUTER_API_KEY }}" != '' ]; then
  52. echo "defined=true" >> $GITHUB_OUTPUT;
  53. else
  54. echo "defined=false" >> $GITHUB_OUTPUT;
  55. fi
  56. integration-test:
  57. runs-on: ubuntu-latest
  58. needs: [check-openrouter-api-key]
  59. if: needs.check-openrouter-api-key.outputs.exists == 'true'
  60. steps:
  61. - name: Checkout code
  62. uses: actions/checkout@v4
  63. - name: Setup Node.js
  64. uses: actions/setup-node@v4
  65. with:
  66. node-version: '18'
  67. cache: 'npm'
  68. - name: Create env.integration file
  69. run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.integration
  70. - name: Install dependencies
  71. run: npm run install:all
  72. - name: Run integration tests
  73. run: xvfb-run -a npm run test:integration