macos build works in CI
This commit is contained in:
37
.github/workflows/main.yml
vendored
37
.github/workflows/main.yml
vendored
@@ -10,13 +10,34 @@ env:
|
|||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
# Job for building on macOS (with Metal)
|
||||||
|
build-macos:
|
||||||
runs-on: ubuntu-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build
|
- name: Setup Python virtual environment
|
||||||
run: cargo build
|
shell: bash
|
||||||
- name: Run tests
|
run: |
|
||||||
run: cargo test
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python3 -m pip install --upgrade pip
|
||||||
|
python3 -m pip install huggingface-hub
|
||||||
|
- name: Login to HuggingFace Hub
|
||||||
|
env:
|
||||||
|
HF_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
source .venv/bin/activate
|
||||||
|
if [ -n "$HF_TOKEN" ]; then
|
||||||
|
echo "Logging into Hugging Face Hub..."
|
||||||
|
huggingface-cli login --token $HF_TOKEN
|
||||||
|
else
|
||||||
|
echo "No HuggingFace token found, skipping login"
|
||||||
|
fi
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
- run: bun install
|
||||||
|
- name: Build (macOS - Metal)
|
||||||
|
# The `metal` feature will be automatically picked up due to target_os = "macos" in Cargo.toml
|
||||||
|
run: cargo build --release
|
||||||
|
- name: Run tests (macOS)
|
||||||
|
run: cargo test
|
||||||
|
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -782,9 +782,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "c1980d53280c8f9e2c6cbe1785855d7ff8010208b46e21252b978badf13ad69d"
|
checksum = "c1980d53280c8f9e2c6cbe1785855d7ff8010208b46e21252b978badf13ad69d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"candle-core",
|
"candle-core",
|
||||||
"candle-metal-kernels",
|
|
||||||
"half",
|
"half",
|
||||||
"metal 0.27.0",
|
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"rayon",
|
"rayon",
|
||||||
"safetensors",
|
"safetensors",
|
||||||
@@ -1381,7 +1379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18"
|
checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2639,7 +2637,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
|
checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.53.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4313,7 +4311,7 @@ dependencies = [
|
|||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5106,7 +5104,7 @@ dependencies = [
|
|||||||
"getrandom 0.3.3",
|
"getrandom 0.3.3",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5925,7 +5923,7 @@ version = "0.1.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@@ -6,8 +6,8 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
accelerate-src = { version = "0.3.2", optional = true }
|
accelerate-src = { version = "0.3.2", optional = true }
|
||||||
candle-datasets = { version = "=0.9.1", optional = true }
|
candle-datasets = { version = "=0.9.1", optional = true }
|
||||||
candle-nn = { version = "=0.9.1", features = ["metal"] }
|
candle-nn = { version = "=0.9.1" }
|
||||||
candle-transformers = { version = "=0.9.1", features = ["metal"] }
|
candle-transformers = { version = "=0.9.1" }
|
||||||
candle-flash-attn = { version = "=0.9.1", optional = true }
|
candle-flash-attn = { version = "=0.9.1", optional = true }
|
||||||
candle-onnx = { version = "=0.9.1", optional = true }
|
candle-onnx = { version = "=0.9.1", optional = true }
|
||||||
|
|
||||||
@@ -21,16 +21,15 @@ num-traits = { version = "0.2.15" }
|
|||||||
palette = { version = "0.7.6", optional = true }
|
palette = { version = "0.7.6", optional = true }
|
||||||
enterpolation = { version = "0.2.1", optional = true}
|
enterpolation = { version = "0.2.1", optional = true}
|
||||||
pyo3 = { version = "0.22.0", features = ["auto-initialize", "abi3-py311"], optional = true }
|
pyo3 = { version = "0.22.0", features = ["auto-initialize", "abi3-py311"], optional = true }
|
||||||
rayon = { version = "1.7.0" }
|
rayon = "1.7.0"
|
||||||
rubato = { version = "0.15.0", optional = true }
|
rubato = { version = "0.15.0", optional = true }
|
||||||
safetensors = { version = "0.4.1" }
|
safetensors = "0.4.1"
|
||||||
serde = { version = "1.0.171", features = ["derive"] }
|
serde = { version = "1.0.171", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.99" }
|
serde_json = "1.0.99"
|
||||||
symphonia = { version = "0.5.3", features = ["all"], optional = true }
|
symphonia = { version = "0.5.3", features = ["all"], optional = true }
|
||||||
tokenizers = { version = "0.21.0", default-features = false, features = ["onig", "http"] }
|
tokenizers = { version = "0.21.0", default-features = false, features = ["onig", "http"] }
|
||||||
cpal = { version = "0.15.2", optional = true }
|
cpal = { version = "0.15.2", optional = true }
|
||||||
pdf2image = { version = "0.1.2" , optional = true}
|
pdf2image = { version = "0.1.2" , optional = true}
|
||||||
candle-core = { version = "=0.9.1", features = ["metal"] }
|
|
||||||
anyhow = "1.0.98"
|
anyhow = "1.0.98"
|
||||||
clap= { version = "4.2.4", features = ["derive"] }
|
clap= { version = "4.2.4", features = ["derive"] }
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
@@ -45,6 +44,18 @@ utoipa = { version = "4.2.0", features = ["axum_extras"] }
|
|||||||
uuid = { version = "1.7.0", features = ["v4"] }
|
uuid = { version = "1.7.0", features = ["v4"] }
|
||||||
reborrow = "0.5.5"
|
reborrow = "0.5.5"
|
||||||
|
|
||||||
|
# --- Add this section for conditional compilation ---
|
||||||
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
|
candle-core = { version = "=0.9.1", features = ["metal"] }
|
||||||
|
|
||||||
|
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
||||||
|
# For Linux or other non-macOS systems, you likely want the CPU backend or CUDA
|
||||||
|
# If you're building on Linux with a CUDA-enabled GPU:
|
||||||
|
candle-core = { version = "=0.9.1", features = ["cuda"], default-features = false } # Or just "cuda" if not using default features
|
||||||
|
|
||||||
|
# If you're building on Linux with only CPU:
|
||||||
|
# candle-core = { version = "=0.9.1", default-features = false } # CPU is often the default, but good to be explicit
|
||||||
|
# --- End of conditional compilation section ---
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = { version = "1", features = ["backtrace"] }
|
anyhow = { version = "1", features = ["backtrace"] }
|
||||||
|
Reference in New Issue
Block a user