From 0c39738f924518ca5d802c70153ad04f173d9759 Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Sat, 11 Apr 2026 17:11:54 +0530 Subject: [PATCH 1/8] Add macOS darwin targets for setup-deno provider --- .github/workflows/ci.yml | 86 ++++++++++ .gitignore | 4 + Cargo.toml | 17 ++ LICENSE | 173 +++++++++++++++++++ README.md | 82 ++++++++- examples/workspace.tinx.yaml | 11 ++ packaging/Dockerfile | 5 + packaging/artifact-metadata.yaml | 10 ++ provider/provider.yaml | 17 ++ provider/runtime-hooks.yaml | 9 + scripts/package-oci.sh | 12 ++ scripts/push-oci.sh | 6 + scripts/test-runtime.sh | 8 + src/main.rs | 282 +++++++++++++++++++++++++++++++ 14 files changed, 720 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 LICENSE create mode 100644 examples/workspace.tinx.yaml create mode 100644 packaging/Dockerfile create mode 100644 packaging/artifact-metadata.yaml create mode 100644 provider/provider.yaml create mode 100644 provider/runtime-hooks.yaml create mode 100755 scripts/package-oci.sh create mode 100755 scripts/push-oci.sh create mode 100755 scripts/test-runtime.sh create mode 100644 src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2d0e87e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: ci + +on: + push: + branches: ["main"] + tags: ["v*"] + pull_request: + +permissions: + contents: read + packages: write + +jobs: + build-test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + - os: macos-latest + target: x86_64-apple-darwin + - os: macos-latest + target: aarch64-apple-darwin + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 + - name: Format check + run: cargo fmt -- --check + - name: Lint + run: cargo clippy --all-targets -- -D warnings + - name: Tests + run: cargo test --all-targets + - name: Build + run: cargo build --release --target ${{ matrix.target }} + + package-and-push: + if: startsWith(github.ref, 'refs/tags/v') + needs: build-test + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Build binary + run: | + mkdir -p dist + cargo build --release + cp target/release/setup-deno dist/setup-deno + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push OCI artifact + uses: docker/build-push-action@v6 + with: + context: . + file: packaging/Dockerfile + push: true + tags: ghcr.io/${{ github.repository_owner }}/setup-deno:${{ github.ref_name }} + + release: + if: startsWith(github.ref, 'refs/tags/v') + needs: package-and-push + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - uses: actions/checkout@v4 + - uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56e0e73 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/target +/.tinx +*.log +.env diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..b783a93 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "setup-deno" +version = "0.1.0" +edition = "2021" +description = "tinx provider for installing Deno" +license = "Apache-2.0" +repository = "https://github.com//tinx-provider-setup-deno" + +[dependencies] +anyhow = "1.0" +clap = { version = "4.5", features = ["derive"] } +reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls"] } +sha2 = "0.10" +zip = { version = "2.2", default-features = false, features = ["deflate"] } + +[dev-dependencies] +tempfile = "3.13" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e5977c9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,173 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md index 2549cc5..4c3a2f2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,80 @@ -# setup-deno -Deno setup provider +# tinx provider: setup-deno + +`setup-deno` is a production-oriented tinx provider implemented in Rust that installs the Deno CLI into a tinx-managed bin directory. + +## Features + +- Linux + macOS support for `amd64` and `arm64` +- Stateless, idempotent installs +- Verifies downloaded archive checksum from official Deno release checksums +- Provider + runtime hook manifests in Kubernetes-style YAML +- OCI packaging for GHCR (`ghcr.io//setup-deno:v0.1.0`) + +## Repository layout + +- `src/main.rs` — provider runtime implementation +- `provider/provider.yaml` — tinx `Provider` manifest +- `provider/runtime-hooks.yaml` — tinx runtime hook example +- `packaging/` — OCI artifact metadata and Dockerfile +- `scripts/package-oci.sh` — local OCI build helper +- `scripts/push-oci.sh` — local OCI push helper +- `scripts/test-runtime.sh` — local validation (`deno --version`) +- `examples/workspace.tinx.yaml` — sample tinx workspace config + +## Local development + +```bash +cargo fmt +cargo clippy --all-targets -- -D warnings +cargo test --all-targets +./scripts/test-runtime.sh +``` + +## Provider usage + +1. Publish artifact to GHCR: + +```bash +./scripts/package-oci.sh ghcr.io//setup-deno:v0.1.0 +./scripts/push-oci.sh ghcr.io//setup-deno:v0.1.0 +``` + +2. Reference provider in tinx workspace manifest: + +```yaml +apiVersion: tinx.sourceplane.ai/v1alpha1 +kind: Workspace +metadata: + name: deno-sample +spec: + providers: + - name: setup-deno + ref: ghcr.io//setup-deno:v0.1.0 +``` + +3. When tinx resolves runtime, `setup-deno` installs `deno` to `${TINX_BIN_DIR}` and runtime PATH should include that directory. + +## Release process (`v0.x.x`) + +- Tag and push: + +```bash +git tag v0.1.0 +git push origin v0.1.0 +``` + +- CI builds/tests provider, publishes OCI image to GHCR, and creates a GitHub release. + +## GitHub bootstrapping commands + +Use `gh` CLI to create and initialize the remote repo: + +```bash +gh repo create tinx-provider-setup-deno --public --source=. --remote=origin --push +``` + +Then create/merge iterative PRs (bootstrap, core logic, packaging, CI/CD, testing) with `gh pr create`. + +## License + +Apache-2.0 diff --git a/examples/workspace.tinx.yaml b/examples/workspace.tinx.yaml new file mode 100644 index 0000000..be392fc --- /dev/null +++ b/examples/workspace.tinx.yaml @@ -0,0 +1,11 @@ +apiVersion: tinx.sourceplane.ai/v1alpha1 +kind: Workspace +metadata: + name: deno-sample +spec: + providers: + - name: setup-deno + ref: ghcr.io//setup-deno:v0.1.0 + runtime: + env: + TINX_DENO_VERSION: v2.4.0 diff --git a/packaging/Dockerfile b/packaging/Dockerfile new file mode 100644 index 0000000..804ccf6 --- /dev/null +++ b/packaging/Dockerfile @@ -0,0 +1,5 @@ +FROM gcr.io/distroless/static:nonroot +COPY dist/setup-deno /usr/local/bin/setup-deno +COPY provider/provider.yaml /artifact/provider.yaml +COPY packaging/artifact-metadata.yaml /artifact/metadata.yaml +ENTRYPOINT ["/usr/local/bin/setup-deno"] diff --git a/packaging/artifact-metadata.yaml b/packaging/artifact-metadata.yaml new file mode 100644 index 0000000..f4becd9 --- /dev/null +++ b/packaging/artifact-metadata.yaml @@ -0,0 +1,10 @@ +apiVersion: artifact.tinx.sourceplane.ai/v1alpha1 +kind: ProviderArtifact +metadata: + name: setup-deno +spec: + provider: + file: provider/provider.yaml + binaries: + - path: dist/setup-deno + target: /usr/local/bin/setup-deno diff --git a/provider/provider.yaml b/provider/provider.yaml new file mode 100644 index 0000000..af4da88 --- /dev/null +++ b/provider/provider.yaml @@ -0,0 +1,17 @@ +apiVersion: tinx.sourceplane.ai/v1alpha1 +kind: Provider +metadata: + name: setup-deno + annotations: + oci.artifact: ghcr.io//setup-deno:v0.1.0 +spec: + version: v0.1.0 + runtime: + image: ghcr.io//setup-deno:v0.1.0 + command: + - /usr/local/bin/setup-deno + args: + - --version + - ${TINX_DENO_VERSION:-latest} + - --bin-dir + - ${TINX_BIN_DIR} diff --git a/provider/runtime-hooks.yaml b/provider/runtime-hooks.yaml new file mode 100644 index 0000000..787fdd2 --- /dev/null +++ b/provider/runtime-hooks.yaml @@ -0,0 +1,9 @@ +apiVersion: tinx.sourceplane.ai/v1alpha1 +kind: RuntimeHook +metadata: + name: setup-deno-hook +spec: + phase: resolve + run: + providerRef: + name: setup-deno diff --git a/scripts/package-oci.sh b/scripts/package-oci.sh new file mode 100755 index 0000000..30d15c9 --- /dev/null +++ b/scripts/package-oci.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +IMAGE_REF="${1:-ghcr.io//setup-deno:v0.1.0}" + +mkdir -p dist +cargo build --release +cp target/release/setup-deno dist/setup-deno + +docker build -f packaging/Dockerfile -t "${IMAGE_REF}" . + +echo "Built ${IMAGE_REF}" diff --git a/scripts/push-oci.sh b/scripts/push-oci.sh new file mode 100755 index 0000000..3b89ee9 --- /dev/null +++ b/scripts/push-oci.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +IMAGE_REF="${1:-ghcr.io//setup-deno:v0.1.0}" + +docker push "${IMAGE_REF}" diff --git a/scripts/test-runtime.sh b/scripts/test-runtime.sh new file mode 100755 index 0000000..c612e45 --- /dev/null +++ b/scripts/test-runtime.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +BIN_DIR="${TINX_BIN_DIR:-$(pwd)/.tinx/bin}" +VERSION="${DENO_VERSION:-v2.4.0}" + +cargo run -- --version "${VERSION}" --bin-dir "${BIN_DIR}" +"${BIN_DIR}/deno" --version diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..763c400 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,282 @@ +use std::fs::{self, File}; +use std::io::{Cursor, Write}; +use std::path::{Path, PathBuf}; +use std::process::Command; + +use anyhow::{anyhow, bail, Context, Result}; +use clap::Parser; +use reqwest::blocking::Client; +use sha2::{Digest, Sha256}; +use zip::ZipArchive; + +const GITHUB_RELEASE_BASE: &str = "https://github.com/denoland/deno/releases/download"; + +#[derive(Debug, Clone, Parser)] +#[command( + name = "setup-deno", + about = "Install Deno into a tinx-managed runtime bin directory" +)] +struct Args { + /// Deno version to install (example: v2.4.0, latest) + #[arg(long, env = "DENO_VERSION", default_value = "latest")] + version: String, + + /// Managed bin directory where deno should be installed. + #[arg(long, env = "TINX_BIN_DIR", default_value = ".tinx/bin")] + bin_dir: PathBuf, + + /// If true, fail when checksum material cannot be downloaded. + #[arg(long, env = "TINX_STRICT_CHECKSUM", default_value_t = false)] + strict_checksum: bool, +} + +fn main() -> Result<()> { + let args = Args::parse(); + run(args) +} + +fn run(args: Args) -> Result<()> { + let target = deno_target()?; + let desired_version = resolve_version(&args.version)?; + + fs::create_dir_all(&args.bin_dir) + .with_context(|| format!("failed to create bin dir {}", args.bin_dir.display()))?; + + let deno_path = args.bin_dir.join("deno"); + + if let Some(installed) = installed_deno_version(&deno_path)? { + if installed == desired_version { + println!( + "[setup-deno] deno {} already installed at {}, skipping", + installed, + deno_path.display() + ); + return Ok(()); + } + println!( + "[setup-deno] found deno {}, upgrading to {}", + installed, desired_version + ); + } + + let client = Client::builder() + .user_agent("tinx-provider-setup-deno/0.1.0") + .build() + .context("failed to create HTTP client")?; + + let archive_name = format!("deno-{}.zip", target); + let archive_url = format!( + "{}/{}/{}", + GITHUB_RELEASE_BASE, desired_version, archive_name + ); + println!("[setup-deno] downloading {}", archive_url); + let zip_bytes = download_bytes(&client, &archive_url) + .with_context(|| format!("failed to download deno archive from {archive_url}"))?; + + let archive_hash = sha256_hex(&zip_bytes); + if let Err(err) = verify_checksum(&client, &desired_version, &archive_name, &archive_hash) { + if args.strict_checksum { + return Err(err); + } + eprintln!("[setup-deno] warning: {err:#}"); + } + + install_zip_binary(&zip_bytes, &deno_path) + .with_context(|| format!("failed to install deno to {}", deno_path.display()))?; + + println!( + "[setup-deno] installed deno {} to {}", + desired_version, + deno_path.display() + ); + println!( + "[setup-deno] ensure tinx runtime PATH includes {}", + args.bin_dir.display() + ); + + Ok(()) +} + +fn resolve_version(input: &str) -> Result { + if input == "latest" { + Ok(fetch_latest_version()?) + } else if input.starts_with('v') { + Ok(input.to_owned()) + } else { + Ok(format!("v{}", input)) + } +} + +fn fetch_latest_version() -> Result { + let client = Client::builder() + .user_agent("tinx-provider-setup-deno/0.1.0") + .build() + .context("failed to create HTTP client")?; + + let redirect_target = client + .get("https://github.com/denoland/deno/releases/latest") + .send() + .context("failed to resolve latest deno release")? + .url() + .to_string(); + + let version = redirect_target + .rsplit('/') + .next() + .ok_or_else(|| anyhow!("could not parse latest version from redirect URL"))?; + + if !version.starts_with('v') { + bail!("latest release value did not look like semver tag: {version}"); + } + + Ok(version.to_string()) +} + +fn deno_target() -> Result<&'static str> { + match (std::env::consts::OS, std::env::consts::ARCH) { + ("linux", "x86_64") => Ok("x86_64-unknown-linux-gnu"), + ("linux", "aarch64") => Ok("aarch64-unknown-linux-gnu"), + ("macos", "x86_64") => Ok("x86_64-apple-darwin"), + ("macos", "aarch64") => Ok("aarch64-apple-darwin"), + (os, arch) => bail!( + "unsupported platform {os}/{arch}; this provider currently supports linux/amd64, linux/arm64, macOS/amd64, and macOS/arm64" + ), + } +} + +fn download_bytes(client: &Client, url: &str) -> Result> { + let mut response = client + .get(url) + .send() + .with_context(|| format!("request failed for {url}"))? + .error_for_status() + .with_context(|| format!("unsuccessful response for {url}"))?; + + let mut bytes = Vec::new(); + response + .copy_to(&mut bytes) + .with_context(|| format!("failed to read response body from {url}"))?; + Ok(bytes) +} + +fn verify_checksum( + client: &Client, + version: &str, + archive_name: &str, + archive_hash: &str, +) -> Result<()> { + let sums_url = format!("{}/{}/SHASUMS256.txt", GITHUB_RELEASE_BASE, version); + println!("[setup-deno] downloading checksum {}", sums_url); + let sums = download_bytes(client, &sums_url) + .with_context(|| format!("unable to fetch SHASUMS256.txt at {sums_url}"))?; + let sums_text = String::from_utf8(sums).context("SHASUMS256.txt is not valid UTF-8")?; + + let expected = expected_hash_for(&sums_text, archive_name) + .ok_or_else(|| anyhow!("no checksum entry for {archive_name} in SHASUMS256.txt"))?; + + if expected != archive_hash { + bail!("checksum mismatch for {archive_name}: expected {expected}, got {archive_hash}"); + } + + println!("[setup-deno] checksum verified for {}", archive_name); + Ok(()) +} + +fn expected_hash_for(sums_text: &str, filename: &str) -> Option { + sums_text.lines().find_map(|line| { + let mut parts = line.split_whitespace(); + let hash = parts.next()?; + let name = parts.next()?; + (name == filename).then(|| hash.to_string()) + }) +} + +fn sha256_hex(bytes: &[u8]) -> String { + let mut hasher = Sha256::new(); + hasher.update(bytes); + format!("{:x}", hasher.finalize()) +} + +fn install_zip_binary(zip_bytes: &[u8], deno_path: &Path) -> Result<()> { + let reader = Cursor::new(zip_bytes); + let mut zip = ZipArchive::new(reader).context("archive is not a valid zip")?; + + let mut deno_entry = zip + .by_name("deno") + .or_else(|_| zip.by_name("deno.exe")) + .context("zip archive does not contain deno binary")?; + + let tmp_path = deno_path.with_extension("tmp"); + let mut output = File::create(&tmp_path) + .with_context(|| format!("failed to open temp binary {}", tmp_path.display()))?; + std::io::copy(&mut deno_entry, &mut output).context("failed to extract binary data")?; + output.flush().context("failed to flush extracted binary")?; + + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + fs::set_permissions(&tmp_path, fs::Permissions::from_mode(0o755)) + .with_context(|| format!("failed to set executable bit on {}", tmp_path.display()))?; + } + + fs::rename(&tmp_path, deno_path).with_context(|| { + format!( + "failed to move binary from {} to {}", + tmp_path.display(), + deno_path.display() + ) + })?; + + Ok(()) +} + +fn installed_deno_version(deno_path: &Path) -> Result> { + if !deno_path.exists() { + return Ok(None); + } + + let output = Command::new(deno_path) + .arg("--version") + .output() + .with_context(|| format!("failed to run {} --version", deno_path.display()))?; + + if !output.status.success() { + return Ok(None); + } + + let stdout = String::from_utf8(output.stdout).context("deno --version output was not UTF-8")?; + let version = stdout + .lines() + .next() + .and_then(|line| line.split_whitespace().nth(1)) + .map(|v| format!("v{v}")); + + Ok(version) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn checksum_lookup_finds_match() { + let sums = + "abc123 deno-x86_64-unknown-linux-gnu.zip\ndef456 deno-aarch64-unknown-linux-gnu.zip\n"; + assert_eq!( + expected_hash_for(sums, "deno-aarch64-unknown-linux-gnu.zip"), + Some("def456".into()) + ); + } + + #[test] + fn checksum_lookup_returns_none() { + let sums = "abc123 deno-x86_64-unknown-linux-gnu.zip\n"; + assert_eq!(expected_hash_for(sums, "unknown.zip"), None); + } + + #[test] + fn version_normalization_works() { + assert_eq!(resolve_version("v2.4.0").unwrap(), "v2.4.0"); + assert_eq!(resolve_version("2.4.0").unwrap(), "v2.4.0"); + } +} From de7981737f4a079f420a29f93e76a77b8d07c366 Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Sat, 11 Apr 2026 17:44:14 +0530 Subject: [PATCH 2/8] Align packaging and GHCR release flow with tinx release --- .github/workflows/ci.yml | 23 +++------ .github/workflows/provider-ghcr-e2e.yml | 67 +++++++++++++++++++++++++ README.md | 1 + scripts/package-oci.sh | 14 +++++- scripts/push-oci.sh | 2 +- 5 files changed, 89 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/provider-ghcr-e2e.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d0e87e..ef7f8cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,23 +12,12 @@ permissions: jobs: build-test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - - os: ubuntu-latest - target: aarch64-unknown-linux-gnu - - os: macos-latest - target: x86_64-apple-darwin - - os: macos-latest - target: aarch64-apple-darwin + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: - targets: ${{ matrix.target }} + targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-apple-darwin,aarch64-apple-darwin - uses: Swatinem/rust-cache@v2 - name: Format check run: cargo fmt -- --check @@ -36,8 +25,12 @@ jobs: run: cargo clippy --all-targets -- -D warnings - name: Tests run: cargo test --all-targets - - name: Build - run: cargo build --release --target ${{ matrix.target }} + - name: Cross-target compile checks + run: | + cargo check --target x86_64-unknown-linux-gnu + cargo check --target aarch64-unknown-linux-gnu + cargo check --target x86_64-apple-darwin + cargo check --target aarch64-apple-darwin package-and-push: if: startsWith(github.ref, 'refs/tags/v') diff --git a/.github/workflows/provider-ghcr-e2e.yml b/.github/workflows/provider-ghcr-e2e.yml new file mode 100644 index 0000000..1c30346 --- /dev/null +++ b/.github/workflows/provider-ghcr-e2e.yml @@ -0,0 +1,67 @@ +name: provider-ghcr-e2e + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + push-install-run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Build tinx + run: | + mkdir -p bin + go install github.com/sourceplane/tinx/cmd/tinx@latest + cp "$(go env GOPATH)/bin/tinx" bin/tinx + + - name: Build setup-deno provider + run: | + mkdir -p dist + cargo build --release + cp target/release/setup-deno dist/setup-deno + + - name: Compute GHCR ref + id: vars + run: | + owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]') + echo "ref=ghcr.io/${owner}/setup-deno:ci-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> "$GITHUB_OUTPUT" + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Package and push provider with tinx + env: + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./bin/tinx release \ + --manifest provider/provider.yaml \ + --main ./dist/setup-deno \ + --dist ./dist \ + --output ./oci \ + --push "${{ steps.vars.outputs.ref }}" + + - name: Install from GHCR + env: + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./bin/tinx --tinx-home "$RUNNER_TEMP/tinx-home" install setup-deno "${{ steps.vars.outputs.ref }}" diff --git a/README.md b/README.md index 4c3a2f2..626c6c9 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ git push origin v0.1.0 ``` - CI builds/tests provider, publishes OCI image to GHCR, and creates a GitHub release. +- `provider-ghcr-e2e` also validates tinx-native packaging with `tinx release` and installs the published artifact from GHCR. ## GitHub bootstrapping commands diff --git a/scripts/package-oci.sh b/scripts/package-oci.sh index 30d15c9..18ac28d 100755 --- a/scripts/package-oci.sh +++ b/scripts/package-oci.sh @@ -3,10 +3,20 @@ set -euo pipefail IMAGE_REF="${1:-ghcr.io//setup-deno:v0.1.0}" +if ! command -v tinx >/dev/null 2>&1; then + echo "tinx CLI is required (https://github.com/sourceplane/tinx)." >&2 + exit 1 +fi + mkdir -p dist cargo build --release cp target/release/setup-deno dist/setup-deno -docker build -f packaging/Dockerfile -t "${IMAGE_REF}" . +tinx release \ + --manifest provider/provider.yaml \ + --main ./dist/setup-deno \ + --dist ./dist \ + --output ./oci \ + --push "${IMAGE_REF}" -echo "Built ${IMAGE_REF}" +echo "Published ${IMAGE_REF}" diff --git a/scripts/push-oci.sh b/scripts/push-oci.sh index 3b89ee9..e082cf4 100755 --- a/scripts/push-oci.sh +++ b/scripts/push-oci.sh @@ -3,4 +3,4 @@ set -euo pipefail IMAGE_REF="${1:-ghcr.io//setup-deno:v0.1.0}" -docker push "${IMAGE_REF}" +./scripts/package-oci.sh "${IMAGE_REF}" From ea1dceb950a050ccbd9c94b9d8074d2dfca652d5 Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Sat, 11 Apr 2026 19:04:11 +0530 Subject: [PATCH 3/8] Implement tinx-native setup-deno provider --- .github/workflows/ci.yml | 86 +- .github/workflows/provider-ghcr-e2e.yml | 67 - .github/workflows/release.yml | 184 +++ .gitignore | 4 + Cargo.lock | 1827 +++++++++++++++++++++++ Cargo.toml | 8 +- README.md | 124 +- docs/architecture-review.md | 122 ++ examples/workspace.tinx.yaml | 13 +- packaging/Dockerfile | 5 - packaging/artifact-metadata.yaml | 10 - provider/provider.yaml | 17 - provider/runtime-hooks.yaml | 9 - scripts/build-dist.sh | 32 + scripts/package-oci.sh | 39 +- scripts/push-oci.sh | 6 - scripts/test-runtime.sh | 18 +- src/main.rs | 692 +++++++-- tinx.yaml | 32 + 19 files changed, 2900 insertions(+), 395 deletions(-) delete mode 100644 .github/workflows/provider-ghcr-e2e.yml create mode 100644 .github/workflows/release.yml create mode 100644 Cargo.lock create mode 100644 docs/architecture-review.md delete mode 100644 packaging/Dockerfile delete mode 100644 packaging/artifact-metadata.yaml delete mode 100644 provider/provider.yaml delete mode 100644 provider/runtime-hooks.yaml create mode 100755 scripts/build-dist.sh delete mode 100755 scripts/push-oci.sh create mode 100644 tinx.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef7f8cc..7474999 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,78 +2,44 @@ name: ci on: push: - branches: ["main"] - tags: ["v*"] + branches: + - main + - codex/** pull_request: permissions: contents: read - packages: write jobs: - build-test: + lint-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable with: targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-apple-darwin,aarch64-apple-darwin - - uses: Swatinem/rust-cache@v2 - - name: Format check + + - name: Cache cargo artifacts + uses: Swatinem/rust-cache@v2 + + - name: Check formatting run: cargo fmt -- --check + - name: Lint - run: cargo clippy --all-targets -- -D warnings - - name: Tests - run: cargo test --all-targets - - name: Cross-target compile checks - run: | - cargo check --target x86_64-unknown-linux-gnu - cargo check --target aarch64-unknown-linux-gnu - cargo check --target x86_64-apple-darwin - cargo check --target aarch64-apple-darwin + run: cargo clippy --locked --all-targets -- -D warnings - package-and-push: - if: startsWith(github.ref, 'refs/tags/v') - needs: build-test - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - name: Build binary + - name: Test + run: cargo test --locked + + - name: Target checks run: | - mkdir -p dist - cargo build --release - cp target/release/setup-deno dist/setup-deno - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push OCI artifact - uses: docker/build-push-action@v6 - with: - context: . - file: packaging/Dockerfile - push: true - tags: ghcr.io/${{ github.repository_owner }}/setup-deno:${{ github.ref_name }} + cargo check --locked --target x86_64-unknown-linux-gnu + cargo check --locked --target aarch64-unknown-linux-gnu + cargo check --locked --target x86_64-apple-darwin + cargo check --locked --target aarch64-apple-darwin - release: - if: startsWith(github.ref, 'refs/tags/v') - needs: package-and-push - runs-on: ubuntu-latest - permissions: - contents: write - packages: write - steps: - - uses: actions/checkout@v4 - - uses: softprops/action-gh-release@v2 - with: - generate_release_notes: true + - name: Runtime smoke test + run: ./scripts/test-runtime.sh diff --git a/.github/workflows/provider-ghcr-e2e.yml b/.github/workflows/provider-ghcr-e2e.yml deleted file mode 100644 index 1c30346..0000000 --- a/.github/workflows/provider-ghcr-e2e.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: provider-ghcr-e2e - -on: - push: - branches: - - main - workflow_dispatch: - -permissions: - contents: read - packages: write - -jobs: - push-install-run: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: '1.23' - - - name: Build tinx - run: | - mkdir -p bin - go install github.com/sourceplane/tinx/cmd/tinx@latest - cp "$(go env GOPATH)/bin/tinx" bin/tinx - - - name: Build setup-deno provider - run: | - mkdir -p dist - cargo build --release - cp target/release/setup-deno dist/setup-deno - - - name: Compute GHCR ref - id: vars - run: | - owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]') - echo "ref=ghcr.io/${owner}/setup-deno:ci-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> "$GITHUB_OUTPUT" - - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Package and push provider with tinx - env: - GITHUB_ACTOR: ${{ github.actor }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - ./bin/tinx release \ - --manifest provider/provider.yaml \ - --main ./dist/setup-deno \ - --dist ./dist \ - --output ./oci \ - --push "${{ steps.vars.outputs.ref }}" - - - name: Install from GHCR - env: - GITHUB_ACTOR: ${{ github.actor }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - ./bin/tinx --tinx-home "$RUNNER_TEMP/tinx-home" install setup-deno "${{ steps.vars.outputs.ref }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c1ccfc8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,184 @@ +name: release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + packages: write + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Validate manifest version matches tag + run: | + manifest_version="$(awk '/^ version:/ {print $2}' tinx.yaml)" + if [[ "${GITHUB_REF_NAME}" != "${manifest_version}" ]]; then + echo "tag ${GITHUB_REF_NAME} does not match tinx.yaml version ${manifest_version}" >&2 + exit 1 + fi + + build-linux-amd64: + runs-on: ubuntu-latest + needs: validate + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-unknown-linux-gnu + + - name: Cache cargo artifacts + uses: Swatinem/rust-cache@v2 + + - name: Build linux/amd64 + run: ./scripts/build-dist.sh x86_64-unknown-linux-gnu + + - name: Upload linux/amd64 artifact + uses: actions/upload-artifact@v4 + with: + name: dist-linux-amd64 + path: dist/bin/linux/amd64/setup-deno + + build-linux-arm64: + runs-on: ubuntu-24.04-arm + needs: validate + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-unknown-linux-gnu + + - name: Cache cargo artifacts + uses: Swatinem/rust-cache@v2 + + - name: Build linux/arm64 + run: ./scripts/build-dist.sh aarch64-unknown-linux-gnu + + - name: Upload linux/arm64 artifact + uses: actions/upload-artifact@v4 + with: + name: dist-linux-arm64 + path: dist/bin/linux/arm64/setup-deno + + build-darwin: + runs-on: macos-14 + needs: validate + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-apple-darwin,x86_64-apple-darwin + + - name: Cache cargo artifacts + uses: Swatinem/rust-cache@v2 + + - name: Build darwin targets + run: ./scripts/build-dist.sh aarch64-apple-darwin x86_64-apple-darwin + + - name: Upload darwin artifacts + uses: actions/upload-artifact@v4 + with: + name: dist-darwin + path: | + dist/bin/darwin/amd64/setup-deno + dist/bin/darwin/arm64/setup-deno + + package-publish: + runs-on: ubuntu-latest + needs: + - build-linux-amd64 + - build-linux-arm64 + - build-darwin + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download release artifacts + uses: actions/download-artifact@v4 + with: + path: . + pattern: dist-* + merge-multiple: true + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: "1.25.0" + + - name: Install tinx + run: | + go install github.com/sourceplane/tinx/cmd/tinx@v0.3.2 + echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" + + - name: Compute OCI references + id: vars + run: | + owner="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')" + echo "owner=${owner}" >> "$GITHUB_OUTPUT" + echo "version_ref=ghcr.io/${owner}/setup-deno:${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" + echo "latest_ref=ghcr.io/${owner}/setup-deno:latest" >> "$GITHUB_OUTPUT" + + - name: Package and push versioned artifact + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./scripts/package-oci.sh "${{ steps.vars.outputs.version_ref }}" + + - name: Package and push latest artifact + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OCI_TAG: latest + OUTPUT_DIR: ./oci-latest + run: ./scripts/package-oci.sh "${{ steps.vars.outputs.latest_ref }}" + + - name: Smoke test from GHCR + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + tmpdir="$(mktemp -d)" + trap 'rm -rf "$tmpdir"' EXIT + VERSION_REF="${{ steps.vars.outputs.version_ref }}" + TMPDIR_PATH="$tmpdir" python3 - <<'PY' +from pathlib import Path +import os + +Path(os.environ["TMPDIR_PATH"], "tinx.yaml").write_text( + "apiVersion: tinx.io/v1\n" + "kind: Workspace\n" + "workspace: smoke\n" + "providers:\n" + " deno:\n" + f" source: {os.environ['VERSION_REF']}\n", + encoding="utf-8", +) +PY + tinx init "$tmpdir/tinx.yaml" + tinx --workspace "$tmpdir" -- deno --version + tinx --workspace "$tmpdir" -- deno eval 'console.log(Deno.version.deno)' + + - name: Record OCI references + run: | + printf '%s\n' "${{ steps.vars.outputs.version_ref }}" > ghcr-ref.txt + printf '%s\n' "${{ steps.vars.outputs.latest_ref }}" > ghcr-latest-ref.txt + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: | + ghcr-ref.txt + ghcr-latest-ref.txt diff --git a/.gitignore b/.gitignore index 56e0e73..d7c3d34 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ /target /.tinx +/dist +/oci +/oci-latest +/tmp *.log .env diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f88f94f --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1827 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cc" +version = "1.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 5.3.0", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", + "serde", + "serde_core", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "iri-string" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.184" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ec095654a25171c2124e9e3393a930bddbffdc939556c914957a4c3e0a87166" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20a6af516fea4b20eccceaf166e8aa666ac996208e8a644ce3ef5aa783bc7cd4" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "setup-deno" +version = "0.1.0" +dependencies = [ + "anyhow", + "reqwest", + "serde", + "sha2", + "tempfile", + "zip", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.2", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f66bf9585cda4b724d3e78ab34b73fb2bbaba9011b9bfdf69dc836382ea13b8c" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zip" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50" +dependencies = [ + "arbitrary", + "crc32fast", + "crossbeam-utils", + "displaydoc", + "flate2", + "indexmap", + "memchr", + "thiserror", + "zopfli", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zopfli" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] diff --git a/Cargo.toml b/Cargo.toml index b783a93..8b03cf2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,14 +2,14 @@ name = "setup-deno" version = "0.1.0" edition = "2021" -description = "tinx provider for installing Deno" +description = "A tinx-native Deno toolchain provider launcher" license = "Apache-2.0" -repository = "https://github.com//tinx-provider-setup-deno" +repository = "https://github.com/sourceplane/setup-deno" [dependencies] anyhow = "1.0" -clap = { version = "4.5", features = ["derive"] } -reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls"] } +reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] } +serde = { version = "1.0", features = ["derive"] } sha2 = "0.10" zip = { version = "2.2", default-features = false, features = ["deflate"] } diff --git a/README.md b/README.md index 626c6c9..ab9b43a 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,116 @@ -# tinx provider: setup-deno +# setup-deno -`setup-deno` is a production-oriented tinx provider implemented in Rust that installs the Deno CLI into a tinx-managed bin directory. +`setup-deno` is a Rust tinx provider that makes Deno feel like a native workspace runtime instead of a one-shot setup script. -## Features +The provider binary is the executable tinx places on `PATH`. On first use it resolves the configured Deno release, downloads the matching upstream archive, verifies the published checksum, installs the binary into the tinx provider store, and then delegates the CLI invocation to the real `deno` binary. -- Linux + macOS support for `amd64` and `arm64` -- Stateless, idempotent installs -- Verifies downloaded archive checksum from official Deno release checksums -- Provider + runtime hook manifests in Kubernetes-style YAML -- OCI packaging for GHCR (`ghcr.io//setup-deno:v0.1.0`) +## Why this shape + +tinx providers are packaged binaries plus metadata. They do not currently have explicit `resolve`, `install`, and `activate` lifecycle hooks, and workspace manifests do not expose alias-scoped provider inputs. Given those constraints, the cleanest native fit today is: + +- pin the default Deno version in the provider artifact version +- alias the provider as `deno` inside a workspace +- cache the real Deno toolchain under the provider store +- expose that cache through `spec.path` and the alias shim tinx already manages + +That keeps the user experience close to GitHub `setup-*` actions while still respecting tinx's runtime model. ## Repository layout -- `src/main.rs` — provider runtime implementation -- `provider/provider.yaml` — tinx `Provider` manifest -- `provider/runtime-hooks.yaml` — tinx runtime hook example -- `packaging/` — OCI artifact metadata and Dockerfile -- `scripts/package-oci.sh` — local OCI build helper -- `scripts/push-oci.sh` — local OCI push helper -- `scripts/test-runtime.sh` — local validation (`deno --version`) -- `examples/workspace.tinx.yaml` — sample tinx workspace config +- `tinx.yaml`: tinx provider manifest +- `src/main.rs`: Rust launcher that resolves, installs, and delegates to Deno +- `examples/workspace.tinx.yaml`: declarative workspace example +- `scripts/build-dist.sh`: builds release binaries into tinx's expected dist layout +- `scripts/package-oci.sh`: packages and optionally pushes the OCI artifact with tinx +- `scripts/test-runtime.sh`: host-platform smoke test for the launcher +- `docs/architecture-review.md`: fit analysis, gaps, and recommendations for tinx + +## Version model + +The provider tag is the default Deno version. For example: + +- `ghcr.io/sourceplane/setup-deno:v2.7.12` pins Deno `v2.7.12` +- `ghcr.io/sourceplane/setup-deno:latest` resolves to the latest published provider artifact + +Because tinx writes the resolved registry digest into `tinx.lock`, a workspace that starts from `:latest` still becomes reproducible after sync. + +The provider also accepts an escape hatch override through `SETUP_DENO_VERSION`, but the recommended declarative model is to pin the provider tag in the workspace manifest. ## Local development ```bash cargo fmt cargo clippy --all-targets -- -D warnings -cargo test --all-targets +cargo test ./scripts/test-runtime.sh ``` -## Provider usage +## Build the OCI layout locally -1. Publish artifact to GHCR: +1. Build the host binary or one or more release targets: ```bash -./scripts/package-oci.sh ghcr.io//setup-deno:v0.1.0 -./scripts/push-oci.sh ghcr.io//setup-deno:v0.1.0 +./scripts/build-dist.sh ``` -2. Reference provider in tinx workspace manifest: +2. Package the provider as an OCI layout with tinx: -```yaml -apiVersion: tinx.sourceplane.ai/v1alpha1 -kind: Workspace -metadata: - name: deno-sample -spec: - providers: - - name: setup-deno - ref: ghcr.io//setup-deno:v0.1.0 +```bash +./scripts/package-oci.sh ``` -3. When tinx resolves runtime, `setup-deno` installs `deno` to `${TINX_BIN_DIR}` and runtime PATH should include that directory. - -## Release process (`v0.x.x`) - -- Tag and push: +3. Push the packaged artifact to GHCR: ```bash -git tag v0.1.0 -git push origin v0.1.0 +./scripts/package-oci.sh ghcr.io/sourceplane/setup-deno:v2.7.12 ``` -- CI builds/tests provider, publishes OCI image to GHCR, and creates a GitHub release. -- `provider-ghcr-e2e` also validates tinx-native packaging with `tinx release` and installs the published artifact from GHCR. +`package-oci.sh` uses `tinx release --skip-build`, so Rust stays responsible for compilation while tinx stays responsible for OCI packaging and registry publishing. -## GitHub bootstrapping commands +## Workspace usage -Use `gh` CLI to create and initialize the remote repo: +Example workspace manifest: + +```yaml +apiVersion: tinx.io/v1 +kind: Workspace +workspace: deno-sample +providers: + deno: + source: ghcr.io/sourceplane/setup-deno:v2.7.12 +``` + +Initialize and run: ```bash -gh repo create tinx-provider-setup-deno --public --source=. --remote=origin --push +tinx init ./examples/workspace.tinx.yaml +tinx --workspace ./examples -- deno --version +tinx --workspace ./examples -- deno eval 'console.log(Deno.version.deno)' ``` -Then create/merge iterative PRs (bootstrap, core logic, packaging, CI/CD, testing) with `gh pr create`. +What happens on the first invocation: + +1. tinx materializes the `setup-deno` provider binary and places the alias shim in `.workspace/bin/deno` +2. the provider resolves the configured Deno version +3. the provider downloads and verifies the upstream Deno archive +4. the provider installs Deno under `${provider_home}/toolchains///bin/deno` +5. the provider updates `${provider_home}/toolchains/current` +6. the provider delegates the original CLI arguments to the installed Deno binary + +Subsequent calls are idempotent and reuse the cached toolchain. + +## Release process + +This repository uses GitHub Actions for CI and tagged releases: + +- `ci.yml` runs formatting, linting, unit tests, target checks, and a runtime smoke test +- `release.yml` builds all supported platform binaries, packages them with tinx, pushes the OCI artifact to GHCR, smoke-tests installation from GHCR, and creates a GitHub release + +Release tags are expected to match `metadata.version` in `tinx.yaml`. + +## Architectural review + +The architectural fit analysis and tinx recommendations live in [docs/architecture-review.md](docs/architecture-review.md). ## License diff --git a/docs/architecture-review.md b/docs/architecture-review.md new file mode 100644 index 0000000..6a4fed9 --- /dev/null +++ b/docs/architecture-review.md @@ -0,0 +1,122 @@ +# Architecture Review + +## Capability fit + +tinx is a strong fit for the distribution side of this provider: + +- OCI packaging gives `setup-deno` a portable, registry-native delivery model. +- Workspace aliases make it easy to expose the provider as `deno`. +- Provider `spec.env` and `spec.path` are enough to wire the launcher into the workspace runtime. +- The lock file means a workspace using `ghcr.io/sourceplane/setup-deno:latest` still converges to a reproducible digest after sync. + +For a setup-style toolchain provider, though, the fit is only partial. The provider binary has to emulate lifecycle phases that tinx does not yet model directly. + +## Gaps and limitations + +### 1. No explicit toolchain lifecycle + +Today a provider is just an executable plus metadata. That works well for self-contained tools, but a setup-style provider really wants: + +- `resolve`: turn `latest` or a channel into a concrete upstream version +- `install`: materialize content into a cache +- `activate`: publish paths and environment into the workspace runtime + +Because tinx lacks those phases, `setup-deno` has to do all three during process startup. + +### 2. No alias-scoped provider inputs in the workspace manifest + +There is no native `providers..with` or equivalent configuration object. That means a workspace cannot currently say: + +```yaml +providers: + deno: + source: ghcr.io/sourceplane/setup-deno:latest + with: + version: v2.7.12 +``` + +As a result, the cleanest declarative versioning story is to encode the default Deno version in the provider artifact tag itself. + +### 3. `tinx release` is build-strategy aware, but still mostly Go-shaped + +`tinx pack` is language-agnostic, and `tinx release --skip-build` gives us a solid bridge for Rust. But first-class release flows still assume tinx either builds Go directly or delegates to GoReleaser. A generic external-build strategy would make non-Go providers feel native. + +### 4. No dependency graph between providers + +If one provider depends on another provider's runtime artifacts or environment contract, tinx has no explicit dependency graph or ordering model beyond alias iteration. `setup-deno` avoids the issue by being self-sufficient, but more complex toolchains will hit this quickly. + +### 5. Global environment merge semantics are too coarse + +tinx currently fails when two providers set the same environment variable to different values. That is safe, but toolchain providers often need alias-local activation, overlays, or scoped environment exports that do not conflict globally. + +### 6. Content-addressable provider storage is not the same as content-addressable toolchain storage + +The provider store is content-addressed by provider metadata and OCI digest, but the Deno payload installed by this launcher is a second layer of cached content inside the provider home. That works, but tinx does not yet have a first-class cache model for upstream toolchains. + +### 7. OCI artifacts are provider-wide, not platform-selective at install time + +tinx packages a single provider artifact that contains all declared platform binaries. That is fine for small launchers. For large runtime providers it can become inefficient, especially if future providers bundle full toolchains instead of downloading them lazily. + +## Recommendations + +### 1. Add a first-class `toolchain` provider kind + +Introduce a provider kind that explicitly models: + +- `resolve` +- `materialize` +- `activate` + +That would let tinx cache upstream toolchains before command execution and keep the launcher path thin. + +### 2. Extend the workspace manifest with alias-scoped inputs + +Add something like: + +```yaml +providers: + deno: + source: ghcr.io/sourceplane/setup-deno:latest + with: + version: latest + installRoot: workspace +``` + +Then record the resolved values in `tinx.lock` so setup-style providers remain reproducible. + +### 3. Separate provider identity from resolved toolchain identity + +The lock file should be able to capture both: + +- the provider artifact digest +- the resolved upstream toolchain version or digest + +That would give tinx a clean model for channels like `latest`, `stable`, or `lts`. + +### 4. Add a first-class cache API and cache roots + +Providers should be able to request a tinx-managed cache root rather than mutating their provider store directly. That would make cache eviction, reuse, and integrity verification consistent across providers. + +### 5. Introduce alias-local activation semantics + +Allow providers to export environment and paths scoped to a single alias, rather than forcing every provider contribution into one shared environment map. + +### 6. Make release backends pluggable + +Keep `tinx pack` as the common packaging core, but let `tinx release` accept a generic builder contract such as: + +- external shell command +- cargo +- npm +- Go +- GoReleaser + +That would make non-Go providers first-class citizens without forcing them through `--skip-build`. + +### 7. Add provider dependency and ordering metadata + +Even a lightweight `requires` graph would help future providers compose safely, especially for toolchains that layer wrappers, plugins, certificate bundles, or policy packs. + +## Bottom line + +tinx already has the right distribution primitive for this problem: OCI-native providers composed in a workspace. What it lacks is a native lifecycle and config model for setup-style toolchain providers. `setup-deno` works well today as a Rust launcher provider, but the recommendations above would let tinx support this pattern directly and scale it to larger, more composable CNCF-style runtimes. diff --git a/examples/workspace.tinx.yaml b/examples/workspace.tinx.yaml index be392fc..429613b 100644 --- a/examples/workspace.tinx.yaml +++ b/examples/workspace.tinx.yaml @@ -1,11 +1,8 @@ -apiVersion: tinx.sourceplane.ai/v1alpha1 +apiVersion: tinx.io/v1 kind: Workspace +workspace: deno-sample metadata: name: deno-sample -spec: - providers: - - name: setup-deno - ref: ghcr.io//setup-deno:v0.1.0 - runtime: - env: - TINX_DENO_VERSION: v2.4.0 +providers: + deno: + source: ghcr.io/sourceplane/setup-deno:v2.7.12 diff --git a/packaging/Dockerfile b/packaging/Dockerfile deleted file mode 100644 index 804ccf6..0000000 --- a/packaging/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM gcr.io/distroless/static:nonroot -COPY dist/setup-deno /usr/local/bin/setup-deno -COPY provider/provider.yaml /artifact/provider.yaml -COPY packaging/artifact-metadata.yaml /artifact/metadata.yaml -ENTRYPOINT ["/usr/local/bin/setup-deno"] diff --git a/packaging/artifact-metadata.yaml b/packaging/artifact-metadata.yaml deleted file mode 100644 index f4becd9..0000000 --- a/packaging/artifact-metadata.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: artifact.tinx.sourceplane.ai/v1alpha1 -kind: ProviderArtifact -metadata: - name: setup-deno -spec: - provider: - file: provider/provider.yaml - binaries: - - path: dist/setup-deno - target: /usr/local/bin/setup-deno diff --git a/provider/provider.yaml b/provider/provider.yaml deleted file mode 100644 index af4da88..0000000 --- a/provider/provider.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: tinx.sourceplane.ai/v1alpha1 -kind: Provider -metadata: - name: setup-deno - annotations: - oci.artifact: ghcr.io//setup-deno:v0.1.0 -spec: - version: v0.1.0 - runtime: - image: ghcr.io//setup-deno:v0.1.0 - command: - - /usr/local/bin/setup-deno - args: - - --version - - ${TINX_DENO_VERSION:-latest} - - --bin-dir - - ${TINX_BIN_DIR} diff --git a/provider/runtime-hooks.yaml b/provider/runtime-hooks.yaml deleted file mode 100644 index 787fdd2..0000000 --- a/provider/runtime-hooks.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: tinx.sourceplane.ai/v1alpha1 -kind: RuntimeHook -metadata: - name: setup-deno-hook -spec: - phase: resolve - run: - providerRef: - name: setup-deno diff --git a/scripts/build-dist.sh b/scripts/build-dist.sh new file mode 100755 index 0000000..fba66cc --- /dev/null +++ b/scripts/build-dist.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" + +map_target() { + case "$1" in + x86_64-unknown-linux-gnu) printf '%s\n' "linux amd64" ;; + aarch64-unknown-linux-gnu) printf '%s\n' "linux arm64" ;; + x86_64-apple-darwin) printf '%s\n' "darwin amd64" ;; + aarch64-apple-darwin) printf '%s\n' "darwin arm64" ;; + *) + echo "unsupported Rust target: $1" >&2 + exit 1 + ;; + esac +} + +if [[ "$#" -eq 0 ]]; then + set -- "$(rustc -vV | awk '/^host:/ {print $2}')" +fi + +mkdir -p dist + +for target in "$@"; do + read -r goos goarch < <(map_target "$target") + cargo build --locked --release --target "$target" + output_dir="dist/bin/${goos}/${goarch}" + mkdir -p "$output_dir" + cp "target/${target}/release/setup-deno" "${output_dir}/setup-deno" +done diff --git a/scripts/package-oci.sh b/scripts/package-oci.sh index 18ac28d..5ffdc50 100755 --- a/scripts/package-oci.sh +++ b/scripts/package-oci.sh @@ -1,22 +1,35 @@ #!/usr/bin/env bash set -euo pipefail -IMAGE_REF="${1:-ghcr.io//setup-deno:v0.1.0}" +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" -if ! command -v tinx >/dev/null 2>&1; then - echo "tinx CLI is required (https://github.com/sourceplane/tinx)." >&2 +TINX_BIN="${TINX_BIN:-tinx}" +MANIFEST_PATH="${MANIFEST_PATH:-$ROOT_DIR/tinx.yaml}" +DIST_DIR="${DIST_DIR:-$ROOT_DIR/dist}" +OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/oci}" +OCI_TAG="${OCI_TAG:-}" +IMAGE_REF="${1:-}" + +if ! command -v "$TINX_BIN" >/dev/null 2>&1; then + echo "tinx CLI not found: ${TINX_BIN}" >&2 exit 1 fi -mkdir -p dist -cargo build --release -cp target/release/setup-deno dist/setup-deno +args=( + release + --manifest "$MANIFEST_PATH" + --skip-build + --dist "$DIST_DIR" + --output "$OUTPUT_DIR" +) + +if [[ -n "$OCI_TAG" ]]; then + args+=(--tag "$OCI_TAG") +fi -tinx release \ - --manifest provider/provider.yaml \ - --main ./dist/setup-deno \ - --dist ./dist \ - --output ./oci \ - --push "${IMAGE_REF}" +if [[ -n "$IMAGE_REF" ]]; then + args+=(--push "$IMAGE_REF") +fi -echo "Published ${IMAGE_REF}" +"$TINX_BIN" "${args[@]}" diff --git a/scripts/push-oci.sh b/scripts/push-oci.sh deleted file mode 100755 index e082cf4..0000000 --- a/scripts/push-oci.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -IMAGE_REF="${1:-ghcr.io//setup-deno:v0.1.0}" - -./scripts/package-oci.sh "${IMAGE_REF}" diff --git a/scripts/test-runtime.sh b/scripts/test-runtime.sh index c612e45..5ad0a1e 100755 --- a/scripts/test-runtime.sh +++ b/scripts/test-runtime.sh @@ -1,8 +1,18 @@ #!/usr/bin/env bash set -euo pipefail -BIN_DIR="${TINX_BIN_DIR:-$(pwd)/.tinx/bin}" -VERSION="${DENO_VERSION:-v2.4.0}" +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" -cargo run -- --version "${VERSION}" --bin-dir "${BIN_DIR}" -"${BIN_DIR}/deno" --version +DEFAULT_VERSION="$(awk '/^ version:/ {print $2}' tinx.yaml)" +PROVIDER_HOME="$(mktemp -d "${TMPDIR:-/tmp}/setup-deno.XXXXXX")" +trap 'rm -rf "$PROVIDER_HOME"' EXIT + +cargo build --locked --release + +export SETUP_DENO_PROVIDER_HOME="$PROVIDER_HOME" +export SETUP_DENO_DEFAULT_VERSION="${SETUP_DENO_DEFAULT_VERSION:-$DEFAULT_VERSION}" + +target/release/setup-deno --version +target/release/setup-deno eval 'console.log(Deno.version.deno)' +target/release/setup-deno --setup-deno-print-installed-path | grep -q '/deno$' diff --git a/src/main.rs b/src/main.rs index 763c400..f3710cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,178 +1,343 @@ -use std::fs::{self, File}; +use std::env; +use std::ffi::OsString; +use std::fs::{self, File, OpenOptions}; use std::io::{Cursor, Write}; use std::path::{Path, PathBuf}; -use std::process::Command; +use std::process::{self, Command}; +use std::thread; +use std::time::{Duration, Instant, SystemTime}; use anyhow::{anyhow, bail, Context, Result}; -use clap::Parser; use reqwest::blocking::Client; +use reqwest::header::{HeaderMap, HeaderValue, ACCEPT, AUTHORIZATION, USER_AGENT}; +use serde::Deserialize; use sha2::{Digest, Sha256}; use zip::ZipArchive; -const GITHUB_RELEASE_BASE: &str = "https://github.com/denoland/deno/releases/download"; - -#[derive(Debug, Clone, Parser)] -#[command( - name = "setup-deno", - about = "Install Deno into a tinx-managed runtime bin directory" -)] -struct Args { - /// Deno version to install (example: v2.4.0, latest) - #[arg(long, env = "DENO_VERSION", default_value = "latest")] - version: String, - - /// Managed bin directory where deno should be installed. - #[arg(long, env = "TINX_BIN_DIR", default_value = ".tinx/bin")] - bin_dir: PathBuf, +const RELEASE_DOWNLOAD_BASE: &str = "https://github.com/denoland/deno/releases/download"; +const RELEASES_API_BASE: &str = "https://api.github.com/repos/denoland/deno/releases"; +const LOCK_WAIT_TIMEOUT: Duration = Duration::from_secs(60); +const LOCK_RETRY_DELAY: Duration = Duration::from_millis(150); +const LOCK_STALE_AFTER: Duration = Duration::from_secs(600); + +fn main() { + match run(env::args_os()) { + Ok(RunOutcome::Completed) => {} + Ok(RunOutcome::Exit(code)) => process::exit(code), + Err(err) => { + eprintln!("[setup-deno] error: {err:#}"); + process::exit(1); + } + } +} - /// If true, fail when checksum material cannot be downloaded. - #[arg(long, env = "TINX_STRICT_CHECKSUM", default_value_t = false)] +#[derive(Debug, Clone)] +struct Config { + install_root: PathBuf, + current_link: PathBuf, + default_version: String, + version_override: Option, strict_checksum: bool, + github_token: Option, + release_download_base: String, + releases_api_base: String, + user_agent: String, } -fn main() -> Result<()> { - let args = Args::parse(); - run(args) +#[derive(Debug, Default, Clone, PartialEq, Eq)] +struct Invocation { + install_only: bool, + print_installed_path: bool, + print_resolved_version: bool, + forwarded_args: Vec, } -fn run(args: Args) -> Result<()> { - let target = deno_target()?; - let desired_version = resolve_version(&args.version)?; +#[derive(Debug, Clone, PartialEq, Eq)] +struct Toolchain { + version: String, + deno_path: PathBuf, +} - fs::create_dir_all(&args.bin_dir) - .with_context(|| format!("failed to create bin dir {}", args.bin_dir.display()))?; +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum RunOutcome { + Completed, + Exit(i32), +} - let deno_path = args.bin_dir.join("deno"); +#[derive(Debug, Deserialize)] +struct GitHubRelease { + tag_name: String, +} - if let Some(installed) = installed_deno_version(&deno_path)? { - if installed == desired_version { - println!( - "[setup-deno] deno {} already installed at {}, skipping", - installed, - deno_path.display() - ); - return Ok(()); - } +impl Config { + fn from_env() -> Result { + let provider_home = env_path("SETUP_DENO_PROVIDER_HOME") + .or_else(|| env_path("TINX_PROVIDER_HOME")) + .unwrap_or(default_provider_home()?); + let install_root = + env_path("SETUP_DENO_INSTALL_ROOT").unwrap_or_else(|| provider_home.join("toolchains")); + let current_link = + env_path("SETUP_DENO_CURRENT_LINK").unwrap_or_else(|| install_root.join("current")); + + Ok(Self { + install_root, + current_link, + default_version: env_value("SETUP_DENO_DEFAULT_VERSION") + .unwrap_or_else(|| "latest".to_string()), + version_override: env_value("SETUP_DENO_VERSION").or_else(|| env_value("DENO_VERSION")), + strict_checksum: env_bool("SETUP_DENO_STRICT_CHECKSUM").unwrap_or(true), + github_token: env_value("GITHUB_TOKEN").or_else(|| env_value("GH_TOKEN")), + release_download_base: env_value("SETUP_DENO_RELEASE_DOWNLOAD_BASE") + .unwrap_or_else(|| RELEASE_DOWNLOAD_BASE.to_string()), + releases_api_base: env_value("SETUP_DENO_RELEASES_API_BASE") + .unwrap_or_else(|| RELEASES_API_BASE.to_string()), + user_agent: format!("sourceplane/setup-deno/{}", env!("CARGO_PKG_VERSION")), + }) + } +} + +fn run(args: impl IntoIterator) -> Result { + let config = Config::from_env()?; + let invocation = parse_invocation(args); + let client = build_http_client(&config)?; + + let requested_version = config + .version_override + .as_deref() + .unwrap_or(&config.default_version); + let resolved_version = resolve_version(&client, &config, requested_version)?; + let toolchain = ensure_toolchain(&client, &config, &resolved_version)?; + + if invocation.print_resolved_version { + println!("{}", toolchain.version); + return Ok(RunOutcome::Completed); + } + if invocation.print_installed_path { + println!("{}", toolchain.deno_path.display()); + return Ok(RunOutcome::Completed); + } + if invocation.install_only { println!( - "[setup-deno] found deno {}, upgrading to {}", - installed, desired_version + "[setup-deno] ready {} at {}", + toolchain.version, + toolchain.deno_path.display() ); + return Ok(RunOutcome::Completed); } - let client = Client::builder() - .user_agent("tinx-provider-setup-deno/0.1.0") - .build() - .context("failed to create HTTP client")?; + delegate_to_deno(&toolchain.deno_path, invocation.forwarded_args) +} - let archive_name = format!("deno-{}.zip", target); - let archive_url = format!( - "{}/{}/{}", - GITHUB_RELEASE_BASE, desired_version, archive_name - ); - println!("[setup-deno] downloading {}", archive_url); - let zip_bytes = download_bytes(&client, &archive_url) - .with_context(|| format!("failed to download deno archive from {archive_url}"))?; +fn parse_invocation(args: impl IntoIterator) -> Invocation { + let mut invocation = Invocation::default(); - let archive_hash = sha256_hex(&zip_bytes); - if let Err(err) = verify_checksum(&client, &desired_version, &archive_name, &archive_hash) { - if args.strict_checksum { - return Err(err); + for arg in args.into_iter().skip(1) { + match arg.to_str() { + Some("--setup-deno-install-only") => invocation.install_only = true, + Some("--setup-deno-print-installed-path") => invocation.print_installed_path = true, + Some("--setup-deno-print-resolved-version") => invocation.print_resolved_version = true, + _ => invocation.forwarded_args.push(arg), } - eprintln!("[setup-deno] warning: {err:#}"); } - install_zip_binary(&zip_bytes, &deno_path) - .with_context(|| format!("failed to install deno to {}", deno_path.display()))?; + invocation +} - println!( - "[setup-deno] installed deno {} to {}", - desired_version, - deno_path.display() +fn default_provider_home() -> Result { + Ok(env::current_dir() + .context("failed to resolve current working directory")? + .join(".tinx") + .join("providers") + .join("setup-deno-dev")) +} + +fn build_http_client(config: &Config) -> Result { + let mut headers = HeaderMap::new(); + headers.insert( + ACCEPT, + HeaderValue::from_static("application/vnd.github+json"), ); - println!( - "[setup-deno] ensure tinx runtime PATH includes {}", - args.bin_dir.display() + headers.insert( + USER_AGENT, + HeaderValue::from_str(&config.user_agent).context("invalid user-agent header")?, ); + if let Some(token) = &config.github_token { + let value = format!("Bearer {token}"); + headers.insert( + AUTHORIZATION, + HeaderValue::from_str(&value).context("invalid authorization header")?, + ); + } - Ok(()) + Client::builder() + .default_headers(headers) + .build() + .context("failed to build HTTP client") } -fn resolve_version(input: &str) -> Result { - if input == "latest" { - Ok(fetch_latest_version()?) - } else if input.starts_with('v') { - Ok(input.to_owned()) - } else { - Ok(format!("v{}", input)) +fn resolve_version(client: &Client, config: &Config, input: &str) -> Result { + if input.trim().eq_ignore_ascii_case("latest") { + return fetch_latest_version(client, config); } + normalize_version(input) } -fn fetch_latest_version() -> Result { - let client = Client::builder() - .user_agent("tinx-provider-setup-deno/0.1.0") - .build() - .context("failed to create HTTP client")?; +fn normalize_version(input: &str) -> Result { + let trimmed = input.trim(); + if trimmed.is_empty() { + bail!("version must not be empty"); + } + if trimmed.starts_with('v') { + return Ok(trimmed.to_string()); + } + Ok(format!("v{trimmed}")) +} - let redirect_target = client - .get("https://github.com/denoland/deno/releases/latest") - .send() - .context("failed to resolve latest deno release")? - .url() - .to_string(); +fn fetch_latest_version(client: &Client, config: &Config) -> Result { + let api_url = format!("{}/latest", config.releases_api_base.trim_end_matches('/')); + match client.get(&api_url).send() { + Ok(response) => { + let response = response + .error_for_status() + .with_context(|| format!("latest release lookup failed at {api_url}"))?; + let release: GitHubRelease = response + .json() + .context("failed to decode GitHub latest release payload")?; + normalize_version(&release.tag_name) + } + Err(api_err) => { + let redirect_target = client + .get("https://github.com/denoland/deno/releases/latest") + .send() + .context("failed to resolve latest deno release via redirect fallback")? + .url() + .to_string(); + let version = redirect_target + .rsplit('/') + .next() + .ok_or_else(|| anyhow!("could not parse latest version from redirect URL"))?; + normalize_version(version) + .with_context(|| format!("GitHub API failed first: {api_err}")) + } + } +} - let version = redirect_target - .rsplit('/') - .next() - .ok_or_else(|| anyhow!("could not parse latest version from redirect URL"))?; +fn ensure_toolchain(client: &Client, config: &Config, version: &str) -> Result { + let target = deno_target()?; + let version_root = config.install_root.join(version).join(target); + let deno_path = version_root.join("bin").join("deno"); + + if installed_deno_version(&deno_path)? == Some(version.to_string()) { + ensure_current_link(&config.current_link, &version_root)?; + return Ok(Toolchain { + version: version.to_string(), + deno_path, + }); + } + + fs::create_dir_all(&config.install_root).with_context(|| { + format!( + "failed to create install root {}", + config.install_root.display() + ) + })?; - if !version.starts_with('v') { - bail!("latest release value did not look like semver tag: {version}"); + let lock_path = config + .install_root + .join(".locks") + .join(format!("{version}-{target}.lock")); + let _lock = InstallLock::acquire(&lock_path)?; + + if installed_deno_version(&deno_path)? == Some(version.to_string()) { + ensure_current_link(&config.current_link, &version_root)?; + return Ok(Toolchain { + version: version.to_string(), + deno_path, + }); } - Ok(version.to_string()) -} + let archive_name = format!("deno-{target}.zip"); + let archive_url = format!( + "{}/{}/{}", + config.release_download_base.trim_end_matches('/'), + version, + archive_name + ); + let checksum_url = format!( + "{}/{}/{}.sha256sum", + config.release_download_base.trim_end_matches('/'), + version, + archive_name + ); -fn deno_target() -> Result<&'static str> { - match (std::env::consts::OS, std::env::consts::ARCH) { - ("linux", "x86_64") => Ok("x86_64-unknown-linux-gnu"), - ("linux", "aarch64") => Ok("aarch64-unknown-linux-gnu"), - ("macos", "x86_64") => Ok("x86_64-apple-darwin"), - ("macos", "aarch64") => Ok("aarch64-apple-darwin"), - (os, arch) => bail!( - "unsupported platform {os}/{arch}; this provider currently supports linux/amd64, linux/arm64, macOS/amd64, and macOS/arm64" - ), + println!("[setup-deno] downloading {archive_url}"); + let zip_bytes = download_bytes(client, &archive_url) + .with_context(|| format!("failed to download deno archive from {archive_url}"))?; + let archive_hash = sha256_hex(&zip_bytes); + + if let Err(err) = verify_checksum(client, &checksum_url, &archive_name, &archive_hash) { + if config.strict_checksum { + return Err(err); + } + eprintln!("[setup-deno] warning: {err:#}"); } -} -fn download_bytes(client: &Client, url: &str) -> Result> { - let mut response = client - .get(url) - .send() - .with_context(|| format!("request failed for {url}"))? - .error_for_status() - .with_context(|| format!("unsuccessful response for {url}"))?; + let temp_root = temp_install_root(&config.install_root, version, target); + if temp_root.exists() { + fs::remove_dir_all(&temp_root) + .with_context(|| format!("failed to clear temp dir {}", temp_root.display()))?; + } + fs::create_dir_all(temp_root.join("bin")) + .with_context(|| format!("failed to create temp dir {}", temp_root.display()))?; + install_zip_binary(&zip_bytes, &temp_root.join("bin").join("deno"))?; - let mut bytes = Vec::new(); - response - .copy_to(&mut bytes) - .with_context(|| format!("failed to read response body from {url}"))?; - Ok(bytes) + if version_root.exists() { + fs::remove_dir_all(&version_root) + .with_context(|| format!("failed to replace {}", version_root.display()))?; + } + if let Some(parent) = version_root.parent() { + fs::create_dir_all(parent) + .with_context(|| format!("failed to create {}", parent.display()))?; + } + fs::rename(&temp_root, &version_root).with_context(|| { + format!( + "failed to move toolchain from {} to {}", + temp_root.display(), + version_root.display() + ) + })?; + ensure_current_link(&config.current_link, &version_root)?; + + println!( + "[setup-deno] installed {} for {} at {}", + version, + target, + deno_path.display() + ); + + Ok(Toolchain { + version: version.to_string(), + deno_path, + }) +} + +fn temp_install_root(install_root: &Path, version: &str, target: &str) -> PathBuf { + install_root.join(format!(".tmp-{version}-{target}-{}", process::id())) } fn verify_checksum( client: &Client, - version: &str, + checksum_url: &str, archive_name: &str, archive_hash: &str, ) -> Result<()> { - let sums_url = format!("{}/{}/SHASUMS256.txt", GITHUB_RELEASE_BASE, version); - println!("[setup-deno] downloading checksum {}", sums_url); - let sums = download_bytes(client, &sums_url) - .with_context(|| format!("unable to fetch SHASUMS256.txt at {sums_url}"))?; - let sums_text = String::from_utf8(sums).context("SHASUMS256.txt is not valid UTF-8")?; - - let expected = expected_hash_for(&sums_text, archive_name) - .ok_or_else(|| anyhow!("no checksum entry for {archive_name} in SHASUMS256.txt"))?; + println!("[setup-deno] downloading checksum {checksum_url}"); + let checksum_bytes = download_bytes(client, checksum_url) + .with_context(|| format!("unable to fetch checksum at {checksum_url}"))?; + let checksum_text = + String::from_utf8(checksum_bytes).context("checksum payload was not valid UTF-8")?; + let expected = parse_checksum_text(&checksum_text, archive_name) + .ok_or_else(|| anyhow!("no checksum entry for {archive_name}"))?; if expected != archive_hash { bail!("checksum mismatch for {archive_name}: expected {expected}, got {archive_hash}"); @@ -182,30 +347,68 @@ fn verify_checksum( Ok(()) } -fn expected_hash_for(sums_text: &str, filename: &str) -> Option { - sums_text.lines().find_map(|line| { - let mut parts = line.split_whitespace(); +fn parse_checksum_text(checksum_text: &str, filename: &str) -> Option { + checksum_text.lines().find_map(|line| { + let trimmed = line.trim(); + if trimmed.is_empty() { + return None; + } + + let mut parts = trimmed.split_whitespace(); let hash = parts.next()?; - let name = parts.next()?; - (name == filename).then(|| hash.to_string()) + let name = parts.next(); + + match name { + Some(candidate) if candidate == filename => Some(hash.to_string()), + None => Some(hash.to_string()), + _ => None, + } }) } -fn sha256_hex(bytes: &[u8]) -> String { - let mut hasher = Sha256::new(); - hasher.update(bytes); - format!("{:x}", hasher.finalize()) +fn download_bytes(client: &Client, url: &str) -> Result> { + let mut response = client + .get(url) + .send() + .with_context(|| format!("request failed for {url}"))? + .error_for_status() + .with_context(|| format!("unsuccessful response for {url}"))?; + + let mut bytes = Vec::new(); + response + .copy_to(&mut bytes) + .with_context(|| format!("failed to read response body from {url}"))?; + Ok(bytes) } fn install_zip_binary(zip_bytes: &[u8], deno_path: &Path) -> Result<()> { let reader = Cursor::new(zip_bytes); let mut zip = ZipArchive::new(reader).context("archive is not a valid zip")?; + let mut has_deno = false; + let mut has_deno_exe = false; + for name in zip.file_names() { + if name == "deno" { + has_deno = true; + } else if name == "deno.exe" { + has_deno_exe = true; + } + } + let entry_name = if has_deno { + "deno" + } else if has_deno_exe { + "deno.exe" + } else { + bail!("zip archive does not contain deno binary"); + }; let mut deno_entry = zip - .by_name("deno") - .or_else(|_| zip.by_name("deno.exe")) - .context("zip archive does not contain deno binary")?; + .by_name(entry_name) + .with_context(|| format!("failed to read {entry_name} from archive"))?; + if let Some(parent) = deno_path.parent() { + fs::create_dir_all(parent) + .with_context(|| format!("failed to create {}", parent.display()))?; + } let tmp_path = deno_path.with_extension("tmp"); let mut output = File::create(&tmp_path) .with_context(|| format!("failed to open temp binary {}", tmp_path.display()))?; @@ -249,34 +452,227 @@ fn installed_deno_version(deno_path: &Path) -> Result> { .lines() .next() .and_then(|line| line.split_whitespace().nth(1)) - .map(|v| format!("v{v}")); + .map(|value| format!("v{value}")); Ok(version) } +fn delegate_to_deno(deno_path: &Path, args: Vec) -> Result { + let current_bin = deno_path + .parent() + .ok_or_else(|| anyhow!("deno binary path missing parent directory"))?; + let mut command = Command::new(deno_path); + command.args(args); + prepend_path(&mut command, current_bin); + + let status = command + .status() + .with_context(|| format!("failed to execute {}", deno_path.display()))?; + + match status.code() { + Some(code) => Ok(RunOutcome::Exit(code)), + None => bail!("deno process terminated without an exit code"), + } +} + +fn prepend_path(command: &mut Command, prefix: &Path) { + let mut entries = vec![prefix.to_path_buf()]; + if let Some(existing) = env::var_os("PATH") { + entries.extend(env::split_paths(&existing)); + } + if let Ok(joined) = env::join_paths(entries) { + command.env("PATH", joined); + } +} + +fn sha256_hex(bytes: &[u8]) -> String { + let mut hasher = Sha256::new(); + hasher.update(bytes); + format!("{:x}", hasher.finalize()) +} + +fn deno_target() -> Result<&'static str> { + match (env::consts::OS, env::consts::ARCH) { + ("linux", "x86_64") => Ok("x86_64-unknown-linux-gnu"), + ("linux", "aarch64") => Ok("aarch64-unknown-linux-gnu"), + ("macos", "x86_64") => Ok("x86_64-apple-darwin"), + ("macos", "aarch64") => Ok("aarch64-apple-darwin"), + (os, arch) => bail!( + "unsupported platform {os}/{arch}; supported targets are linux/amd64, linux/arm64, macOS/amd64, and macOS/arm64" + ), + } +} + +fn ensure_current_link(current_link: &Path, version_root: &Path) -> Result<()> { + #[cfg(unix)] + { + use std::os::unix::fs::symlink; + + if let Some(parent) = current_link.parent() { + fs::create_dir_all(parent) + .with_context(|| format!("failed to create {}", parent.display()))?; + } + + if let Ok(existing) = fs::read_link(current_link) { + if existing == version_root { + return Ok(()); + } + } + + if let Ok(metadata) = fs::symlink_metadata(current_link) { + if metadata.file_type().is_dir() && !metadata.file_type().is_symlink() { + fs::remove_dir_all(current_link).with_context(|| { + format!( + "failed to remove current link dir {}", + current_link.display() + ) + })?; + } else { + fs::remove_file(current_link).with_context(|| { + format!("failed to remove current link {}", current_link.display()) + })?; + } + } + + symlink(version_root, current_link).with_context(|| { + format!( + "failed to point {} at {}", + current_link.display(), + version_root.display() + ) + })?; + return Ok(()); + } + + #[allow(unreachable_code)] + { + let _ = (current_link, version_root); + bail!("setup-deno current link management is only supported on unix targets") + } +} + +fn env_path(key: &str) -> Option { + env::var_os(key) + .filter(|value| !value.is_empty()) + .map(PathBuf::from) +} + +fn env_value(key: &str) -> Option { + env::var(key) + .ok() + .map(|value| value.trim().to_string()) + .filter(|value| !value.is_empty()) +} + +fn env_bool(key: &str) -> Option { + env_value(key).and_then(|value| match value.to_ascii_lowercase().as_str() { + "1" | "true" | "yes" | "on" => Some(true), + "0" | "false" | "no" | "off" => Some(false), + _ => None, + }) +} + +struct InstallLock { + path: PathBuf, +} + +impl InstallLock { + fn acquire(path: &Path) -> Result { + if let Some(parent) = path.parent() { + fs::create_dir_all(parent) + .with_context(|| format!("failed to create {}", parent.display()))?; + } + + let started = Instant::now(); + loop { + match OpenOptions::new().write(true).create_new(true).open(path) { + Ok(mut file) => { + writeln!(file, "pid={} acquired=true", process::id()) + .context("failed to write install lock")?; + return Ok(Self { + path: path.to_path_buf(), + }); + } + Err(err) if err.kind() == std::io::ErrorKind::AlreadyExists => { + if stale_lock(path)? { + fs::remove_file(path).with_context(|| { + format!("failed to clear stale lock {}", path.display()) + })?; + continue; + } + if started.elapsed() >= LOCK_WAIT_TIMEOUT { + bail!("timed out waiting for install lock {}", path.display()); + } + thread::sleep(LOCK_RETRY_DELAY); + } + Err(err) => { + return Err(err).with_context(|| { + format!("failed to create install lock {}", path.display()) + }) + } + } + } + } +} + +impl Drop for InstallLock { + fn drop(&mut self) { + let _ = fs::remove_file(&self.path); + } +} + +fn stale_lock(path: &Path) -> Result { + let modified = path + .metadata() + .with_context(|| format!("failed to stat lock {}", path.display()))? + .modified() + .with_context(|| format!("failed to read mtime for {}", path.display()))?; + Ok(match SystemTime::now().duration_since(modified) { + Ok(age) => age >= LOCK_STALE_AFTER, + Err(_) => false, + }) +} + #[cfg(test)] mod tests { use super::*; #[test] - fn checksum_lookup_finds_match() { - let sums = - "abc123 deno-x86_64-unknown-linux-gnu.zip\ndef456 deno-aarch64-unknown-linux-gnu.zip\n"; + fn version_normalization_keeps_prefixed_versions() { + assert_eq!(normalize_version("v2.7.12").unwrap(), "v2.7.12"); + } + + #[test] + fn version_normalization_adds_prefix() { + assert_eq!(normalize_version("2.7.12").unwrap(), "v2.7.12"); + } + + #[test] + fn checksum_parser_supports_asset_filenames() { + let text = "abc123 deno-aarch64-apple-darwin.zip\n"; assert_eq!( - expected_hash_for(sums, "deno-aarch64-unknown-linux-gnu.zip"), - Some("def456".into()) + parse_checksum_text(text, "deno-aarch64-apple-darwin.zip"), + Some("abc123".to_string()) ); } #[test] - fn checksum_lookup_returns_none() { - let sums = "abc123 deno-x86_64-unknown-linux-gnu.zip\n"; - assert_eq!(expected_hash_for(sums, "unknown.zip"), None); + fn checksum_parser_supports_hash_only_files() { + let text = "abc123\n"; + assert_eq!( + parse_checksum_text(text, "deno-aarch64-apple-darwin.zip"), + Some("abc123".to_string()) + ); } #[test] - fn version_normalization_works() { - assert_eq!(resolve_version("v2.4.0").unwrap(), "v2.4.0"); - assert_eq!(resolve_version("2.4.0").unwrap(), "v2.4.0"); + fn invocation_parser_strips_provider_flags() { + let invocation = parse_invocation([ + OsString::from("setup-deno"), + OsString::from("--setup-deno-install-only"), + OsString::from("--version"), + ]); + assert!(invocation.install_only); + assert_eq!(invocation.forwarded_args, vec![OsString::from("--version")]); } } diff --git a/tinx.yaml b/tinx.yaml new file mode 100644 index 0000000..85d2876 --- /dev/null +++ b/tinx.yaml @@ -0,0 +1,32 @@ +apiVersion: tinx.io/v1 +kind: Provider +metadata: + namespace: sourceplane + name: setup-deno + version: v2.7.12 + description: Deno toolchain launcher for tinx workspaces + homepage: https://github.com/sourceplane/setup-deno + license: Apache-2.0 +spec: + runtime: binary + entrypoint: setup-deno + platforms: + - os: darwin + arch: amd64 + binary: bin/darwin/amd64/setup-deno + - os: darwin + arch: arm64 + binary: bin/darwin/arm64/setup-deno + - os: linux + arch: amd64 + binary: bin/linux/amd64/setup-deno + - os: linux + arch: arm64 + binary: bin/linux/arm64/setup-deno + env: + SETUP_DENO_PROVIDER_HOME: ${provider_home} + SETUP_DENO_INSTALL_ROOT: ${provider_home}/toolchains + SETUP_DENO_CURRENT_LINK: ${provider_home}/toolchains/current + SETUP_DENO_DEFAULT_VERSION: ${provider_version} + path: + - toolchains/current/bin From 4589917d2a51bbfe948f1c677de6598973e087d6 Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Sat, 11 Apr 2026 19:08:06 +0530 Subject: [PATCH 4/8] Fix release workflow syntax --- .github/workflows/release.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1ccfc8..df7390f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -153,19 +153,19 @@ jobs: trap 'rm -rf "$tmpdir"' EXIT VERSION_REF="${{ steps.vars.outputs.version_ref }}" TMPDIR_PATH="$tmpdir" python3 - <<'PY' -from pathlib import Path -import os - -Path(os.environ["TMPDIR_PATH"], "tinx.yaml").write_text( - "apiVersion: tinx.io/v1\n" - "kind: Workspace\n" - "workspace: smoke\n" - "providers:\n" - " deno:\n" - f" source: {os.environ['VERSION_REF']}\n", - encoding="utf-8", -) -PY + from pathlib import Path + import os + + Path(os.environ["TMPDIR_PATH"], "tinx.yaml").write_text( + "apiVersion: tinx.io/v1\n" + "kind: Workspace\n" + "workspace: smoke\n" + "providers:\n" + " deno:\n" + f" source: {os.environ['VERSION_REF']}\n", + encoding="utf-8", + ) + PY tinx init "$tmpdir/tinx.yaml" tinx --workspace "$tmpdir" -- deno --version tinx --workspace "$tmpdir" -- deno eval 'console.log(Deno.version.deno)' From a3cc387dbb9a0e88212af3b0989b30cad85eac10 Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Sat, 11 Apr 2026 19:10:22 +0530 Subject: [PATCH 5/8] Fix cross-target CI checks --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7474999..67a8408 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,11 @@ jobs: - name: Test run: cargo test --locked + - name: Install cross compiler for linux/arm64 checks + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu + - name: Target checks run: | cargo check --locked --target x86_64-unknown-linux-gnu From 750ad5c499097d204204ae529bce59f429c175f8 Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Sat, 11 Apr 2026 19:12:55 +0530 Subject: [PATCH 6/8] Limit CI target checks to supported linux cross builds --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67a8408..f8dd597 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-apple-darwin,aarch64-apple-darwin + targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu - name: Cache cargo artifacts uses: Swatinem/rust-cache@v2 @@ -43,8 +43,6 @@ jobs: run: | cargo check --locked --target x86_64-unknown-linux-gnu cargo check --locked --target aarch64-unknown-linux-gnu - cargo check --locked --target x86_64-apple-darwin - cargo check --locked --target aarch64-apple-darwin - name: Runtime smoke test run: ./scripts/test-runtime.sh From f05201723aa9156edd024af23b28c146b197b02c Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Sat, 11 Apr 2026 19:20:35 +0530 Subject: [PATCH 7/8] Fix release artifact download layout --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df7390f..91211fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,10 +93,14 @@ jobs: - name: Upload darwin artifacts uses: actions/upload-artifact@v4 with: - name: dist-darwin - path: | - dist/bin/darwin/amd64/setup-deno - dist/bin/darwin/arm64/setup-deno + name: dist-darwin-amd64 + path: dist/bin/darwin/amd64/setup-deno + + - name: Upload darwin arm64 artifact + uses: actions/upload-artifact@v4 + with: + name: dist-darwin-arm64 + path: dist/bin/darwin/arm64/setup-deno package-publish: runs-on: ubuntu-latest @@ -108,12 +112,29 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Download release artifacts + - name: Download linux/amd64 artifact + uses: actions/download-artifact@v4 + with: + name: dist-linux-amd64 + path: dist/bin/linux/amd64 + + - name: Download linux/arm64 artifact + uses: actions/download-artifact@v4 + with: + name: dist-linux-arm64 + path: dist/bin/linux/arm64 + + - name: Download darwin/amd64 artifact + uses: actions/download-artifact@v4 + with: + name: dist-darwin-amd64 + path: dist/bin/darwin/amd64 + + - name: Download darwin/arm64 artifact uses: actions/download-artifact@v4 with: - path: . - pattern: dist-* - merge-multiple: true + name: dist-darwin-arm64 + path: dist/bin/darwin/arm64 - name: Install Go uses: actions/setup-go@v5 From 616bf666437a9d2494deeac78f0776d575b257de Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Sat, 11 Apr 2026 19:22:53 +0530 Subject: [PATCH 8/8] Fix release smoke test environment --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 91211fd..a174d04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -173,7 +173,7 @@ jobs: tmpdir="$(mktemp -d)" trap 'rm -rf "$tmpdir"' EXIT VERSION_REF="${{ steps.vars.outputs.version_ref }}" - TMPDIR_PATH="$tmpdir" python3 - <<'PY' + TMPDIR_PATH="$tmpdir" VERSION_REF="$VERSION_REF" python3 - <<'PY' from pathlib import Path import os