Skip to content
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
29 changes: 29 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: github pages
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v2
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: "latest"

- run: cd docs && mdbook build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book
force_orphan: true
27 changes: 16 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: CI
on:
push:
branches: [main, jadex]
branches: [main]
pull_request:
branches: [main, jadex]
branches: [main]

concurrency:
group: ${{ github.head_ref || github.run_id }}
Expand All @@ -15,24 +15,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install Toolchain
run: |
rustup toolchain install 1.90.0
rustup component add rust-src --toolchain 1.90.0
rustup update stable && rustup default stable
- uses: taiki-e/install-action@sccache
- uses: taiki-e/install-action@nextest
- name: Setup Token
run: |
git config --global credential.helper store
echo "https://x-access-token:${{ secrets.SPACEJAM_TOKEN }}@github.com" > ~/.git-credentials
- name: Run Tests
run: cargo nextest run --workspace --no-fail-fast --release
run: cargo nextest run --no-fail-fast --release

check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-protoc@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install Toolchain
run: |
rustup toolchain install 1.90.0
rustup component add rust-src --toolchain 1.90.0
rustup update stable && rustup default stable
rustup component add clippy rustfmt
- uses: crate-ci/typos@v1.24.5
- uses: taiki-e/install-action@sccache
- name: Format
run: cargo fmt --check
- name: Clippy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Typos

on:
push:
branches: [main, jadex]
branches: [main]
pull_request:
branches: [main, jadex]
branches: [main]

env:
TERM: xterm-256color
Expand Down
31 changes: 16 additions & 15 deletions Cargo.lock

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

21 changes: 12 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ members = ["crates/*", "crates/jade/derive", "services/*"]
resolver = "2"

[workspace.package]
version = "0.0.13-pre.1"
version = "0.0.13"
edition = "2024"
authors = ["clearloop <tianyi.gc@gmail.com>"]
license = "GPL-3.0"
homepage = "https://github.com/spacejamapp/spacejam"
homepage = "https://spacejam.app"
repository = "https://github.com/spacejamapp/jade"

[workspace.dependencies]
cjam = { path = "crates/cli" }
jade = { path = "crates/jade", default-features = false }
jade-derive = { path = "crates/jade/derive" }
spacevm = { path = "crates/sys", package = "spacevm-sys" }
testing = { path = "crates/testing", package = "jade-testing" }
cjam = { path = "crates/cli", version = "0.0.13" }
jade = { path = "crates/jade", default-features = false, version = "0.0.13" }
jade-derive = { path = "crates/jade/derive", version = "0.0.13" }
spacevm = { path = "crates/sys", package = "spacevm-sys", version = "0.0.13" }
testing = { path = "crates/testing", package = "jade-testing", version = "0.0.13" }

# services
nauth = { path = "services/nauth" }
stoken = { path = "services/stoken" }

# spacejam dependencies
codec = { package = "serde-jam", version = "0.0.13-pre.1", default-features = false }
service = { package = "spacejam-service", version = "0.0.13-pre.1", default-features = false }
codec = { package = "serde-jam", version = "0.0.13", default-features = false }
service = { package = "spacejam-service", version = "0.0.13", default-features = false }

# crates.io
anyhow = { version = "1.0.93", default-features = false }
Expand All @@ -48,3 +48,6 @@ tiny-keccak = { version = "2.0.2", features = ["keccak"] }
toml = { version = "0.8.19", features = ["parse"] }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }

[workspace.metadata.conta]
packages = ["cjam", "spacevm", "testing", "jade-derive", "jade"]
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
> [!NOTE]
>
> This repo is still under heavy development
>
> The local testing simulator requires a binary of `pvms` which will be published soon!
# Jade Framework

# Jade
![main](https://github.com/spacejamapp/jade/actions/workflows/main.yml/badge.svg)
[![crate](https://img.shields.io/crates/v/jade.svg)](https://crates.io/crates/jade)
[![doc](https://img.shields.io/badge/current-docs-brightgreen.svg)](https://docs.rs/jade/)
[![downloads](https://img.shields.io/crates/d/jade.svg)](https://crates.io/crates/jade)
[![telegram](https://img.shields.io/badge/telegram-blue?logo=telegram)](https://t.me/spacejamapp)
[![LICENSE](https://img.shields.io/crates/l/jade.svg)](https://choosealicense.com/licenses/gpl-3.0/)

JAM service libraries.
Jade framework for building JAM services by [SpaceJam](https://spacejam.app).

- Libraries started with `jam-` including `crates/cli` are basically forks of the work done by
the `polkajam` team from crates.io.
- Libraries started with `jade-` are for the `jade` project.
- Libraries started with `spacejam` will be migrated to the `spacejam` main repo once
we got open sourced.
## Quick Start

```
cargo install jade
jade new my-service
cd my-service
jade build
```

See also our template at [service-template](https://github.com/spacejamapp/service-template).

## License

Expand Down
7 changes: 7 additions & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
name = "cjam"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
documentation = "https://docs.rs/cjam"
description = "Jam service builder"
keywords = ["pvm", "spacejam", "jam"]

[dependencies]
anyhow.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## cargo-jam

Jam service builder based on the fork of [jam-pvm-build](https://docs.rs/jam-pvm-build)
by the `polkajam` team with sort of error handling fixes.
by the `polkajam` team with sort of fixes.
7 changes: 0 additions & 7 deletions crates/cli/src/bin/cargo-jam.rs

This file was deleted.

10 changes: 10 additions & 0 deletions crates/cli/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ use std::{
process::Command,
};

/// Type of blob to build
pub enum BlobType {
/// Service blob
Service,
/// Authorizer blob
Authorizer,
/// CoreVM guest blob
CoreVmGuest,
}
impl Display for BlobType {
Expand All @@ -34,6 +38,7 @@ impl Display for BlobType {
}

impl BlobType {
/// Get the dispatch table for the blob type
pub fn dispatch_table(&self) -> Vec<Vec<u8>> {
match self {
Self::Service => vec![b"jade_refine".into(), b"jade_accumulate".into()],
Expand All @@ -51,9 +56,13 @@ impl BlobType {
}
}

/// Type of profile to build
pub enum ProfileType {
/// Debug profile
Debug,
/// Release profile
Release,
/// Other profile
Other(&'static str),
}
impl ProfileType {
Expand Down Expand Up @@ -252,6 +261,7 @@ pub fn build_pvm_blob(
(name, output_file)
}

/// Macro to include the PVM binary
#[macro_export]
macro_rules! pvm_binary {
($name:literal) => {
Expand Down
10 changes: 8 additions & 2 deletions crates/cli/src/cmd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! Command registry

pub use build::Build;
use clap::{Parser, command};
pub use {build::Build, new::New};

mod build;
mod new;

/// jam service command line interfaces
/// Jam service command line interface
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
pub struct App {
Expand All @@ -18,6 +19,7 @@ impl App {
pub fn run(&self) -> Result<(), anyhow::Error> {
match &self.command {
Command::Build(build) => build.run(),
Command::New(new) => new.run(),
}
}
}
Expand All @@ -26,6 +28,10 @@ impl App {
#[derive(Debug, Parser)]
#[command(author, version, about, long_about = None)]
pub enum Command {
/// Build a JAM PVM blob
#[command(about = "Build a JAM PVM blob")]
Build(Build),
/// Create a new JAM service
#[command(about = "Create a new JAM service")]
New(New),
}
Loading