Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: publish sp1 to crates.io #1052

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,65 @@ To build docs locally, run the following commands in the top-level directory:
cargo install mdbook # Installs mdbook locally
mdbook serve # Serves the docs locally
```

## Publishing

SP1 crates are hosted on [crates.io](https://crates.io/search?q=sp1). This guide will walk you through the publication process.

The goal of this to to end up with a Github release and crate version that are referencing the same commit.

### Step 1: Update Cargo.toml versions

In each individual crate, update the version to the new version you want to publish.

For example, if the last version was `0.0.1`, and you want to publish `0.0.2`, you would replace
`version = "0.0.1"` with `version = "0.0.2"` each of the `Cargo.toml` files. You can do this all at
once using a find-and-replace tool, but be mindful of any other crates that might match the last version.

### Step 2: Create a release

Merge the `Cargo.toml` version changes into `dev`, and then into `main`, and then create a new release on GitHub as the new version.

### Step 3: Update Cargo.toml paths

To be able to publish the crates, you must change the relative paths in the `Cargo.toml` to the new version.

For example, if we have this `Cargo.toml` file:

```toml
sp1-core = { path = "../core" }
```

You would change it to this:

```toml
sp1-core = "0.0.2"
```

It may error that it doesn't exist yet, but that's okay.

You won't end up committing these changes, as it's best to leave them as relative paths for development.

### Step 4: Publish

To publish newer versions of these crates, you should use the [cargo-publish-workspace](https://crates.io/crates/cargo-publish-workspace-v2) tool:

```bash
cargo install cargo-publish-workspace-v2
```

If you don't have a [crates.io](https://crates.io) account, you should create one. Next, go to your [crates.io account tokens](https://crates.io/settings/tokens) and create a new token.

Then set it as your `CARGO_REGISTRY_TOKEN` environment variable:

```bash
export CARGO_REGISTRY_TOKEN=<your-token>
```

Then run the `cargo publish-workspace` command from the root of the repository:

```bash
cargo publish-workspace --target-version <version> --token $CARGO_REGISTRY_TOKEN --crate-prefix '' -- --allow-dirty
```

This will go through each of the crates and publish them. Each time you run it, it will go through and verify them, so you can be sure that they are all published correctly.
5 changes: 4 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[package]
name = "sp1-cli"
version = "0.1.0"
version = "0.0.0-test"
edition = "2021"
description = "SP1 is a performant, 100% open-source, contributor-friendly zkVM."
readme = "../README.md"
license = "MIT OR Apache-2.0"

[build-dependencies]
vergen = { version = "8", default-features = false, features = [
Expand Down
10 changes: 7 additions & 3 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[package]
edition = "2021"
name = "sp1-core"
version = "0.1.0"
version = "0.0.0-test"
edition = "2021"
description = "SP1 is a performant, 100% open-source, contributor-friendly zkVM."
readme = "../README.md"
license = "MIT OR Apache-2.0"


[dependencies]
bincode = "1.3.3"
Expand All @@ -28,7 +32,7 @@ p3-poseidon2 = { workspace = true }
p3-symmetric = { workspace = true }
p3-uni-stark = { workspace = true }
p3-util = { workspace = true }
rrs-lib = { git = "https://github.com/GregAC/rrs.git" }
rrs_lib = { package = "rrs-succinct", version = "0.1.0" }
sp1-derive = { path = "../derive" }
sp1-primitives = { path = "../primitives" }

Expand Down
5 changes: 4 additions & 1 deletion derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[package]
name = "sp1-derive"
version = "0.1.0"
version = "0.0.0-test"
edition = "2021"
description = "SP1 is a performant, 100% open-source, contributor-friendly zkVM."
readme = "../README.md"
license = "MIT OR Apache-2.0"

[lib]
proc-macro = true
Expand Down
4 changes: 3 additions & 1 deletion eval/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[package]
name = "sp1-eval"
version = "0.1.0"
version = "0.0.0-test"
edition = "2021"
publish = false


[dependencies]
sp1-core = { path = "../core" }
Expand Down
Loading
Loading