Skip to content

Merge pull request #184 from Wolfvin/fix/issue-176-affected-typescript #213

Merge pull request #184 from Wolfvin/fix/issue-176-affected-typescript

Merge pull request #184 from Wolfvin/fix/issue-176-affected-typescript #213

Workflow file for this run

name: CodeLens CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
security-events: write
actions: read
jobs:
# ─── Lint & Test ───────────────────────────────────────────────
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: |
pyproject.toml
requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tree-sitter pyyaml pytest pytest-cov pygls lsprotocol
# Install optional grammar packages for full parser coverage
pip install tree-sitter-python tree-sitter-javascript tree-sitter-html tree-sitter-css || true
pip install tree-sitter-typescript tree-sitter-rust || true
- name: Run test suite
run: |
cd scripts && python -m pytest ../tests/ -v --tb=short
# ─── Benchmark ─────────────────────────────────────────────────
benchmark:
name: Quick Benchmark
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: |
pyproject.toml
requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tree-sitter pyyaml
pip install tree-sitter-python tree-sitter-javascript tree-sitter-html tree-sitter-css || true
pip install tree-sitter-typescript tree-sitter-rust || true
- name: Run quick benchmarks
run: |
cd benchmarks && python run_benchmarks.py --quick
# ─── Self-Analysis ─────────────────────────────────────────────
self-check:
name: CodeLens Self-Check
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: |
pyproject.toml
requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tree-sitter pyyaml
pip install tree-sitter-python tree-sitter-javascript tree-sitter-html tree-sitter-css || true
pip install tree-sitter-typescript tree-sitter-rust || true
- name: Run codelens check (self-analysis)
run: |
cd scripts && python codelens.py check . --severity high --format json
continue-on-error: true
- name: Generate SARIF output
run: |
cd scripts && python codelens.py check . --format sarif > ../codelens-results.sarif
continue-on-error: true
- name: Upload SARIF as artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: codelens-sarif
path: codelens-results.sarif
retention-days: 30
# ─── Upload SARIF to GitHub Code Scanning (main only) ──────────
upload-sarif:
name: Upload SARIF to Code Scanning
runs-on: ubuntu-latest
needs: self-check
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
security-events: write
actions: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download SARIF artifact
uses: actions/download-artifact@v4
with:
name: codelens-sarif
- name: Validate SARIF file exists
run: |
if [ ! -f codelens-results.sarif ]; then
echo "::warning::SARIF file not found, skipping upload"
exit 0
fi
# Basic validation: check it's valid JSON
python3 -c "import json; json.load(open('codelens-results.sarif'))" || {
echo "::warning::SARIF file is not valid JSON, skipping upload"
exit 0
}
- name: Upload SARIF to GitHub code scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: codelens-results.sarif
category: codelens