-
Notifications
You must be signed in to change notification settings - Fork 445
217 lines (214 loc) · 6.47 KB
/
ci.yaml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Python Checks
on:
pull_request:
push:
branches:
- master
workflow_dispatch:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: "3.10"
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements-dev.txt') }}-lint
- name: Install Ruff
if: steps.cache.outputs.cache-hit != 'true'
run: grep -E 'ruff==' requirements-dev.txt | xargs pip install
- name: Format
run: |
echo "::add-matcher::.github/pylama_matcher.json"
ruff format --config tests/ruff.toml . --check
- name: Lint
run: |
echo "::add-matcher::.github/pylama_matcher.json"
ruff --config tests/ruff.toml .
test-gpu:
runs-on: nvidia-4090
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install uv
uv pip uninstall --system torch torchvision xformers triton imaginairy
uv pip sync --system requirements-dev.txt
pip install -e .
- name: Test with pytest
timeout-minutes: 30
env:
CUDA_LAUNCH_BLOCKING: 1
run: |
pytest --durations=10 -v -m "gputest"
test-non-gpu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
# torch for python 3.12 is not available yet
# https://github.com/pytorch/pytorch/issues/110436
# - "3.12"
os: ["ubuntu-latest"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install uv
uv pip sync --system requirements-dev.txt
pip install -e .
- name: Test with pytest
timeout-minutes: 30
env:
CUDA_LAUNCH_BLOCKING: 1
run: |
pytest --durations=10 -v -m "not gputest"
type-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install -r requirements-dev.txt . --upgrade
- name: Run mypy
run: |
make type-check
build-wheel:
name: Build Wheel
runs-on: ubuntu-latest
outputs:
wheel_name: ${{ steps.set_wheel_name.outputs.wheel_name }}
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install wheel
- name: Build package
run: python setup.py bdist_wheel
- name: Set wheel filename
id: set_wheel_name
run: echo "wheel_name=$(ls dist/*.whl)" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/*.whl
smoke-test-wheel:
needs: build-wheel
name: Smoketest (Python ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Install built wheel
env:
WHEEL_FILENAME: ${{ needs.build-wheel.outputs.wheel_name }}
run: |
python -m pip install uv
uv pip install --system ${{ needs.build-wheel.outputs.wheel_name }}
- name: Generate an image
run: |
imagine fruit --steps 3 --size 512 --seed 1
- uses: actions/upload-artifact@v3
with:
name: images
path: outputs/generated/*.jpg
smoke-test-wheel-conda:
needs: build-wheel
name: Smoketest (Conda, Python ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11" ]
os: [ "ubuntu-latest", "windows-latest", "macos-latest" ]
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: test-env
create-env-file: true
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Install built wheel
shell: bash -l {0}
env:
WHEEL_FILENAME: ${{ steps.set-wheel-name.outputs.WHEEL_FILENAME }}
run: |
conda activate test-env
python -m pip install uv
uv pip install ${{ needs.build-wheel.outputs.wheel_name }}
- name: Generate an image
shell: bash -l {0}
run: |
conda activate test-env
imagine fruit --steps 3 --size 512 --seed 1
- uses: actions/upload-artifact@v3
with:
name: images
path: outputs/generated/*.jpg
publish-docs:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: python -m pip install -r requirements-dev.in . --upgrade
- run: mkdocs gh-deploy --force