Skip to content

Fix guide github action #679

Fix guide github action

Fix guide github action #679

Workflow file for this run

name: Tests
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 20
matrix:
python-version: ['3.9', '3.10']
backend: ["none", "pytorch", "tensorflow", "jax", "numpy"]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
with:
path: ~/.cache/torch
key: ${{ runner.os }}-cache-torch
- uses: actions/cache@v1
with:
path: ~/.torch
key: ${{ runner.os }}-torch
- uses: actions/cache@v1
with:
path: ~/.keras
key: ${{ runner.os }}-keras
# - name: debugging
# run: |
# python3 -c 'from urllib.request import urlopen; r = urlopen("https://download.pytorch.org/models/resnet18-5c106cde.pth"); print(r.status, r.reason, r.msg)' || true
# - name: workaround for https://github.com/pytorch/vision/issues/1876
# uses: wei/wget@v1
# with:
# args: https://download.pytorch.org/models/resnet18-5c106cde.pth
# - name: workaround (step 2)
# run: |
# mkdir -p ~/.cache/torch/checkpoints || true
# mv resnet18-5c106cde.pth ~/.cache/torch/checkpoints || true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements.txt
run: |
function retry-with-backoff() {
for BACKOFF in 0 1 2 4 8 16 32 64; do
sleep $BACKOFF
if "$@"; then
return 0
fi
done
return 1
}
python -m pip install --upgrade pip setuptools wheel
retry-with-backoff pip install -r requirements.txt
- name: flake8
run: |
flake8 . --count --show-source --statistics
- name: black
run: |
black --check --verbose .
- name: Install package
run: |
pip install -e .
- name: Install tests/requirements.txt
run: |
function retry-with-backoff() {
for BACKOFF in 0 1 2 4 8 16 32 64; do
sleep $BACKOFF
if "$@"; then
return 0
fi
done
return 1
}
retry-with-backoff pip install -r tests/requirements.txt
- name: mypy (package)
run: |
mypy --install-types --non-interactive foolbox/
mypy -p foolbox
- name: mypy (tests)
run: |
mypy tests/
- name: Test with pytest (backend ${{ matrix.backend }})
run: |
pytest --durations=0 --cov-report term-missing --cov=foolbox --verbose --backend ${{ matrix.backend }}
- name: Codecov
continue-on-error: true
env:
CODECOV_TOKEN: "60c0d7ac-8ec1-47c6-b3b1-ac2ad2dea76f"
run: |
codecov
- name: Coveralls
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: "2r76Cn01kW1sSkEirJ3SRpp478NJtPNdA"
run: |
coveralls