-
Notifications
You must be signed in to change notification settings - Fork 27
164 lines (139 loc) · 4.59 KB
/
tests.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: tests
on:
push:
branches: [master]
pull_request:
branches:
- master
schedule:
# Run every Sunday
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev/lint.txt
- name: Lint package
run: |
make lint
tests:
name: Test suite (${{ matrix.os }}, Python ${{ matrix.python-version }})
needs: code-quality
runs-on: ${{ matrix.os }}
env:
DISTUTILS_USE_SDK: 1 # for MSVC compiler
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.8, 3.9]
steps:
- if: matrix.os == 'ubuntu-latest'
name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 10240 # for pip packages in /tmp
- uses: actions/checkout@v2
- name: Setup FFmpeg
uses: Iamshankhadeep/[email protected]
with:
# Not strictly necessary, but it may prevent rate limit
# errors especially on GitHub-hosted macos machines.
token: ${{ secrets.GITHUB_TOKEN }}
version: "4.4"
- name: Configure Windows compilers
uses: ilammy/msvc-dev-cmd@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Run tests
run: |
make tests
- name: Run densepose tests
env:
ZAMBA_RUN_DENSEPOSE_TESTS: 1
run: |
# torch is alread installed, so just add the densepose extra
pip install -e .[tests,densepose]
make densepose-tests
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true
test-install:
name: Test install from built distributions
needs: tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Setup FFmpeg
uses: Iamshankhadeep/[email protected]
with:
# Not strictly necessary, but it may prevent rate limit
# errors especially on GitHub-hosted macos machines.
token: ${{ secrets.GITHUB_TOKEN }}
version: "4.4"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Build package
run: |
make dist
- name: Install wheel; test CLI + models with assets
run: |
python -m venv .venv-whl
PYTHON_BIN=bin/python
.venv-whl/$PYTHON_BIN -m pip install --upgrade pip
.venv-whl/$PYTHON_BIN -m pip install dist/zamba-*.whl
.venv-whl/$PYTHON_BIN -m zamba --help
.venv-whl/$PYTHON_BIN -c "from zamba.data.video import MegadetectorLiteYoloX; MegadetectorLiteYoloX()"
- name: Install source; test CLI + models with assets
run: |
python -m venv .venv-sdist
PYTHON_BIN=bin/python
.venv-sdist/$PYTHON_BIN -m pip install --upgrade pip
.venv-sdist/$PYTHON_BIN -m pip install dist/zamba-*.tar.gz
.venv-sdist/$PYTHON_BIN -m zamba --help
.venv-sdist/$PYTHON_BIN -c "from zamba.data.video import MegadetectorLiteYoloX; MegadetectorLiteYoloX()"
notify:
name: Notify failed build
needs: [code-quality, tests, test-install]
if: failure() && (github.event_name == 'push' || github.event_name == 'schedule')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_NAME: ${{ github.workflow }}
RUN_NUMBER: ${{ github.run_number}}
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
with:
filename: .github/failed_build_issue_template.md