Compare commits

..

3 Commits

Author SHA1 Message Date
45d6462037 chore(ci): with async/await 2023-02-19 22:51:34 +01:00
04990247ba Release dagger-sdk v0.2.8, dagger-codegen v0.2.5 2023-02-19 22:43:48 +01:00
978ede68ae feat(sdk): add documentation strings 2023-02-19 22:43:12 +01:00
7 changed files with 129 additions and 53 deletions

41
Cargo.lock generated
View File

@@ -114,8 +114,9 @@ version = "0.1.0"
dependencies = [ dependencies = [
"clap", "clap",
"color-eyre", "color-eyre",
"dagger-sdk 0.2.6", "dagger-sdk 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"eyre", "eyre",
"tokio",
] ]
[[package]] [[package]]
@@ -245,7 +246,7 @@ dependencies = [
[[package]] [[package]]
name = "dagger-codegen" name = "dagger-codegen"
version = "0.2.4" version = "0.2.5"
dependencies = [ dependencies = [
"convert_case", "convert_case",
"dagger-core 0.2.2", "dagger-core 0.2.2",
@@ -330,24 +331,7 @@ dependencies = [
[[package]] [[package]]
name = "dagger-sdk" name = "dagger-sdk"
version = "0.2.6" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "654625e954f59d70eb897bb681936c3e8b69c5f6e528f85c0b307554883db63f"
dependencies = [
"base64",
"dagger-core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_builder",
"eyre",
"futures",
"gql_client",
"serde",
"serde_json",
"tokio",
]
[[package]]
name = "dagger-sdk"
version = "0.2.7"
dependencies = [ dependencies = [
"base64", "base64",
"dagger-core 0.2.2", "dagger-core 0.2.2",
@@ -363,6 +347,23 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "dagger-sdk"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e90636d5b74ce8a62e8507a8d075c4d997c3123a1709596d0f97c3070f993b2d"
dependencies = [
"base64",
"dagger-core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_builder",
"eyre",
"futures",
"gql_client",
"serde",
"serde_json",
"tokio",
]
[[package]] [[package]]
name = "darling" name = "darling"
version = "0.14.3" version = "0.14.3"

View File

@@ -8,5 +8,6 @@ edition = "2021"
[dependencies] [dependencies]
clap = "4.1.6" clap = "4.1.6"
color-eyre = "0.6.2" color-eyre = "0.6.2"
dagger-sdk = "0.2.6" dagger-sdk = "0.2.8"
eyre = "0.6.8" eyre = "0.6.8"
tokio = { version = "1.25.0", features = ["full"] }

View File

@@ -2,7 +2,8 @@ use std::sync::Arc;
use dagger_sdk::{Container, HostDirectoryOpts, Query}; use dagger_sdk::{Container, HostDirectoryOpts, Query};
fn main() -> eyre::Result<()> { #[tokio::main]
async fn main() -> eyre::Result<()> {
color_eyre::install().unwrap(); color_eyre::install().unwrap();
let matches = clap::Command::new("ci") let matches = clap::Command::new("ci")
@@ -15,10 +16,10 @@ fn main() -> eyre::Result<()> {
match matches.subcommand() { match matches.subcommand() {
Some(("pr", _)) => { Some(("pr", _)) => {
let base = select_base_image(client.clone())?; let base = select_base_image(client.clone()).await?;
return validate_pr(client, base); return validate_pr(client, base).await;
} }
Some(("release", subm)) => return release(client, subm), Some(("release", subm)) => return release(client, subm).await,
Some(_) => { Some(_) => {
panic!("invalid subcommand selected!") panic!("invalid subcommand selected!")
} }
@@ -28,7 +29,7 @@ fn main() -> eyre::Result<()> {
} }
} }
fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyre::Report> { async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyre::Report> {
let src_dir = client.host().directory_opts( let src_dir = client.host().directory_opts(
".", ".",
HostDirectoryOpts { HostDirectoryOpts {
@@ -40,7 +41,7 @@ fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyr
.container() .container()
.from("rust:latest") .from("rust:latest")
.with_workdir("app") .with_workdir("app")
.with_mounted_directory("/app/", src_dir.id()?); .with_mounted_directory("/app/", src_dir.id().await?);
let container = base_image let container = base_image
.with_exec(vec!["cargo", "install", "cargo-smart-release"]) .with_exec(vec!["cargo", "install", "cargo-smart-release"])
@@ -53,7 +54,7 @@ fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyr
"dagger-rs", "dagger-rs",
"dagger-sdk", "dagger-sdk",
]); ]);
let exit = container.exit_code()?; let exit = container.exit_code().await?;
if exit != 0 { if exit != 0 {
eyre::bail!("container failed with non-zero exit code"); eyre::bail!("container failed with non-zero exit code");
} }
@@ -63,7 +64,7 @@ fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyr
Ok(()) Ok(())
} }
fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> { async fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
let cargo_dir = client.host().directory_opts( let cargo_dir = client.host().directory_opts(
".", ".",
HostDirectoryOpts { HostDirectoryOpts {
@@ -121,16 +122,16 @@ fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
.with_env_variable("SCCACHE_BUCKET", "sccache") .with_env_variable("SCCACHE_BUCKET", "sccache")
.with_env_variable("SCCACHE_REGION", "auto") .with_env_variable("SCCACHE_REGION", "auto")
.with_env_variable("SCCACHE_ENDPOINT", "https://api-minio.front.kjuulh.io") .with_env_variable("SCCACHE_ENDPOINT", "https://api-minio.front.kjuulh.io")
.with_mounted_cache("~/.cargo/bin", cache_cargo_bin.id()?) .with_mounted_cache("~/.cargo/bin", cache_cargo_bin.id().await?)
.with_mounted_cache("~/.cargo/registry/index", cache_cargo_bin.id()?) .with_mounted_cache("~/.cargo/registry/index", cache_cargo_bin.id().await?)
.with_mounted_cache("~/.cargo/registry/cache", cache_cargo_bin.id()?) .with_mounted_cache("~/.cargo/registry/cache", cache_cargo_bin.id().await?)
.with_mounted_cache("~/.cargo/git/db", cache_cargo_bin.id()?) .with_mounted_cache("~/.cargo/git/db", cache_cargo_bin.id().await?)
.with_mounted_cache("target/", cache_cargo_bin.id()?) .with_mounted_cache("target/", cache_cargo_bin.id().await?)
.with_exec(vec!["cargo", "install", "cargo-chef"]); .with_exec(vec!["cargo", "install", "cargo-chef"]);
let recipe = base_image let recipe = base_image
.with_mounted_directory(".", cargo_dir.id()?) .with_mounted_directory(".", cargo_dir.id().await?)
.with_mounted_cache("~/.cargo/.package-cache", cache_cargo_index_dir.id()?) .with_mounted_cache("~/.cargo/.package-cache", cache_cargo_index_dir.id().await?)
.with_exec(vec![ .with_exec(vec![
"cargo", "cargo",
"chef", "chef",
@@ -141,7 +142,7 @@ fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
.file("/app/recipe.json"); .file("/app/recipe.json");
let builder_start = base_image let builder_start = base_image
.with_mounted_file("/app/recipe.json", recipe.id()?) .with_mounted_file("/app/recipe.json", recipe.id().await?)
.with_exec(vec![ .with_exec(vec![
"cargo", "cargo",
"chef", "chef",
@@ -151,23 +152,23 @@ fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
"--recipe-path", "--recipe-path",
"recipe.json", "recipe.json",
]) ])
.with_mounted_cache("/app/", cache_cargo_deps.id()?) .with_mounted_cache("/app/", cache_cargo_deps.id().await?)
.with_mounted_directory("/app/", src_dir.id()?) .with_mounted_directory("/app/", src_dir.id().await?)
.with_exec(vec!["cargo", "build", "--all", "--release"]); .with_exec(vec!["cargo", "build", "--all", "--release"]);
return Ok(builder_start); return Ok(builder_start);
} }
fn select_base_image(client: Arc<Query>) -> eyre::Result<Container> { async fn select_base_image(client: Arc<Query>) -> eyre::Result<Container> {
let src_dir = get_dependencies(client.clone()); let src_dir = get_dependencies(client.clone()).await;
src_dir src_dir
} }
fn validate_pr(_client: Arc<Query>, container: Container) -> eyre::Result<()> { async fn validate_pr(_client: Arc<Query>, container: Container) -> eyre::Result<()> {
//let container = container.with_exec(vec!["cargo", "test", "--all"], None); //let container = container.with_exec(vec!["cargo", "test", "--all"], None);
let exit = container.exit_code()?; let exit = container.exit_code().await?;
if exit != 0 { if exit != 0 {
eyre::bail!("container failed with non-zero exit code"); eyre::bail!("container failed with non-zero exit code");
} }

View File

@@ -5,6 +5,53 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.5 (2023-02-19)
### New Features
- <csr-id-978ede68ae52f5b5150a2aa45b8d6e1fbbbee2f4/> add documentation strings
- <csr-id-9be6f435d9ea39f31a8906e55dbd3e8b1e5ec598/> Use async runtime instead of blocking.
Default to using async runtime instead of blocking. I.e.
```rust
fn main() -> eyre::Result<()> {
// ...
client.container().from("rust").publish("somewhere")?;
// ...
}
// to
async fn main() -> eyre::Result<()> {
// ...
client.container().from("rust").publish("somewhere").await?;
// ...
}
```
### Commit Statistics
<csr-read-only-do-not-edit/>
- 2 commits contributed to the release.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- add documentation strings ([`978ede6`](https://github.com/kjuulh/dagger-rs/commit/978ede68ae52f5b5150a2aa45b8d6e1fbbbee2f4))
- Use async runtime instead of blocking. ([`9be6f43`](https://github.com/kjuulh/dagger-rs/commit/9be6f435d9ea39f31a8906e55dbd3e8b1e5ec598))
</details>
## v0.2.4 (2023-02-19) ## v0.2.4 (2023-02-19)
### New Features ### New Features
@@ -51,7 +98,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<csr-read-only-do-not-edit/> <csr-read-only-do-not-edit/>
- 5 commits contributed to the release. - 6 commits contributed to the release.
- 5 commits were understood as [conventional](https://www.conventionalcommits.org). - 5 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages - 0 issues like '(#ID)' were seen in commit messages
@@ -62,6 +109,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<details><summary>view details</summary> <details><summary>view details</summary>
* **Uncategorized** * **Uncategorized**
- Release dagger-sdk v0.2.5, dagger-codegen v0.2.4 ([`f727318`](https://github.com/kjuulh/dagger-rs/commit/f72731807d8358fdb3d80432136b7a08bb7b1773))
- cargo clippy ([`c627595`](https://github.com/kjuulh/dagger-rs/commit/c627595fd2695e236924175d137c42f1480ccd6b)) - cargo clippy ([`c627595`](https://github.com/kjuulh/dagger-rs/commit/c627595fd2695e236924175d137c42f1480ccd6b))
- without Some in _opts functions ([`f29ff83`](https://github.com/kjuulh/dagger-rs/commit/f29ff836cfd72d5e051ca6a71a230ba1e9933091)) - without Some in _opts functions ([`f29ff83`](https://github.com/kjuulh/dagger-rs/commit/f29ff836cfd72d5e051ca6a71a230ba1e9933091))
- with _opts methods ([`9762da8`](https://github.com/kjuulh/dagger-rs/commit/9762da895a164e30c5dc60e89a83e934ceae47ab)) - with _opts methods ([`9762da8`](https://github.com/kjuulh/dagger-rs/commit/9762da895a164e30c5dc60e89a83e934ceae47ab))

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "dagger-codegen" name = "dagger-codegen"
version = "0.2.4" version = "0.2.5"
edition = "2021" edition = "2021"
readme = "README.md" readme = "README.md"
license-file = "LICENSE.MIT" license-file = "LICENSE.MIT"

View File

@@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.8 (2023-02-19)
### New Features
- <csr-id-978ede68ae52f5b5150a2aa45b8d6e1fbbbee2f4/> add documentation strings
### Commit Statistics
<csr-read-only-do-not-edit/>
- 1 commit contributed to the release.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- add documentation strings ([`978ede6`](https://github.com/kjuulh/dagger-rs/commit/978ede68ae52f5b5150a2aa45b8d6e1fbbbee2f4))
</details>
## v0.2.7 (2023-02-19) ## v0.2.7 (2023-02-19)
### Documentation ### Documentation
@@ -18,21 +42,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
```rust ```rust
fn main() -> eyre::Result<()> { fn main() -> eyre::Result<()> {
// ... // ...
client.container().from("rust").publish("somewhere")?; client.container().from("rust").publish("somewhere")?;
// ... // ...
} }
// to // to
async fn main() -> eyre::Result<()> { async fn main() -> eyre::Result<()> {
// ... // ...
client.container().from("rust").publish("somewhere").await?; client.container().from("rust").publish("somewhere").await?;
// ... // ...
} }
``` ```
@@ -40,7 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<csr-read-only-do-not-edit/> <csr-read-only-do-not-edit/>
- 2 commits contributed to the release. - 3 commits contributed to the release.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org). - 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages - 0 issues like '(#ID)' were seen in commit messages
@@ -51,6 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<details><summary>view details</summary> <details><summary>view details</summary>
* **Uncategorized** * **Uncategorized**
- Release dagger-sdk v0.2.7 ([`a1887af`](https://github.com/kjuulh/dagger-rs/commit/a1887afc8b51f61491ba7f13c5e7a5b7619623c4))
- change to await syntax ([`93f40b3`](https://github.com/kjuulh/dagger-rs/commit/93f40b356c48f14e910968516bed9487912095c1)) - change to await syntax ([`93f40b3`](https://github.com/kjuulh/dagger-rs/commit/93f40b356c48f14e910968516bed9487912095c1))
- Use async runtime instead of blocking. ([`9be6f43`](https://github.com/kjuulh/dagger-rs/commit/9be6f435d9ea39f31a8906e55dbd3e8b1e5ec598)) - Use async runtime instead of blocking. ([`9be6f43`](https://github.com/kjuulh/dagger-rs/commit/9be6f435d9ea39f31a8906e55dbd3e8b1e5ec598))
</details> </details>

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "dagger-sdk" name = "dagger-sdk"
version = "0.2.7" version = "0.2.8"
edition = "2021" edition = "2021"
readme = "README.md" readme = "README.md"
license-file = "LICENSE.MIT" license-file = "LICENSE.MIT"