Release v0.2.7: CatBoost standardization and PyPI workflow #20
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: Python Version Compatibility | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| # schedule: | |
| # # Run weekly on Sundays (disabled to save GitHub Actions minutes) | |
| # - cron: '0 0 * * 0' | |
| jobs: | |
| compatibility-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: '3.11' | |
| python-version-short: 'py311' | |
| xgboost-version: '2.1.4' | |
| sklearn-version: '1.3.2' | |
| test-name: 'xgboost-2.x' | |
| - python-version: '3.11' | |
| python-version-short: 'py311' | |
| xgboost-version: '3.0.5' | |
| sklearn-version: '1.6.1' | |
| test-name: 'xgboost-3.x' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache uv dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/uv | |
| key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ matrix.xgboost-version }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-uv-${{ matrix.python-version }}- | |
| ${{ runner.os }}-uv- | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v1 | |
| with: | |
| version: "latest" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --dev | |
| uv add "xgboost==${{ matrix.xgboost-version }}" | |
| if [ "${{ matrix.sklearn-version }}" != "latest" ]; then | |
| uv add "scikit-learn==${{ matrix.sklearn-version }}" | |
| else | |
| uv add "scikit-learn" | |
| fi | |
| - name: Run compatibility tests | |
| run: | | |
| echo "Testing Python ${{ matrix.python-version }} with XGBoost ${{ matrix.xgboost-version }}" | |
| uv run python -c "import xgboost as xgb; print(f'XGBoost version: {xgb.__version__}')" | |
| uv run python -c "import xbooster; print(f'xbooster version: {xbooster.__version__}')" | |
| uv run python -m pytest tests/test_xgboost_compatibility.py -v --tb=short | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.test-name }} | |
| path: | | |
| .pytest_cache/ | |
| test-results/ | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| compatibility-summary: | |
| runs-on: ubuntu-latest | |
| needs: compatibility-test | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all test results | |
| uses: actions/download-artifact@v4 | |
| continue-on-error: true | |
| with: | |
| path: test-results/ | |
| - name: Generate compatibility report | |
| run: | | |
| echo "# Python Version Compatibility Report" > compatibility-report.md | |
| echo "" >> compatibility-report.md | |
| echo "Generated on: $(date)" >> compatibility-report.md | |
| echo "" >> compatibility-report.md | |
| for result in test-results/*; do | |
| if [ -d "$result" ]; then | |
| test_name=$(basename "$result" | sed 's/test-results-//') | |
| echo "## $test_name" >> compatibility-report.md | |
| echo "" >> compatibility-report.md | |
| if [ -d "$result/.pytest_cache" ]; then | |
| echo "✅ Tests completed successfully" >> compatibility-report.md | |
| else | |
| echo "❌ Tests failed or incomplete" >> compatibility-report.md | |
| fi | |
| echo "" >> compatibility-report.md | |
| fi | |
| done | |
| cat compatibility-report.md | |
| - name: Comment on PR | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const report = fs.readFileSync('compatibility-report.md', 'utf8'); | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: report | |
| }); |