feat(js): add pixi environment and update CI to use pixi (#2206)

This commit is contained in:
Bas Zalmstra 2026-03-11 12:45:01 +01:00 committed by GitHub
parent d2b3a52868
commit c56bf35ac3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 2116 additions and 61 deletions

4
.gitattributes vendored
View file

@ -1,2 +1,2 @@
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
Cargo.lock merge=binary linguist-generated=true
**/pixi.lock merge=binary linguist-language=YAML linguist-generated=true
**/Cargo.lock merge=binary linguist-generated=true

View file

@ -33,44 +33,34 @@ jobs:
format_lint_test:
name: Format, Lint and Test the JS bindings
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["20.x"]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: prefix-dev/setup-pixi@82d477f15f3a381dbcc8adc1206ce643fe110fb7 # v0.9.3
with:
node-version: ${{ matrix.node-version }}
manifest-path: js-rattler/pixi.toml
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
workspaces: js-rattler
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install Rust toolchain
run: |
rustup component add clippy rustfmt
rustup target add wasm32-unknown-unknown
rustup component add rust-src --target wasm32-unknown-unknown
- name: Run rustfmt
working-directory: js-rattler
run: cargo fmt --all --check
- name: Run clippy
run: cargo clippy --all-targets
working-directory: js-rattler
run: pixi run cargo fmt --all --check
- run: npm ci
- name: Run clippy
working-directory: js-rattler
- run: npm run fmt:check
run: pixi run cargo clippy --all-targets
- name: Check formatting
working-directory: js-rattler
- run: npm run build
working-directory: js-rattler
- run: npm test
run: pixi run fmt-check
- name: Build and test
working-directory: js-rattler
run: pixi run test
# some e2e test to make sure our build works
- run: |

View file

@ -70,27 +70,20 @@ jobs:
fetch-depth: 0
submodules: recursive
lfs: false
- uses: prefix-dev/setup-pixi@82d477f15f3a381dbcc8adc1206ce643fe110fb7 # v0.9.3
with:
manifest-path: js-rattler/pixi.toml
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
workspaces: js-rattler
- name: Install Rust toolchain
run: |
rustup component add clippy rustfmt
rustup target add wasm32-unknown-unknown
rustup component add rust-src --target wasm32-unknown-unknown
- name: Install Node.js
- name: Install Node.js (for npm publish)
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- name: Build and pack
working-directory: js-rattler
- run: npm run build
working-directory: js-rattler
- run: npm pack
working-directory: js-rattler
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pixi run pack
- name: Upload package tarball
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:

View file

@ -1 +0,0 @@
*.json linguist-language=JSON-with-Comments

View file

@ -7,3 +7,6 @@ types/
node_modules/
wasm-pack.log
!Cargo.lock
# pixi environments
.pixi/*
!.pixi/config.toml

117
js-rattler/Cargo.lock generated
View file

@ -76,6 +76,21 @@ dependencies = [
"xattr",
]
[[package]]
name = "astral_async_zip"
version = "0.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab72a761e6085828cc8f0e05ed332b2554701368c5dc54de551bfaec466518ba"
dependencies = [
"async-compression",
"crc32fast",
"futures-lite",
"pin-project",
"thiserror 1.0.69",
"tokio",
"tokio-util",
]
[[package]]
name = "async-compression"
version = "0.4.32"
@ -85,6 +100,7 @@ dependencies = [
"compression-codecs",
"compression-core",
"futures-core",
"futures-io",
"pin-project-lite",
"tokio",
]
@ -110,6 +126,16 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a"
[[package]]
name = "async-spooled-tempfile"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dd9c58a1dbecfc23aa470d57e5aff60877ab1b459bf05e60e861dd18fcaa5f5"
dependencies = [
"tempfile",
"tokio",
]
[[package]]
name = "async-trait"
version = "0.1.89"
@ -121,6 +147,26 @@ dependencies = [
"syn",
]
[[package]]
name = "async_http_range_reader"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b537c00269e3f943e06f5d7cabf8ccd281b800fd0c7f111dd82f77154334197"
dependencies = [
"bisection",
"futures",
"http-content-range",
"itertools 0.13.0",
"memmap2",
"reqwest",
"reqwest-middleware",
"thiserror 1.0.69",
"tokio",
"tokio-stream",
"tokio-util",
"tracing",
]
[[package]]
name = "atomic-waker"
version = "1.1.2"
@ -139,6 +185,12 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bisection"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "021e079a1bab0ecce6cf4b4b74c0c37afa4a697136eb3b127875c84a8f04a8c3"
[[package]]
name = "bit-set"
version = "0.8.0"
@ -576,7 +628,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
name = "file_url"
version = "0.2.7"
dependencies = [
"itertools",
"itertools 0.14.0",
"percent-encoding",
"thiserror 2.0.17",
"typed-path",
@ -740,6 +792,19 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-lite"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
[[package]]
name = "futures-macro"
version = "0.3.31"
@ -872,6 +937,8 @@ version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash 0.1.5",
]
@ -953,6 +1020,12 @@ dependencies = [
"time",
]
[[package]]
name = "http-content-range"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66cdb727cec723cee65912a74a7f9f0c3ad0c6f9df4f03d05a5c7a15398bbad1"
[[package]]
name = "http-serde"
version = "2.1.1"
@ -1224,6 +1297,15 @@ dependencies = [
"serde",
]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.14.0"
@ -1776,7 +1858,7 @@ dependencies = [
[[package]]
name = "rattler_cache"
version = "0.6.6"
version = "0.6.14"
dependencies = [
"ahash",
"anyhow",
@ -1786,7 +1868,7 @@ dependencies = [
"fs-err",
"fs4",
"futures",
"itertools",
"itertools 0.14.0",
"parking_lot",
"rattler_conda_types",
"rattler_digest",
@ -1807,7 +1889,7 @@ dependencies = [
[[package]]
name = "rattler_conda_types"
version = "0.42.4"
version = "0.43.5"
dependencies = [
"ahash",
"chrono",
@ -1819,7 +1901,7 @@ dependencies = [
"glob",
"hex",
"indexmap 2.12.0",
"itertools",
"itertools 0.14.0",
"lazy-regex",
"memmap2",
"nom",
@ -1873,7 +1955,7 @@ dependencies = [
[[package]]
name = "rattler_networking"
version = "0.25.29"
version = "0.26.2"
dependencies = [
"anyhow",
"async-once-cell",
@ -1882,7 +1964,7 @@ dependencies = [
"fs-err",
"getrandom 0.3.4",
"http",
"itertools",
"itertools 0.14.0",
"reqwest",
"reqwest-middleware",
"retry-policies",
@ -1896,16 +1978,21 @@ dependencies = [
[[package]]
name = "rattler_package_streaming"
version = "0.23.21"
version = "0.24.2"
dependencies = [
"astral-tokio-tar",
"astral_async_zip",
"async-compression",
"async-spooled-tempfile",
"async_http_range_reader",
"bzip2",
"chrono",
"fs-err",
"futures",
"futures-util",
"getrandom 0.2.16",
"getrandom 0.3.4",
"http",
"num_cpus",
"rattler_conda_types",
"rattler_digest",
@ -1937,8 +2024,9 @@ dependencies = [
[[package]]
name = "rattler_repodata_gateway"
version = "0.25.7"
version = "0.26.2"
dependencies = [
"ahash",
"anyhow",
"async-compression",
"async-fd-lock",
@ -1955,12 +2043,13 @@ dependencies = [
"fs-err",
"fslock",
"futures",
"hashbrown 0.15.5",
"hex",
"http",
"http-cache-semantics",
"humansize",
"humantime",
"itertools",
"itertools 0.14.0",
"json-patch",
"libc",
"memmap2",
@ -1996,12 +2085,12 @@ dependencies = [
[[package]]
name = "rattler_solve"
version = "4.1.2"
version = "4.2.6"
dependencies = [
"chrono",
"futures",
"humantime",
"itertools",
"itertools 0.14.0",
"rattler_conda_types",
"rattler_digest",
"resolvo",
@ -2169,7 +2258,7 @@ dependencies = [
"event-listener",
"futures",
"indexmap 2.12.0",
"itertools",
"itertools 0.14.0",
"petgraph",
"tracing",
]
@ -2852,6 +2941,7 @@ dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
"tokio-util",
]
[[package]]
@ -2862,6 +2952,7 @@ checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5"
dependencies = [
"bytes",
"futures-core",
"futures-io",
"futures-sink",
"pin-project-lite",
"tokio",

View file

@ -16,3 +16,19 @@ Its primary use case is as a library that you can use to provide conda related w
Rattler is written in Rust and tries to provide a clean API to its functionalities.
This package provides bindings to the native Rust library compiled to WASM.
## Development
This project uses [pixi](https://pixi.sh) to manage the development environment and tasks.
For quick iteration during development, use the debug build which skips optimizations:
```bash
pixi run test-debug
```
For a full release build and test run:
```bash
pixi run test
```

View file

@ -74,7 +74,6 @@
"integrity": "sha512-lWBYIrF7qK5+GjY5Uy+/hEgp8OJWOD/rpy74GplYRhEauvbHDeFB8t5hPOZxCZ0Oxf4Cc36tK51/l3ymJysrKw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.26.2",
@ -1614,7 +1613,6 @@
"integrity": "sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~6.20.0"
}
@ -1978,7 +1976,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"caniuse-lite": "^1.0.30001688",
"electron-to-chromium": "^1.5.73",
@ -3154,7 +3151,6 @@
"integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@jest/core": "^29.7.0",
"@jest/types": "^29.6.3",
@ -4764,7 +4760,6 @@
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -4813,7 +4808,6 @@
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@ -5050,7 +5044,6 @@
"integrity": "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/estree": "1.0.8"
},
@ -5645,7 +5638,6 @@
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
@ -5689,8 +5681,7 @@
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true,
"license": "0BSD",
"peer": true
"license": "0BSD"
},
"node_modules/type-detect": {
"version": "4.0.8",
@ -5721,7 +5712,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

1942
js-rattler/pixi.lock generated Normal file

File diff suppressed because it is too large Load diff

31
js-rattler/pixi.toml Normal file
View file

@ -0,0 +1,31 @@
[workspace]
name = "js-rattler"
channels = ["https://prefix.dev/conda-forge"]
platforms = ["linux-aarch64", "win-64", "osx-arm64", "linux-64"]
[tasks]
_install = { cmd = "npm install", inputs = ["package.json", "package-lock.json"], outputs = ["node_modules/.package-lock.json"] }
# Building tasks
build = { cmd="npm run build", depends-on = ["_install"] }
build-types = { cmd="npm run build:types", depends-on = ["_install"] }
build-debug = { cmd="npm run build:wasm:debug", depends-on = ["_install"] }
# Formatting tasks
fmt = { cmd="npm run fmt", depends-on = ["_install"] }
fmt-check = { cmd="npm run fmt", depends-on = ["_install"] }
## Packing tasks
pack = { cmd="npm pack", depends-on = ["build"] }
## Testing tasks
test = { cmd="npm run test", depends-on = ["build","build-types"] }
test-debug = { cmd="npm run test:debug", depends-on = ["build-debug", "build-types"] }
[dependencies]
nodejs = ">=25.7.0,<25.8"
rust = ">=1.94.0,<1.95"
rust-std-wasm32-unknown-unknown = ">=1.94.0,<2"
wasm-pack = ">=0.14.0,<0.15"
zstd = ">=1.5.7,<2"
clang = ">=22.1.0,<23"