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

Implement Go SDK support #145

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
*.pb.go
*.tar.*
.env
.vagrant
dist
packer_*_*_*.box
rootfs
target
vorpal-*-*
62 changes: 31 additions & 31 deletions Cargo.lock

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

11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[workspace]
members = ["cli", "config", "notary", "registry", "schema", "sdk", "store", "worker"]
members = [
"cli",
"config",
"notary",
"registry",
"schema",
"sdk/rust",
"store",
"worker"
]
resolver = "2"
53 changes: 35 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

Build and ship software with one powerful tool.

![vorpal-purpose](./vorpal-purpose.jpg)
<p align="center">
<img src="./vorpal-purpose.jpg" />
</p>

## Overview

Expand All @@ -14,20 +16,17 @@ Below are examples of a Rust application in Vorpal configured in different langu

```rust
use anyhow::Result;
use vorpal_schema::vorpal::config::v0::Config;
use vorpal_sdk::config::{artifact::language::rust::rust_artifact, get_context};

#[tokio::main]
async fn main() -> Result<()> {
let context = &mut get_context().await?;

let artifact = rust_artifact(context, "example-app").await?;
let example = rust_artifact(context, "example-app").await?;

context
.run(Config {
artifacts: vec![artifact],
})
.await
let artifacts = vec![artifact];

context.run(artifacts).await
}
```

Expand All @@ -40,7 +39,6 @@ import (
"context"
"log"

"github.com/vorpal-sdk/vorpal"
"github.com/vorpal-sdk/vorpal/config"
"github.com/vorpal-sdk/vorpal/config/artifact/language/rust"
)
Expand All @@ -51,20 +49,39 @@ func main() {
log.Fatal(err)
}

artifact, err := rust.Artifact(context, "example-app")
example, err := rust.Artifact(context, "example-app")
if err != nil {
log.Fatal(err)
}

err = context.Run(config.Config{
Artifacts: []config.Artifact{artifact},
})
artifacts := []config.Artifact{example}

err = context.Run(artifacts)
if err != nil {
log.Fatal(err)
}
}
```

### Python

```python
from vorpal_sdk.config import get_context
from vorpal_sdk.config.artifact.language.rust import rust_artifact

def main():
context = get_context()

example = rust_artifact(context, "example-app")

artifacts = [example]

context.run(artifacts)

if __name__ == "__main__":
main()
```

### TypeScript

```typescript
Expand All @@ -74,17 +91,17 @@ import { rustArtifact } from '@vorpal/sdk/config/artifact/language/rust';
async function main() {
const context = await getContext();

const artifact = await rustArtifact(context, 'example-app');
const example = await rustArtifact(context, 'example-app');

const artifacts = [example];

await context.run({
artifacts: [artifact],
}));
await context.run(artifacts);
}

main().catch(console.error);
```

## Infrastructure
## Components

Below is the existing working diagram that illustrates the platform's design:

Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ tracing-subscriber = { default-features = false, features = ["ansi", "fmt", "reg
vorpal-notary = { default-features = false, path = "../notary" }
vorpal-registry = { default-features = false, path = "../registry" }
vorpal-schema = { default-features = false, path = "../schema" }
vorpal-sdk = { default-features = false, path = "../sdk" }
vorpal-sdk = { default-features = false, path = "../sdk/rust" }
vorpal-store = { default-features = false, path = "../store" }
vorpal-worker = { default-features = false, path = "../worker" }
8 changes: 4 additions & 4 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ use vorpal_schema::{
registry::v0::registry_service_server::RegistryServiceServer,
},
};
use vorpal_sdk::config::{
artifact::{language::rust, toolchain::protoc},
ConfigContext,
use vorpal_sdk::{
artifact::{language::rust, protoc},
context::ConfigContext,
};
use vorpal_store::paths::{get_artifact_path, get_public_key_path};
use vorpal_worker::artifact::ArtifactServer;
Expand Down Expand Up @@ -238,7 +238,7 @@ async fn get_config_file_path(
bail!("config toolchain not found: {}", toolchain_path.display());
}

let toolchain_target = rust::get_toolchain_target(artifact_system)?;
let toolchain_target = rust::get_rust_toolchain_target(artifact_system)?;
let toolchain_version = get_rust_toolchain_version();

let toolchain_bin_path = Path::new(&format!(
Expand Down
3 changes: 2 additions & 1 deletion config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ path = "src/main.rs"
[dependencies]
anyhow = { default-features = false, version = "1" }
tokio = { default-features = false, features = ["rt-multi-thread"], version = "1" }
vorpal-sdk = { default-features = false, path = "../sdk" }
vorpal-schema = { default-features = false, path = "../schema" }
vorpal-sdk = { default-features = false, path = "../sdk/rust" }
Loading