-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (66 loc) · 2.4 KB
/
Copy pathci.yml
File metadata and controls
81 lines (66 loc) · 2.4 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
# CPU-only libtorch - CUDA not available on standard runners
LIBTORCH_URL: "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.6.0%2Bcpu.zip"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy, rustfmt
- name: Cache libtorch
id: cache-libtorch
uses: actions/cache@v4
with:
path: /tmp/libtorch
key: libtorch-2.6.0-cpu
- name: Install libtorch
if: steps.cache-libtorch.outputs.cache-hit != 'true'
run: |
curl -L "$LIBTORCH_URL" -o /tmp/libtorch.zip
unzip -q /tmp/libtorch.zip -d /tmp
rm /tmp/libtorch.zip
- name: Set libtorch env
run: |
echo "LIBTORCH=/tmp/libtorch" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/tmp/libtorch/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Build
run: cargo build --workspace
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Format check
run: cargo fmt --all -- --check
- name: SSOT - no hardcoded constants
run: |
rg "1e-6|1e-8|448\.0|10000\.0" \
--include="*.rs" \
--glob="!**/constants.rs" \
--glob="!**/tests/**" \
-q && exit 1 || exit 0
- name: SSOT - no duplicate function defs
run: |
DUPS=$(rg "pub fn to_velocity|pub fn to_denoised|pub fn patchify|pub fn unpatchify" \
--include="*.rs" -c | grep -v ":1$" || true)
if [ -n "$DUPS" ]; then echo "$DUPS"; exit 1; fi
- name: "SSOT - no crate:: imports for shared primitives"
run: |
rg "use crate::(norm|attention|conv|resblock|patchify|fp8)::" \
--include="*.rs" \
--glob="!**/lib.rs" \
-q && exit 1 || exit 0
- name: Regenerate golden files
run: |
pip install torch safetensors numpy --break-system-packages -q
python3 scripts/generate_goldens.py
git diff --exit-code crates/goldens/ || (echo "Golden files out of date! Run: python3 scripts/generate_goldens.py" && exit 1)
- name: Test
run: cargo test --workspace