| 1 |
name: Tests |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
pull_request: |
| 8 |
|
| 9 |
jobs: |
| 10 |
build: |
| 11 |
|
| 12 |
runs-on: ubuntu-latest |
| 13 |
strategy: |
| 14 |
max-parallel: 4 |
| 15 |
matrix: |
| 16 |
python-version: [3.6, 3.7] |
| 17 |
|
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v1 |
| 20 |
- name: Set up Python ${{ matrix.python-version }} |
| 21 |
uses: actions/setup-python@v1 |
| 22 |
with: |
| 23 |
python-version: ${{ matrix.python-version }} |
| 24 |
- uses: actions/cache@v1 |
| 25 |
with: |
| 26 |
path: ~/.cache/pip |
| 27 |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 28 |
restore-keys: | |
| 29 |
${{ runner.os }}-pip- |
| 30 |
- name: Install requirements-dev.txt |
| 31 |
run: | |
| 32 |
python -m pip install --upgrade pip setuptools |
| 33 |
pip install -r requirements-dev.txt |
| 34 |
- name: flake8 |
| 35 |
run: | |
| 36 |
flake8 . --count --show-source --statistics |
| 37 |
- name: black |
| 38 |
run: | |
| 39 |
black --check --verbose . |
| 40 |
- name: Install package |
| 41 |
run: | |
| 42 |
pip install -e . |
| 43 |
- name: Install requirements.txt |
| 44 |
run: | |
| 45 |
function retry-with-backoff() { |
| 46 |
for BACKOFF in 0 1 2 4 8 16 32 64; do |
| 47 |
sleep $BACKOFF |
| 48 |
if "$@"; then |
| 49 |
return 0 |
| 50 |
fi |
| 51 |
done |
| 52 |
return 1 |
| 53 |
} |
| 54 |
retry-with-backoff pip install -r requirements.txt |
| 55 |
- name: mypy (package) |
| 56 |
run: | |
| 57 |
mypy -p eagerpy |
| 58 |
- name: mypy (tests) |
| 59 |
run: | |
| 60 |
mypy tests/ |
| 61 |
- name: Test with pytest |
| 62 |
run: | |
| 63 |
pytest --cov-report term-missing --cov=eagerpy --verbose |
| 64 |
- name: Test with pytest (NumPy) |
| 65 |
run: | |
| 66 |
pytest --cov-report term-missing --cov=eagerpy --cov-append --verbose --backend numpy |
| 67 |
- name: Test with pytest (PyTorch) |
| 68 |
run: | |
| 69 |
pytest --cov-report term-missing --cov=eagerpy --cov-append --verbose --backend pytorch |
| 70 |
- name: Test with pytest (JAX) |
| 71 |
run: | |
| 72 |
pytest --cov-report term-missing --cov=eagerpy --cov-append --verbose --backend jax |
| 73 |
- name: Test with pytest (TensorFlow) |
| 74 |
run: | |
| 75 |
pytest --cov-report term-missing --cov=eagerpy --cov-append --verbose --backend tensorflow |
| 76 |
- name: Codecov |
| 77 |
continue-on-error: true |
| 78 |
env: |
| 79 |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 80 |
run: | |
| 81 |
codecov |
| 82 |
- name: Coveralls |
| 83 |
continue-on-error: true |
| 84 |
env: |
| 85 |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 86 |
run: | |
| 87 |
coveralls |