Skip to content

Support for UQ with conformal prediction #2418

Support for UQ with conformal prediction

Support for UQ with conformal prediction #2418

Workflow file for this run

name: ci
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
if: github.event.pull_request.draft == false || github.event_name == 'push'
name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
# only run for MSV Python 3.10 on PRs, but all versions on pushes to main
python-version: ${{ github.event_name == 'push' && fromJSON('["3.10", "3.11", "3.12"]') || fromJSON('["3.10"]') }}
env:
TURN_OFF_MPS_IF_RUNNING_CI: 1
MPLBACKEND: Agg
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
activate-environment: true
- name: Install dependencies
run: |
uv pip install -e .[dev,spatiotemporal]
- name: Test with pytest
run: |
# stop pytest after 3 failures to save CI time
pytest --maxfail=3 --cov=autoemulate --cov-report=xml --cov-report=html
- name: Upload Coverage
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: false
# # Clean python cache files
# - name: Clean cache files
# run: |
# find . -type f -name "*.pyc" -delete
# find . -type d -name "__pycache__" -delete
# rm -f .coverage* coverage.xml
# - name: Switch to CPU version of PyTorch
# run: |
# pip uninstall torch -y
# pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cpu
# - name: Verify PyTorch installation
# run: |
# python -c "import torch; print(torch.__version__); print('CUDA available:', torch.cuda.is_available())"
# - name: Debug Coverage Config
# run: |
# cat pyproject.toml
# coverage debug config
# - name: Run Tests with Coverage
# run: |
# coverage run --source=. --omit="v0/*" -m pytest
# coverage xml -i -o coverage.xml
# env:
# COVERAGE_FILE: ".coverage.${{ matrix.python-version }}"
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # Required for private repos
# file: ./coverage.xml # Specify the coverage report file
# fail_ci_if_error: true
# verbose: true
# - name: Store coverage file
# uses: actions/upload-artifact@v4
# with:
# name: coverage
# path: .coverage.${{ matrix.python-version }}
# include-hidden-files: true
# # Coverage job to comment on PRs and update README badge
# coverage:
# runs-on: ubuntu-latest
# needs: tests
# permissions:
# pull-requests: write
# contents: write
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Download coverage artifact
# uses: actions/download-artifact@v4
# with:
# name: coverage
# # Comment coverage details on PR
# - name: Coverage comment
# id: coverage_comment
# uses: py-cov-action/python-coverage-comment-action@v3
# with:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# MERGE_COVERAGE_FILES: true
# # Store comment to be posted if written
# - name: Store Pull Request comment to be posted
# uses: actions/upload-artifact@v4
# if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
# with:
# name: python-coverage-comment-action
# path: python-coverage-comment-action.txt