-
Notifications
You must be signed in to change notification settings - Fork 23
243 lines (207 loc) · 6.67 KB
/
build.yml
File metadata and controls
243 lines (207 loc) · 6.67 KB
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
name: Build
on:
pull_request:
paths-ignore:
- README.md
- CHANGELOG.md
push:
paths-ignore:
- README.md
- CHANGELOG.md
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
permissions:
contents: read
jobs:
build:
name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.12"
- os: ubuntu-latest
python-version: "3.13"
- os: macos-latest
python-version: "3.13"
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Install uv and Python
uses: astral-sh/setup-uv@v7
with:
version: "0.8.0"
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Sync locked environment
run: uv sync --frozen --all-extras
- name: Install ffmpeg on macOS
if: runner.os == 'macOS'
run: |
if command -v ffmpeg >/dev/null 2>&1; then
echo "ffmpeg already available"
else
brew install ffmpeg
fi
- name: Render Cog build artifacts
run: ./cog/render_artifacts.sh
- name: Compile Python sources
run: uv run python -m compileall clip.py cog_predictor.py replicate_run.py core renderers tests
- name: Smoke test CLI entrypoints
run: |
uv run python clip.py --help >/dev/null
uv run python replicate_run.py --help >/dev/null
- name: Run test suite
run: uv run pytest
render-smoke:
name: ubuntu-latest / Mici UI Smoke
needs: build
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Install uv and Python
uses: astral-sh/setup-uv@v7
with:
version: "0.8.0"
python-version: "3.13"
enable-cache: true
- name: Sync locked environment
run: uv sync --frozen --all-extras
- name: Install UI render dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
capnproto \
ffmpeg \
git-lfs \
libegl1-mesa-dev \
libxcursor-dev \
libxext-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev \
mesa-utils \
xorg-dev \
xserver-xorg-core \
zstd
- name: Render mici UI smoke clip
run: bash ./common/render_mici_smoke.sh
- name: Upload mici UI smoke artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: mici-ui-smoke-${{ github.event_name }}
path: |
shared/ci-e2e/mici-ui-smoke.mp4
shared/ci-e2e/mici-ui-smoke.png
shared/ci-e2e/mici-ui-smoke.json
if-no-files-found: warn
retention-days: 7
cog-build-smoke:
name: ubuntu-latest / Cog Build Smoke
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/codex/add-github-actions-cog-build'
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Free runner disk space
run: |
echo "Disk before cleanup:"
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache
sudo apt-get clean
docker system prune -af || true
docker builder prune -af || true
echo "Disk after cleanup:"
df -h
- name: Install uv and Python
uses: astral-sh/setup-uv@v7
with:
version: "0.8.0"
python-version: "3.12"
enable-cache: true
- name: Render Cog build artifacts
run: ./cog/render_artifacts.sh
- name: Set up Cog
uses: replicate/setup-cog@v2
with:
cog-version: "v0.17.2"
- name: Print tool versions
run: |
python3 --version
uv --version
cog --version
docker version
- name: Build Cog image
run: cog build --progress plain -f cog.yaml
cog-buildx-cache-probe:
name: ubuntu-latest / Cog Buildx Cache Probe
if: github.ref == 'refs/heads/codex/add-github-actions-cog-build'
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Free runner disk space
run: |
echo "Disk before cleanup:"
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache
sudo apt-get clean
docker system prune -af || true
docker builder prune -af || true
echo "Disk after cleanup:"
df -h
- name: Install uv and Python
uses: astral-sh/setup-uv@v7
with:
version: "0.8.0"
python-version: "3.12"
enable-cache: true
- name: Render Cog build artifacts
run: ./cog/render_artifacts.sh
- name: Set up Cog
uses: replicate/setup-cog@v2
with:
cog-version: "v0.17.2"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Generate Dockerfile from Cog
run: |
cog --debug debug -f cog.yaml > "${RUNNER_TEMP}/cog.generated.Dockerfile" 2> "${RUNNER_TEMP}/cog.debug.log"
python3 scripts/materialize_cog_debug_context.py \
--dockerfile "${RUNNER_TEMP}/cog.generated.Dockerfile" \
--debug-log "${RUNNER_TEMP}/cog.debug.log"
sed -n '/Generated requirements.txt:/,$p' "${RUNNER_TEMP}/cog.debug.log"
sed -n '1,40p' "${RUNNER_TEMP}/cog.generated.Dockerfile"
- name: Build generated Dockerfile with GHA cache
uses: docker/build-push-action@v7
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ${{ runner.temp }}/cog.generated.Dockerfile
push: false
provenance: false
tags: cog-op-replay-clipper-buildx-cache-probe:latest
cache-from: |
type=gha,scope=cog-generated-cog-yaml
cache-to: |
type=gha,mode=max,scope=cog-generated-cog-yaml