fix test #414
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
| # Surfaces CI/CD Pipeline | |
| # Tests package with minimal and full dependencies across multiple Python versions and OSes | |
| name: tests | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| code-quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install pre-commit | |
| run: pip install pre-commit | |
| - name: Run pre-commit | |
| run: pre-commit run --all-files | |
| test-core: | |
| name: Core Tests (Py ${{ matrix.python-version }}, ${{ matrix.os }}) | |
| needs: code-quality | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| os: [ubuntu-latest] | |
| include: | |
| - os: macos-latest | |
| python-version: "3.11" | |
| - os: windows-latest | |
| python-version: "3.11" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install minimal dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[test-minimal]" | |
| - name: Verify minimal install | |
| run: | | |
| python -c " | |
| import surfaces | |
| print(f'Surfaces version: {surfaces.__version__}') | |
| " | |
| - name: Run core tests | |
| run: >- | |
| python -m pytest -x -p no:warnings tests/core/ | |
| ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' && '--cov=surfaces --cov-report=' || '' }} | |
| - name: Rename coverage data | |
| if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' | |
| run: mv .coverage .coverage.core | |
| - name: Upload coverage data | |
| if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-core | |
| path: .coverage.core | |
| include-hidden-files: true | |
| test-full: | |
| name: Full Tests (Py ${{ matrix.python-version }}, ${{ matrix.os }}) | |
| needs: code-quality | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| os: [ubuntu-latest] | |
| include: | |
| - os: macos-latest | |
| python-version: "3.11" | |
| - os: windows-latest | |
| python-version: "3.11" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # XGBoost requires OpenMP runtime (libomp) on macOS | |
| - name: Install libomp (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install libomp | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install full dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[test]" | |
| - name: Run core and full tests | |
| run: >- | |
| python -m pytest -x -p no:warnings tests/core/ tests/full/ | |
| ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' && '--cov=surfaces --cov-report=' || '' }} | |
| - name: Rename coverage data | |
| if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' | |
| run: mv .coverage .coverage.full | |
| - name: Upload coverage data | |
| if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-full | |
| path: .coverage.full | |
| include-hidden-files: true | |
| test-integration: | |
| name: Integration Tests (Py ${{ matrix.python-version }}) | |
| needs: code-quality | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[test]" | |
| pip install pytest | |
| pip install -r requirements/all_integrations.txt | |
| - name: Run integration tests | |
| run: >- | |
| python -m pytest -x -p no:warnings tests/integration/ | |
| ${{ matrix.python-version == '3.11' && '--cov=surfaces --cov-report=' || '' }} | |
| - name: Rename coverage data | |
| if: matrix.python-version == '3.11' | |
| run: mv .coverage .coverage.integration | |
| - name: Upload coverage data | |
| if: matrix.python-version == '3.11' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-integration | |
| path: .coverage.integration | |
| include-hidden-files: true | |
| test-internal: | |
| name: Internal Tests | |
| needs: code-quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dashboard]" | |
| pip install pytest pytest-cov | |
| - name: Run internal tests | |
| run: python -m pytest -x -p no:warnings tests/internal/ --cov=surfaces --cov-report= | |
| - name: Rename coverage data | |
| run: mv .coverage .coverage.internal | |
| - name: Upload coverage data | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-internal | |
| path: .coverage.internal | |
| include-hidden-files: true | |
| test-examples: | |
| name: Test Examples | |
| needs: code-quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[test]" | |
| pip install -r requirements/all_integrations.txt | |
| - name: Run example tests | |
| run: python -m pytest examples/test_examples.py -v --tb=short --cov=surfaces --cov-report= | |
| - name: Rename coverage data | |
| run: mv .coverage .coverage.examples | |
| - name: Upload coverage data | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-examples | |
| path: .coverage.examples | |
| include-hidden-files: true | |
| test-doc-snippets: | |
| name: Test Doc Snippets | |
| needs: code-quality | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[test]" | |
| pip install -r requirements/all_integrations.txt | |
| - name: Run documentation snippet tests | |
| run: >- | |
| python -m pytest docs/tests/test_doc_snippets.py -v --tb=short | |
| ${{ matrix.python-version == '3.11' && '--cov=surfaces --cov-report=' || '' }} | |
| - name: Rename coverage data | |
| if: matrix.python-version == '3.11' | |
| run: mv .coverage .coverage.doc-snippets | |
| - name: Upload coverage data | |
| if: matrix.python-version == '3.11' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-doc-snippets | |
| path: .coverage.doc-snippets | |
| include-hidden-files: true | |
| # Aggregates coverage fragments from all test jobs instead of re-running tests | |
| coverage: | |
| name: Coverage | |
| needs: [test-core, test-full, test-integration, test-internal, test-examples, test-doc-snippets] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install coverage | |
| run: pip install "coverage[toml]" | |
| - name: Download all coverage data | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: coverage-* | |
| merge-multiple: true | |
| - name: Combine coverage data | |
| run: | | |
| coverage combine | |
| coverage report --show-missing | |
| coverage xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false | |
| verbose: true |