mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-12-29 11:11:02 +01:00
Compare commits
1 Commits
45d6462037
...
feat/add-c
| Author | SHA1 | Date | |
|---|---|---|---|
|
c3806bac00
|
41
Cargo.lock
generated
41
Cargo.lock
generated
@@ -114,9 +114,8 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
"dagger-sdk 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dagger-sdk 0.2.6",
|
||||||
"eyre",
|
"eyre",
|
||||||
"tokio",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -246,7 +245,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dagger-codegen"
|
name = "dagger-codegen"
|
||||||
version = "0.2.5"
|
version = "0.2.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case",
|
||||||
"dagger-core 0.2.2",
|
"dagger-core 0.2.2",
|
||||||
@@ -331,7 +330,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dagger-sdk"
|
name = "dagger-sdk"
|
||||||
version = "0.2.8"
|
version = "0.2.6"
|
||||||
|
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",
|
||||||
@@ -347,23 +363,6 @@ 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"
|
||||||
|
|||||||
@@ -8,6 +8,5 @@ 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.8"
|
dagger-sdk = "0.2.6"
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
tokio = { version = "1.25.0", features = ["full"] }
|
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use dagger_sdk::{Container, HostDirectoryOpts, Query};
|
use dagger_sdk::{Container, HostDirectoryOpts, Query};
|
||||||
|
|
||||||
#[tokio::main]
|
fn main() -> eyre::Result<()> {
|
||||||
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")
|
||||||
@@ -16,10 +15,10 @@ async fn main() -> eyre::Result<()> {
|
|||||||
|
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
Some(("pr", _)) => {
|
Some(("pr", _)) => {
|
||||||
let base = select_base_image(client.clone()).await?;
|
let base = select_base_image(client.clone())?;
|
||||||
return validate_pr(client, base).await;
|
return validate_pr(client, base);
|
||||||
}
|
}
|
||||||
Some(("release", subm)) => return release(client, subm).await,
|
Some(("release", subm)) => return release(client, subm),
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
panic!("invalid subcommand selected!")
|
panic!("invalid subcommand selected!")
|
||||||
}
|
}
|
||||||
@@ -29,7 +28,7 @@ async fn main() -> eyre::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyre::Report> {
|
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 {
|
||||||
@@ -41,7 +40,7 @@ async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), col
|
|||||||
.container()
|
.container()
|
||||||
.from("rust:latest")
|
.from("rust:latest")
|
||||||
.with_workdir("app")
|
.with_workdir("app")
|
||||||
.with_mounted_directory("/app/", src_dir.id().await?);
|
.with_mounted_directory("/app/", src_dir.id()?);
|
||||||
|
|
||||||
let container = base_image
|
let container = base_image
|
||||||
.with_exec(vec!["cargo", "install", "cargo-smart-release"])
|
.with_exec(vec!["cargo", "install", "cargo-smart-release"])
|
||||||
@@ -54,7 +53,7 @@ async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), col
|
|||||||
"dagger-rs",
|
"dagger-rs",
|
||||||
"dagger-sdk",
|
"dagger-sdk",
|
||||||
]);
|
]);
|
||||||
let exit = container.exit_code().await?;
|
let exit = container.exit_code()?;
|
||||||
if exit != 0 {
|
if exit != 0 {
|
||||||
eyre::bail!("container failed with non-zero exit code");
|
eyre::bail!("container failed with non-zero exit code");
|
||||||
}
|
}
|
||||||
@@ -64,7 +63,7 @@ async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), col
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
|
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 {
|
||||||
@@ -122,16 +121,16 @@ async 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().await?)
|
.with_mounted_cache("~/.cargo/bin", cache_cargo_bin.id()?)
|
||||||
.with_mounted_cache("~/.cargo/registry/index", cache_cargo_bin.id().await?)
|
.with_mounted_cache("~/.cargo/registry/index", cache_cargo_bin.id()?)
|
||||||
.with_mounted_cache("~/.cargo/registry/cache", cache_cargo_bin.id().await?)
|
.with_mounted_cache("~/.cargo/registry/cache", cache_cargo_bin.id()?)
|
||||||
.with_mounted_cache("~/.cargo/git/db", cache_cargo_bin.id().await?)
|
.with_mounted_cache("~/.cargo/git/db", cache_cargo_bin.id()?)
|
||||||
.with_mounted_cache("target/", cache_cargo_bin.id().await?)
|
.with_mounted_cache("target/", cache_cargo_bin.id()?)
|
||||||
.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().await?)
|
.with_mounted_directory(".", cargo_dir.id()?)
|
||||||
.with_mounted_cache("~/.cargo/.package-cache", cache_cargo_index_dir.id().await?)
|
.with_mounted_cache("~/.cargo/.package-cache", cache_cargo_index_dir.id()?)
|
||||||
.with_exec(vec![
|
.with_exec(vec![
|
||||||
"cargo",
|
"cargo",
|
||||||
"chef",
|
"chef",
|
||||||
@@ -142,7 +141,7 @@ async 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().await?)
|
.with_mounted_file("/app/recipe.json", recipe.id()?)
|
||||||
.with_exec(vec![
|
.with_exec(vec![
|
||||||
"cargo",
|
"cargo",
|
||||||
"chef",
|
"chef",
|
||||||
@@ -152,23 +151,23 @@ async 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().await?)
|
.with_mounted_cache("/app/", cache_cargo_deps.id()?)
|
||||||
.with_mounted_directory("/app/", src_dir.id().await?)
|
.with_mounted_directory("/app/", src_dir.id()?)
|
||||||
.with_exec(vec!["cargo", "build", "--all", "--release"]);
|
.with_exec(vec!["cargo", "build", "--all", "--release"]);
|
||||||
|
|
||||||
return Ok(builder_start);
|
return Ok(builder_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn select_base_image(client: Arc<Query>) -> eyre::Result<Container> {
|
fn select_base_image(client: Arc<Query>) -> eyre::Result<Container> {
|
||||||
let src_dir = get_dependencies(client.clone()).await;
|
let src_dir = get_dependencies(client.clone());
|
||||||
|
|
||||||
src_dir
|
src_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn validate_pr(_client: Arc<Query>, container: Container) -> eyre::Result<()> {
|
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().await?;
|
let exit = container.exit_code()?;
|
||||||
if exit != 0 {
|
if exit != 0 {
|
||||||
eyre::bail!("container failed with non-zero exit code");
|
eyre::bail!("container failed with non-zero exit code");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,53 +5,6 @@ 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
|
||||||
@@ -98,7 +51,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/>
|
||||||
|
|
||||||
- 6 commits contributed to the release.
|
- 5 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
|
||||||
|
|
||||||
@@ -109,7 +62,6 @@ 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))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dagger-codegen"
|
name = "dagger-codegen"
|
||||||
version = "0.2.5"
|
version = "0.2.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license-file = "LICENSE.MIT"
|
license-file = "LICENSE.MIT"
|
||||||
|
|||||||
@@ -5,30 +5,6 @@ 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
|
||||||
@@ -64,7 +40,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/>
|
||||||
|
|
||||||
- 3 commits contributed to the release.
|
- 2 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
|
||||||
|
|
||||||
@@ -75,7 +51,6 @@ 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>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dagger-sdk"
|
name = "dagger-sdk"
|
||||||
version = "0.2.8"
|
version = "0.2.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license-file = "LICENSE.MIT"
|
license-file = "LICENSE.MIT"
|
||||||
|
|||||||
Reference in New Issue
Block a user