name: Tests on: push: branches: [ main, dev ] pull_request: branches: [ main, dev ] workflow_dispatch: # Allow manual trigger jobs: test: name: Run Tests (Python ${{ matrix.python-version }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ["3.10", "3.11"] steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 # Full history for better coverage reports - name: Set up SSH key for private repos uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install uv uses: astral-sh/setup-uv@v4 with: enable-cache: true cache-dependency-glob: "uv.lock" - name: Install dependencies env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | uv sync - name: Run tests with coverage env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | make test-coverage - name: Generate coverage badge if: matrix.python-version == '3.10' run: | COVERAGE=$(uv run coverage report | grep TOTAL | awk '{print $NF}' | sed 's/%//') echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV echo "Coverage: $COVERAGE%" - name: Upload coverage reports to Codecov if: matrix.python-version == '3.10' uses: codecov/codecov-action@v4 with: file: ./coverage.xml fail_ci_if_error: false token: ${{ secrets.CODECOV_TOKEN }} continue-on-error: true - name: Upload coverage HTML report if: matrix.python-version == '3.10' uses: actions/upload-artifact@v4 with: name: coverage-report path: htmlcov/ retention-days: 30 - name: Test Summary if: always() run: | echo "## Test Results :test_tube:" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "Python Version: ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY echo "Status: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY