Merge pull request #271 from blalterman/auto-update-requirements #353
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: CI | ||
| on: | ||
| push: | ||
| branches: ['**'] # Trigger on all branches | ||
| pull_request: | ||
| branches: ['**'] # Trigger on PRs to any branch | ||
| jobs: | ||
| build: | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| python-version: ['3.10', '3.11', '3.12'] | ||
| # Exclude problematic combinations if needed | ||
| exclude: | ||
| # No exclusions needed for Python 3.10+ support | ||
| fail-fast: false # Continue testing other combinations on failure | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| # Add caching for faster builds | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cache/pip | ||
| ~/Library/Caches/pip | ||
| ~\AppData\Local\pip\Cache | ||
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | ||
| ${{ runner.os }}-pip- | ||
| - name: Install system dependencies | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libhdf5-dev pkg-config | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip wheel | ||
| # Install pytables separately with verbose output for debugging | ||
| pip install --verbose tables | ||
| pip install -r requirements-dev.txt | ||
| pip install -e . | ||
| - name: Lint code | ||
| run: flake8 | ||
| - name: Lint docs | ||
| run: doc8 README.rst docs CITATION.rst --ignore-path docs/source/solarwindpy.solar_activity.tests.rst | ||
| - name: Run tests with coverage | ||
| run: | | ||
| pip install pytest-cov pytest-xdist pytest-html | ||
| mkdir -p test-results | ||
| pytest --cov=solarwindpy \ | ||
| --cov-report=term \ | ||
| --cov-report=xml \ | ||
| --cov-report=html \ | ||
| --junitxml=pytest-report.xml \ | ||
| --html=test-results/report.html \ | ||
| --self-contained-html \ | ||
| -v | ||
| - name: Check for circular imports | ||
| run: pytest tests/test_circular_imports.py -v | ||
| # Upload coverage reports | ||
| - name: Upload coverage to Codecov | ||
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: ./coverage.xml | ||
| fail_ci_if_error: false | ||
| verbose: true | ||
| continue-on-error: true # Don't fail if token not configured | ||
| # Upload coverage artifacts (enhanced for debugging) | ||
| - name: Upload coverage artifacts | ||
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report-${{ github.run_id }} | ||
| path: | | ||
| htmlcov/ | ||
| coverage.xml | ||
| .coverage | ||
| retention-days: 90 | ||
| # Upload test results for all combinations (public repo = unlimited storage) | ||
| - name: Upload test results | ||
| if: always() # Upload even if tests fail | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results-${{ matrix.os }}-py${{ matrix.python-version }}-${{ github.run_id }} | ||
| path: | | ||
| test-results/ | ||
| pytest-report.xml | ||
| .pytest_cache/ | ||
| retention-days: 30 | ||