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
name: Rust CI
on:
push:
branches:
pull_request:
branches:
env:
CARGO_TERM_COLOR: always
jobs:
build-test-clippy:
name: Build, test, clippy
runs-on: ubuntu-latest
# Cargo.toml's [patch.crates-io] section unconditionally resolves
# teeny-* deps to ../teenygrad/... (every cargo invocation reads it,
# regardless of which features are enabled) -- must exist as an actual
# sibling directory, matching the local dev layout. actions/checkout
# refuses a path outside github.workspace (confirmed via a live failed
# run: "Repository path '.../teenygrad' is not under '.../vision-rs'"),
# so both repos are checked out as sibling *subdirectories* of the
# workspace instead, with this job's working directory pointed at the
# vision-rs one -- ../teenygrad from there resolves to the teenygrad
# subdirectory, a true sibling on disk either way.
defaults:
run:
working-directory: vision-rs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: vision-rs
- name: Checkout teenygrad (sibling dependency)
uses: actions/checkout@v4
with:
repository: teenygrad/teenygrad
path: teenygrad
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: vision-rs
# The cuda feature (on by default) pulls in teeny-cuda, whose build.rs
# unconditionally runs bindgen against real CUDA headers. Installed
# directly via apt (not the Jimver/cuda-toolkit action -- see
# teenygrad's deploy-docs.yml for why: its version table doesn't cover
# every release, and its default package selection pulls in the real
# nvidia-driver/nvidia-dkms packages, which fail to configure on
# hosted runners with no matching kernel). Only the -dev packages
# build.rs actually links against are installed -- no driver/dkms.
# cuda-profiler-api-13-2 is a separate package from cuda-cudart-dev
# (confirmed via `dpkg -S cuda_profiler_api.h` -- teeny-cuda's
# wrapper.h includes it directly). The nvcc-config-common package
# symlinks /usr/local/cuda -> /usr/local/cuda-13.2 via
# update-alternatives but does NOT put /usr/local/cuda/bin on PATH --
# add it explicitly so both bindgen and docs-site/build.sh's `command
# -v nvcc` detection find it (a real gap discovered here: teenygrad's
# own deploy-docs.yml has been silently skipping teeny-cuda/
# teeny-kernels docs this whole time for exactly this reason).
- name: Install CUDA toolkit
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb -O /tmp/cuda-keyring.deb
sudo dpkg -i /tmp/cuda-keyring.deb
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cuda-nvcc-13-2 cuda-cudart-dev-13-2 cuda-nvrtc-dev-13-2 cuda-driver-dev-13-2 cuda-profiler-api-13-2
echo "/usr/local/cuda/bin" >> "$GITHUB_PATH"
- name: Build
run: cargo build --all-features
- name: Clippy
# --all-targets is deliberately omitted: examples/yolo26.rs (a large,
# separate CLI tool) has pre-existing clippy/fmt debt out of scope
# for this pass. Default clippy (lib + bins only) doesn't touch it.
run: cargo clippy --all-features -- -D warnings
# Even the hardware-independent snapshot tests (comparing generated
# PTX/MLIR text, not running it) call compile_kernel, which shells
# out to teenyc -- a separate compiler fork, not part of the stable
# rustc used to build everything else (confirmed via a live failed
# run: "rustc not found at teenyc"). Installed via cargo-teeny, which
# fetches a prebuilt release rather than building teenyc from source.
- name: Install teenyc toolchain
run: |
cargo install --git https://github.com/teenygrad/cargo-teeny
cargo teeny install-toolchain
echo "TEENYC_PATH=$HOME/.rustup/toolchains/stable-teenyc-x86_64-unknown-linux-gnu/bin/teenyc" >> "$GITHUB_ENV"
- name: Test
# No CUDA-capable GPU on hosted runners -- installing the toolkit
# above gets headers for bindgen (so Build/Clippy above exercise the
# full feature set), but actually *running* a kernel still needs a
# real device. --no-default-features runs the hardware-independent
# subset (mostly graph/snapshot tests, which still need teenyc --
# see above -- to compile kernel source to PTX/MLIR for comparison,
# even though nothing gets executed on a device). Full CUDA-hardware
# integration testing is a local/GPU-runner-only activity for now.
run: cargo test --no-default-features
- name: Doc build
run: cargo doc --no-deps --all-features