✨ Add ResNet-20 #759
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@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
# 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@v34 | |
with: | |
files: | | |
auto_tutorials_source/** | |
data/** | |
experiments/** | |
README.md | |
CONTRIBUTING.md | |
- name: Cache folder for Torch Uncertainty | |
if: steps.changed-files-specific.outputs.only_changed != 'true' | |
uses: actions/cache@v3 | |
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 --extra-index-url https://download.pytorch.org/whl/cpu | |
python3 -m pip install .[dev,docs] | |
- name: Check style & format | |
if: steps.changed-files-specific.outputs.only_changed != 'true' | |
run: | | |
python3 -m ruff check torch_uncertainty tests --no-fix --exit-non-zero-on-fix | |
python3 -m ruff format torch_uncertainty tests --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 | |
- 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@v3 | |
continue-on-error: true | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
flags: cpu,pytest | |
name: CPU-coverage | |
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 |