Skip to content

test: assert the suffix-distinct module names, not merely that they differ #2996

test: assert the suffix-distinct module names, not merely that they differ

test: assert the suffix-distinct module names, not merely that they differ #2996

Workflow file for this run

name: SonarCloud
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
sonarcloud:
name: SonarCloud Analysis
# The PR author, not github.actor: the actor is whoever triggered the run
# (e.g. a maintainer pushing to a Dependabot PR), and the sonar-gate job in
# ci.yml mirrors this condition, so both must key on the same field.
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.1
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- name: Install dependencies
run: uv sync --extra treesitter-full --extra test --extra semantic --extra milvus --group dev
# This job runs the same unit suite as ci.yml, so it hits the same
# embedding-model download and the same 429s (issue #1092).
- name: Cache HuggingFace hub
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/huggingface
key: hf-unixcoder-base-${{ runner.os }}-v1
- name: Prefetch embedding model
shell: bash
run: |
for attempt in 1 2 3; do
if uv run --no-sync python -c "
from huggingface_hub import snapshot_download
snapshot_download('microsoft/unixcoder-base')
"; then
exit 0
fi
echo "prefetch attempt $attempt failed; retrying"
sleep $((attempt * 15))
done
echo "could not fetch the embedding model after 3 attempts"
exit 1
- name: Run tests with coverage
run: uv run pytest -n auto -m "not integration" --tb=short --cov=codebase_rag --cov-report=xml
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}