-
-
Notifications
You must be signed in to change notification settings - Fork 7
98 lines (82 loc) · 3.06 KB
/
ci.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
98
name: Continious Integration
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.9, "3.10"]
torch-version: [1.13.1, 2.5.1]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Restore Ubuntu cache
uses: actions/cache@v4
if: matrix.os == 'ubuntu-latest'
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-
- name: Restore MacOS cache
uses: actions/cache@v4
if: matrix.os == 'macos-latest'
with:
path: ~/Library/Caches/pip
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-
- name: Restore Windows cache
uses: actions/cache@v4
if: matrix.os == 'windows-latest'
with:
path: ~\AppData\Local\pip\Cache
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install package in development mode
run: pip install -e .[dev]
- name: Show installed packages
run: pip list
- name: Lint with flake8, black and isort
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
black . --check --config pyproject.toml
isort -c .
# exit-zero treats all errors as warnings. Allowed max line length is 120.
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Install Numpy
run: >
pip install numpy
- name: Install PyTorch==1.13.1 on Linux and Windows
if: >
(matrix.os == 'ubuntu-latest' ||
matrix.os == 'windows-latest') &&
matrix.torch-version == '1.13.1'
run: >
pip install torch==${{ matrix.torch-version }}+cpu
-f https://download.pytorch.org/whl/torch_stable.html
- name: Install PyTorch==2.5.1 on Linux and Windows
if: >
(matrix.os == 'ubuntu-latest' ||
matrix.os == 'windows-latest') &&
matrix.torch-version == '2.5.1'
run: >
pip install torch==${{ matrix.torch-version }}
-f https://download.pytorch.org/whl/torch_stable.html
- name: Install balanced-loss package from local setup.py
run: >
pip install -e .
- name: Unittest balanced-loss
run: |
python -m unittest