feat(infra): GitHub Actions CI pipeline + PR/issue templates + CODEOWNERS #1
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt --break-system-packages || pip install -r requirements.txt | |
| - name: Run tests with coverage | |
| run: | | |
| python -m pytest tests/ -v --tb=short \ | |
| --cov=backend --cov=godelOS \ | |
| --cov-report=term-missing \ | |
| --cov-report=xml:coverage.xml \ | |
| --junitxml=test-results.xml \ | |
| --no-cov-on-fail | |
| - name: Generate coverage report | |
| if: always() | |
| run: | | |
| python -m coverage report --format=markdown > coverage-summary.md || echo "Coverage report unavailable — tests may not have produced coverage data." > coverage-summary.md | |
| - name: Add coverage to job summary | |
| if: always() | |
| run: | | |
| echo "## 🧪 Test Results — Python ${{ matrix.python-version }}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| if [ -f coverage-summary.md ]; then | |
| cat coverage-summary.md >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| - name: Comment PR with test results | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| let body = `### 🧪 CI Results — Python ${{ matrix.python-version }}\n\n`; | |
| if (fs.existsSync('coverage-summary.md')) { | |
| body += fs.readFileSync('coverage-summary.md', 'utf8'); | |
| } else { | |
| body += 'Coverage report not available.\n'; | |
| } | |
| const comments = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const marker = `CI Results — Python ${{ matrix.python-version }}`; | |
| const existing = comments.data.find(c => c.body.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } |