🔨 Rework for Probabilistic Regression & Pixel Regression #1478
This file contains 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: Tests | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
- dev | |
schedule: | |
- cron: "42 7 * * 0" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
# Update full Python version | |
- name: Full Python version | |
run: | | |
echo "PYTHON_VERSION=$(python -c "import platform; print(platform.python_version())")" | |
echo "PYTHON_VERSION=$(python -c "import platform; print(platform.python_version())")" >> $GITHUB_ENV | |
- name: Get changed files | |
id: changed-files-specific | |
uses: tj-actions/changed-files@v42 | |
with: | |
files: | | |
auto_tutorials_source/** | |
data/** | |
experiments/** | |
docs/** | |
*.md | |
*.yaml | |
*.yml | |
LICENSE | |
.gitignore | |
- name: Cache folder for TorchUncertainty | |
if: steps.changed-files-specific.outputs.only_changed != 'true' | |
uses: actions/cache@v4 | |
id: cache-folder | |
with: | |
path: | | |
~/.cache/torch-uncertainty/ | |
key: torch-uncertainty-${{ runner.os }} | |
- name: Install dependencies | |
if: steps.changed-files-specific.outputs.only_changed != 'true' | |
run: | | |
python3 -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu | |
python3 -m pip install .[all] | |
- name: Check style & format | |
if: steps.changed-files-specific.outputs.only_changed != 'true' | |
run: | | |
python3 -m ruff check torch_uncertainty --no-fix --statistics | |
python3 -m ruff format torch_uncertainty --check | |
- name: Test with pytest and compute coverage | |
if: steps.changed-files-specific.outputs.only_changed != 'true' | |
run: | | |
python3 -m pytest --cov --cov-report xml --durations 10 --junitxml=junit.xml | |
- name: Upload coverage to Codecov | |
if: steps.changed-files-specific.outputs.only_changed != 'true' && (github.event_name != 'pull_request' || github.base_ref == 'dev') | |
uses: codecov/codecov-action@v4 | |
continue-on-error: true | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
flags: cpu,pytest | |
name: CPU-coverage | |
env_vars: PYTHON_VERSION | |
- name: Upload test results to Codecov | |
if: steps.changed-files-specific.outputs.only_changed != 'true' && (github.event_name != 'pull_request' || github.base_ref == 'dev') | |
uses: codecov/test-results-action@v1 | |
continue-on-error: true | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: cpu,pytest | |
env_vars: PYTHON_VERSION | |
- name: Test sphinx build without tutorials | |
if: steps.changed-files-specific.outputs.only_changed != 'true' | |
run: | | |
cd docs && make clean && make html-noplot |