feat: initialize Task 3 - Enhanced Semantic Search Capabilities #27
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: Quality Metrics & Coverage | ||
| on: | ||
| push: | ||
| branches: [main, development] | ||
| pull_request: | ||
| branches: [main, development] | ||
| jobs: | ||
| test-and-coverage: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| env: | ||
| PYTHON_VERSION: "3.10" | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup pixi with cache (attempt 1) | ||
| id: setup-pixi-cache | ||
| uses: prefix-dev/[email protected] | ||
| with: | ||
| pixi-version: v0.49.0 | ||
| cache: true | ||
| continue-on-error: true | ||
| - name: Verify Pixi installation or install manually if cache failed | ||
| if: steps.setup-pixi-cache.outcome == 'failure' || (runner.os == 'Windows' && !contains(env.PATH, '.pixi\\bin')) || (runner.os != 'Windows' && !command -v pixi) | ||
|
Check failure on line 27 in .github/workflows/quality-metrics.yml
|
||
| run: | | ||
| echo "Pixi not found on PATH or setup-pixi-cache failed. Attempting manual installation." | ||
| if [ "${{ runner.os }}" == "Windows" ]; then | ||
| curl -L -o pixi.exe https://github.com/prefix-dev/pixi/releases/download/v0.49.0/pixi-x86_64-pc-windows-msvc.exe | ||
| mkdir -p "$HOME/.pixi/bin" | ||
| mv pixi.exe "$HOME/.pixi/bin/" | ||
| echo "$HOME/.pixi/bin" >> $GITHUB_PATH | ||
| else | ||
| curl -fsSL https://pixi.sh/install.sh | bash | ||
| echo "$HOME/.pixi/bin" >> $GITHUB_PATH | ||
| fi | ||
| echo "Pixi installed manually." | ||
| - name: Install system dependencies | ||
| run: sudo apt-get update && sudo apt-get install -y git | ||
| - name: Activate pixi environment and install dependencies (with retry) | ||
| run: | | ||
| eval "$(pixi shell --env-hook bash)" | ||
| if ! command -v pixi &> /dev/null; then | ||
| echo "Error: pixi command not found after activation. Environment setup failed." | ||
| exit 1 | ||
| fi | ||
| echo "Attempting to install pixi dependencies..." | ||
| n=0 | ||
| until [ "$n" -ge 3 ] | ||
| do | ||
| pixi install --locked && break | ||
| n=$((n+1)) | ||
| echo "pixi install failed, retrying ($n/3)..." | ||
| sleep 5 | ||
| done | ||
| if [ "$n" -ge 3 ]; then | ||
| echo "Failed to install dependencies after multiple retries." | ||
| exit 1 | ||
| fi | ||
| - name: Run tests with coverage (HTML, XML, JSON, Markdown) | ||
| run: | | ||
| eval "$(pixi shell --env-hook bash)" | ||
| pytest tests/ --cov=src/uckn --cov-report=html --cov-report=xml --cov-report=json --cov-report=term --cov-report=term-missing --json-report --json-report-file=pytest-report.json --html=pytest-report.html --self-contained-html | ||
| coverage markdown | ||
| - name: Upload coverage artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-reports | ||
| path: | | ||
| htmlcov/ | ||
| coverage.xml | ||
| coverage.json | ||
| coverage.md | ||
| .coverage* | ||
| pytest-report.json | ||
| pytest-report.html | ||
| - name: diff-cover (PR only) | ||
| if: github.event_name == 'pull_request' | ||
| run: | | ||
| eval "$(pixi shell --env-hook bash)" | ||
| git fetch origin main:refs/remotes/origin/main | ||
| diff-cover coverage.xml --compare-branch=origin/main --fail-under=90 --html-report diffcover.html --markdown-report diffcover.md --json-report diffcover.json | ||
| - name: Upload diff-cover artifacts | ||
| if: github.event_name == 'pull_request' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: diffcover-reports | ||
| path: | | ||
| diffcover.html | ||
| diffcover.md | ||
| diffcover.json | ||
| - name: Comment PR with coverage summary | ||
| if: github.event_name == 'pull_request' | ||
| uses: marocchino/sticky-pull-request-comment@v2 | ||
| with: | ||
| path: coverage.md | ||
| - name: Quality Gate | ||
| run: | | ||
| pixi run quality-gate | ||