-
Notifications
You must be signed in to change notification settings - Fork 354
97 lines (87 loc) · 3.46 KB
/
build_coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Modified from https://github.com/pmeier/light-the-torch
# Modified from https://github.com/pytorch/ignite/blob/master/.github/workflows/pytorch-version-tests.yml
name: build-coverage
on:
push:
branches: [ master ]
paths:
- code_coverage/**
- torchattacks/**
pull_request:
branches: [ master ]
paths:
- code_coverage/**
- torchattacks/**
jobs:
build-coverage:
strategy:
max-parallel: 10
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
# Bugs: 3.10 will become 3.1 if without quotes -> https://github.com/actions/setup-python/issues/695
# For ubuntu 22.04: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
pytorch-version: ["1.9.1", "1.10.1", "1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.0"]
# 1.5.1, 1.4.0 Model load error in robustbench.
# 1.8.1, 1.7.1, 1.6.0 'padding==same' error in TIFGSM
exclude:
# https://github.com/pytorch/vision#installation
# pytorch 2.2 support python from 3.8 to 3.11
- pytorch-version: "2.2.0"
python-version: "3.7"
# pytorch 2.1 support python from 3.8 to 3.11
- pytorch-version: "2.1.2"
python-version: "3.7"
# pytorch 2.0 support python from 3.8 to 3.11
- pytorch-version: "2.0.1"
python-version: "3.7"
# pytorch 1.13 support python from 3.7.2 to 3.10
- pytorch-version: "1.13.1"
python-version: "3.11"
# pytorch 1.12 support python from 3.7 to 3.10
- pytorch-version: "1.12.1"
python-version: "3.11"
# pytorch 1.11 support python from 3.7 to 3.10
- pytorch-version: "1.11.0"
python-version: "3.11"
# pytorch 1.10 support python from 3.6 to 3.9
- pytorch-version: "1.10.1"
python-version: "3.10"
- pytorch-version: "1.10.1"
python-version: "3.11"
# pytorch 1.9 support python from 3.6 to 3.9
- pytorch-version: "1.9.1"
python-version: "3.10"
- pytorch-version: "1.9.1"
python-version: "3.11"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Reinstall setuptools
run: |
python -m pip install --upgrade pip
pip install --upgrade --force-reinstall setuptools==59.8.0
- name: Install dependencies
run: |
pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Set up PyTorch ${{ matrix.pytorch-version }}
run: |
python -m pip install torch==${{ matrix.pytorch-version }} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
export CUDA_VISIBLE_DEVICES=""
- name: Run pytest
run: |
pytest --cov . --cov-report=xml
- name: Upload coverage reports to Codecov
run: |
# Replace `linux` below with the appropriate OS
# Options are `alpine`, `linux`, `macos`, `windows`
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN}