feat: add support for github split instructions #72
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pull Request CI | |
| on: | |
| pull_request: | |
| branches: [master] | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| lint: | |
| name: Lint Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linting | |
| run: npm run lint:check | |
| unit-test: | |
| name: Unit Tests | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run unit tests with coverage | |
| run: npm run test:coverage | |
| - name: Upload unit test coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unit-coverage | |
| path: coverage/ | |
| retention-days: 5 | |
| e2e-test: | |
| name: E2E Tests | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| environment: integration | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps chromium | |
| - name: Create .env.test file | |
| run: | | |
| echo "PUBLIC_ENV_NAME=${{ secrets.PUBLIC_ENV_NAME }}" > .env.integration | |
| echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" >> .env.integration | |
| echo "SUPABASE_PUBLIC_KEY=${{ secrets.SUPABASE_PUBLIC_KEY }}" >> .env.integration | |
| echo "SUPABASE_SERVICE_ROLE_KEY=${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}" >> .env.integration | |
| echo "E2E_USERNAME_ID=${{ secrets.E2E_USERNAME_ID }}" >> .env.integration | |
| echo "E2E_USERNAME=${{ secrets.E2E_USERNAME }}" >> .env.integration | |
| echo "E2E_PASSWORD=${{ secrets.E2E_PASSWORD }}" >> .env.integration | |
| - name: Run E2E tests | |
| run: npm run test:e2e | |
| - name: Upload E2E test artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 5 | |
| status-comment: | |
| name: Update PR Status | |
| needs: [lint, unit-test, e2e-test] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Get PR details | |
| id: pr_details | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const pr_number = context.issue.number; | |
| return { owner, repo, pr_number }; | |
| - name: Download unit test coverage | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: unit-coverage | |
| path: unit-coverage | |
| - name: Download E2E report | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: playwright-report | |
| - name: Create status comment | |
| uses: actions/github-script@v7 | |
| if: ${{ needs.unit-test.result == 'success' && needs.e2e-test.result == 'success' }} | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const { owner, repo, pr_number } = ${{ steps.pr_details.outputs.result }}; | |
| github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number: pr_number, | |
| body: `✅ All checks have passed successfully!\n\n` + | |
| `- Lint: ✅\n` + | |
| `- Unit Tests: ✅\n` + | |
| `- E2E Tests: ✅\n\n` + | |
| `Coverage reports have been uploaded as artifacts.` | |
| }); | |
| - name: Create failure comment | |
| uses: actions/github-script@v7 | |
| if: ${{ needs.unit-test.result != 'success' || needs.e2e-test.result != 'success' }} | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const { owner, repo, pr_number } = ${{ steps.pr_details.outputs.result }}; | |
| const lintStatus = "${{ needs.lint.result }}" === "success" ? "✅" : "❌"; | |
| const unitStatus = "${{ needs.unit-test.result }}" === "success" ? "✅" : "❌"; | |
| const e2eStatus = "${{ needs.e2e-test.result }}" === "success" ? "✅" : "❌"; | |
| github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number: pr_number, | |
| body: `❌ Some checks have failed!\n\n` + | |
| `- Lint: ${lintStatus}\n` + | |
| `- Unit Tests: ${unitStatus}\n` + | |
| `- E2E Tests: ${e2eStatus}\n\n` + | |
| `Please check the workflow logs for details.` | |
| }); | |
| deploy-mcp-worker: | |
| name: Deploy Worker (mcp-server) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # We need Node.js to generate rules and run wrangler/npm | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' # Assuming .nvmrc is in the root | |
| cache: 'npm' | |
| cache-dependency-path: '**/package-lock.json' # Cache npm deps for root and worker | |
| - name: Install root dependencies | |
| run: npm ci | |
| - name: Generate preparedRules.json | |
| run: npm run generate-rules # Assuming direct execution works | |
| - name: Install worker dependencies | |
| run: cd mcp-server && npm ci |