Add MIMO, NotMNIST, improve coverage, and Misc #518
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: | |
schedule: | |
- cron: "42 7 * * 0" | |
workflow_dispatch: | |
env: | |
POETRY_VERSION: "1.3.2" | |
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 }} | |
# 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: Cache Packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.local | |
.venv | |
key: poetry-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install and configure Poetry | |
uses: snok/[email protected] | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Cache folder for Torch Uncertainty | |
uses: actions/cache@v3 | |
id: cache-folder | |
with: | |
path: | | |
~/.cache/torch-uncertainty/ | |
key: torch-uncertainty-${{ runner.os }} | |
- name: Install dependencies | |
run: | | |
poetry install --with dev --with docs | |
poetry run pip3 uninstall torch torchvision -y | |
poetry run pip3 install torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu | |
- name: Style checking | |
run: | | |
poetry run flake8 torch_uncertainty tests | |
poetry run isort --check-only torch_uncertainty tests | |
poetry run black --check torch_uncertainty tests | |
- name: Test with pytest and compute coverage | |
run: | | |
poetry run pytest --cov --cov-report xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
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 | |
run: | | |
cd docs && poetry run make html-noplot |