7 Commits

Author SHA1 Message Date
113e5282ef fix(crate): initial pr always included the entire changelog
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-04 15:01:32 +02:00
fa67dfeee3 fix(crate): always prefix with 'v' when creating prs, or releases (#9)
All checks were successful
continuous-integration/drone/push Build is passing
We don't want rust versions to include the 'v',

however, many languages and tools require it. As such we're choosing when to do it, in this case at the api layer.

Signed-off-by: kjuulh <contact@kjuulh.io>
Reviewed-on: https://git.front.kjuulh.io/kjuulh/cuddle-please/pulls/9
Co-authored-by: kjuulh <contact@kjuulh.io>
Co-committed-by: kjuulh <contact@kjuulh.io>
2023-08-04 12:41:31 +00:00
8a8d309ddf chore(release): 0.2.1 (#8)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
### Docs
- *(check)* 0.2 milestone, forgot for 0.2.0

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: https://git.front.kjuulh.io/kjuulh/cuddle-please/pulls/8
2023-08-04 12:33:10 +00:00
09508ec986 docs(check): 0.2 milestone, forgot for 0.2.0
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-04 14:22:41 +02:00
0967e35fbf chore(release): 0.2.0 (#7)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
### Added
- *(ci)* with pr
- *(ci)* on pr only
- *(ci)* with ci:pr.sh file
- *(ci)* update ci with best settings
- *(ci)* pr ignore master
- *(ci)* ignore pr for master
- add git init
- with actual docker login
- with docker login
- back to default
- with ldd
- only ci
- with musl instead
- with some debug stuff
- with shared volume
- with shared volume
- without going into module
- set to use prefix when in ci
- only master
- with working main
- ci:main script for ci
- with run script
- fixed stuff
- with ultra caching
- with ci
- with set -e for abort
- with drone yml
- add mkdocs build
- add basic version
- update with repository
- add publishable to rest
- hack get in control of log level

### Docs
- fix admonitions
- add docs
- remove 0.1 milestone

### Fixed
- with actual install

### Other
- *(rust)* fmt
- *(rust)* clippy fix
- *(ci)* no please for pr
- *(ci)* rename pr -> pull-request in ci:pr
- remove faulty test
- add git (alpine)
- add git
- musl
- remember package name
- rename variable
- openssl-src
- with openssl-dev
- with pkg config sysroot
- with musl dev
- with build-essential
- with libssl-dev
- with token
- add mit license
- add logging to stdout
- update versions
- add docs

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: https://git.front.kjuulh.io/kjuulh/cuddle-please/pulls/7
2023-08-03 23:23:05 +00:00
67c2c0c0c5 chore(rust): fmt
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-04 01:19:15 +02:00
78307ec8a3 chore(rust): clippy fix
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-04 01:18:58 +02:00
7 changed files with 128 additions and 68 deletions

View File

@@ -6,6 +6,78 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [0.2.1] - 2023-08-04
### Docs
- *(check)* 0.2 milestone, forgot for 0.2.0
## [0.2.0] - 2023-08-03
### Added
- *(ci)* with pr
- *(ci)* on pr only
- *(ci)* with ci:pr.sh file
- *(ci)* update ci with best settings
- *(ci)* pr ignore master
- *(ci)* ignore pr for master
- add git init
- with actual docker login
- with docker login
- back to default
- with ldd
- only ci
- with musl instead
- with some debug stuff
- with shared volume
- with shared volume
- without going into module
- set to use prefix when in ci
- only master
- with working main
- ci:main script for ci
- with run script
- fixed stuff
- with ultra caching
- with ci
- with set -e for abort
- with drone yml
- add mkdocs build
- add basic version
- update with repository
- add publishable to rest
- hack get in control of log level
### Docs
- fix admonitions
- add docs
- remove 0.1 milestone
### Fixed
- with actual install
### Other
- *(rust)* fmt
- *(rust)* clippy fix
- *(ci)* no please for pr
- *(ci)* rename pr -> pull-request in ci:pr
- remove faulty test
- add git (alpine)
- add git
- musl
- remember package name
- rename variable
- openssl-src
- with openssl-dev
- with pkg config sysroot
- with musl dev
- with build-essential
- with libssl-dev
- with token
- add mit license
- add logging to stdout
- update versions
- add docs
## [0.1.0] - 2023-08-01 ## [0.1.0] - 2023-08-01
### Added ### Added

View File

@@ -38,20 +38,23 @@ See docs for more information about installation and some such
### 0.2 Milestone ### 0.2 Milestone
- [ ] Add docs - [x] Add docs
- [ ] Add asciinema - [ ] Add asciinema
- [ ] Create docker image - [x] Create docker image
- [ ] Add examples - [x] Add examples
- [ ] Fx drone config - [x] Fx drone config
- [ ] Releaser - [x] Releaser
- [ ] On main/master - [x] On main/master
- [ ] Add reporter for PR and Repositories
- [ ] tbd... - [ ] tbd...
### 0.3 Milestone ### 0.3 Milestone
- [ ] Fix: 0.0.0 -> **v**0.0.0
- [ ] Add release strategies
- [ ] Add reporter for PR and Repositories
- [ ] Add inquire for missing values when needed (when not running in ci or have a proper tty) - [ ] Add inquire for missing values when needed (when not running in ci or have a proper tty)
- [ ] Break down cuddle-please-misc - [ ] Break down cuddle-please-misc
- [ ] ci(release): Add cuddle-please release artifacts for the different os and so on.
### 0.x Milestone ### 0.x Milestone
- [ ] Add github support - [ ] Add github support

View File

@@ -2,19 +2,14 @@ use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use build::build_and_deploy;
use clap::Args; use clap::Args;
use clap::Parser; use clap::Parser;
use clap::Subcommand; use clap::Subcommand;
use clap::ValueEnum; use clap::ValueEnum;
use dagger_sdk::ContainerId;
use dagger_sdk::ContainerPublishOpts;
use dagger_sdk::Platform; use dagger_sdk::Platform;
use dagger_sdk::QueryContainerOpts; use dagger_sdk::QueryContainerOpts;
use futures::StreamExt; use futures::StreamExt;
use tokio::sync::Mutex;
use tokio::task::JoinHandle;
use crate::please_release::run_release_please; use crate::please_release::run_release_please;
@@ -137,7 +132,7 @@ async fn main() -> eyre::Result<()> {
&cli.global, &cli.global,
&base_image, &base_image,
&prod_image, &prod_image,
&bin_name, bin_name,
&None, &None,
) )
.await?; .await?;
@@ -158,11 +153,11 @@ async fn main() -> eyre::Result<()> {
image, image,
bin_name, bin_name,
} => { } => {
build::build_and_deploy(client, &cli.global, &bin_name, &image, &tag).await?; build::build_and_deploy(client, &cli.global, bin_name, image, tag).await?;
} }
LocalCommands::PleaseRelease => todo!(), LocalCommands::PleaseRelease => todo!(),
LocalCommands::BuildDocs {} => { LocalCommands::BuildDocs {} => {
let image = docs::execute( let _image = docs::execute(
client.clone(), client.clone(),
&cli.global, &cli.global,
&Some("linux/amd64".to_string()), &Some("linux/amd64".to_string()),
@@ -179,10 +174,10 @@ async fn main() -> eyre::Result<()> {
let args = &cli.global; let args = &cli.global;
let base_image = let base_image =
base_rust_image(client.clone(), &args, &None, bin_name, &"debug".into()) base_rust_image(client.clone(), args, &None, bin_name, &"debug".into())
.await .await
.unwrap(); .unwrap();
test::execute(client.clone(), &args, base_image) test::execute(client.clone(), args, base_image)
.await .await
.unwrap(); .unwrap();
} }
@@ -195,14 +190,14 @@ async fn main() -> eyre::Result<()> {
) { ) {
let args = &cli.global; let args = &cli.global;
build::build(client.clone(), &args, bin_name, image, tag) build::build(client.clone(), args, bin_name, image, tag)
.await .await
.unwrap(); .unwrap();
} }
tokio::join!( tokio::join!(
test(client.clone(), &cli, &bin_name), test(client.clone(), &cli, bin_name),
build(client.clone(), &cli, &bin_name, &image, &tag), build(client.clone(), &cli, bin_name, image, tag),
); );
} }
Commands::Main { Commands::Main {
@@ -214,10 +209,10 @@ async fn main() -> eyre::Result<()> {
let args = &cli.global; let args = &cli.global;
let base_image = let base_image =
base_rust_image(client.clone(), &args, &None, bin_name, &"debug".into()) base_rust_image(client.clone(), args, &None, bin_name, &"debug".into())
.await .await
.unwrap(); .unwrap();
test::execute(client.clone(), &args, base_image) test::execute(client.clone(), args, base_image)
.await .await
.unwrap(); .unwrap();
} }
@@ -230,7 +225,7 @@ async fn main() -> eyre::Result<()> {
) { ) {
let args = &cli.global; let args = &cli.global;
build::build_and_deploy(client.clone(), &args, bin_name, image, tag) build::build_and_deploy(client.clone(), args, bin_name, image, tag)
.await .await
.unwrap(); .unwrap();
} }
@@ -242,8 +237,8 @@ async fn main() -> eyre::Result<()> {
} }
tokio::join!( tokio::join!(
test(client.clone(), &cli, &bin_name), test(client.clone(), &cli, bin_name),
build(client.clone(), &cli, &bin_name, &image, &tag), build(client.clone(), &cli, bin_name, image, tag),
cuddle_please(client.clone(), &cli) cuddle_please(client.clone(), &cli)
); );
} }
@@ -257,9 +252,7 @@ mod please_release {
use std::sync::Arc; use std::sync::Arc;
use dagger_sdk::Container; use crate::{base_rust_image, GlobalArgs};
use crate::{base_rust_image, build, get_base_debian_image, get_rust_dep_src, GlobalArgs};
pub async fn run_release_please( pub async fn run_release_please(
client: Arc<dagger_sdk::Query>, client: Arc<dagger_sdk::Query>,
@@ -366,7 +359,7 @@ mod docs {
pub async fn execute( pub async fn execute(
client: Arc<dagger_sdk::Query>, client: Arc<dagger_sdk::Query>,
args: &GlobalArgs, args: &GlobalArgs,
platform: &Option<String>, _platform: &Option<String>,
) -> eyre::Result<Container> { ) -> eyre::Result<Container> {
let mkdocs_container = client.container().from( let mkdocs_container = client.container().from(
args.mkdocs_image args.mkdocs_image
@@ -429,10 +422,6 @@ mod build {
use dagger_sdk::Container; use dagger_sdk::Container;
use futures::StreamExt;
use tokio::sync::Mutex;
use tokio::task::JoinHandle;
use crate::{base_rust_image, get_base_debian_image, GlobalArgs}; use crate::{base_rust_image, get_base_debian_image, GlobalArgs};
pub async fn build_and_deploy( pub async fn build_and_deploy(
@@ -453,7 +442,7 @@ mod build {
let container = base_rust_image( let container = base_rust_image(
client.clone(), client.clone(),
&args, args,
&Some("linux/amd64".to_string()), &Some("linux/amd64".to_string()),
&bin_name.clone(), &bin_name.clone(),
&"release".into(), &"release".into(),
@@ -461,10 +450,10 @@ mod build {
.await?; .await?;
let build_image = execute( let build_image = execute(
client.clone(), client.clone(),
&args, args,
&container, &container,
&base_image, &base_image,
&bin_name, bin_name,
&Some("linux/amd64".to_string()), &Some("linux/amd64".to_string()),
) )
.await?; .await?;
@@ -487,8 +476,8 @@ mod build {
client: Arc<dagger_sdk::Query>, client: Arc<dagger_sdk::Query>,
args: &GlobalArgs, args: &GlobalArgs,
bin_name: &String, bin_name: &String,
image: &String, _image: &String,
tag: &String, _tag: &String,
) -> eyre::Result<()> { ) -> eyre::Result<()> {
// let containers = vec!["linux/amd64", "linux/arm64"]; // let containers = vec!["linux/amd64", "linux/arm64"];
@@ -501,7 +490,7 @@ mod build {
let container = base_rust_image( let container = base_rust_image(
client.clone(), client.clone(),
&args, args,
&Some("linux/amd64".to_string()), &Some("linux/amd64".to_string()),
&bin_name.clone(), &bin_name.clone(),
&"release".into(), &"release".into(),
@@ -509,10 +498,10 @@ mod build {
.await?; .await?;
let build_image = execute( let build_image = execute(
client.clone(), client.clone(),
&args, args,
&container, &container,
&base_image, &base_image,
&bin_name, bin_name,
&Some("linux/amd64".to_string()), &Some("linux/amd64".to_string()),
) )
.await?; .await?;
@@ -545,7 +534,7 @@ mod build {
rust_target, rust_target,
"--release", "--release",
"-p", "-p",
&bin_name, bin_name,
]); ]);
let final_image = base_image let final_image = base_image
@@ -556,7 +545,7 @@ mod build {
.id() .id()
.await?, .await?,
) )
.with_exec(vec![&bin_name, "--help"]); .with_exec(vec![bin_name, "--help"]);
let output = final_image.stdout().await?; let output = final_image.stdout().await?;
println!("{output}"); println!("{output}");
@@ -654,12 +643,12 @@ pub async fn get_rust_dep_src(
.build()?, .build()?,
); );
return Ok(directory); Ok(directory)
} }
pub async fn get_rust_skeleton_files( pub async fn get_rust_skeleton_files(
client: Arc<dagger_sdk::Query>, client: Arc<dagger_sdk::Query>,
args: &GlobalArgs, _args: &GlobalArgs,
) -> eyre::Result<(dagger_sdk::Directory, Vec<String>)> { ) -> eyre::Result<(dagger_sdk::Directory, Vec<String>)> {
let mut rust_crates = vec![PathBuf::from("ci")]; let mut rust_crates = vec![PathBuf::from("ci")];
let mut dirs = tokio::fs::read_dir("crates").await?; let mut dirs = tokio::fs::read_dir("crates").await?;
@@ -701,7 +690,7 @@ pub async fn get_rust_skeleton_files(
if let Some(file_name) = rust_crate.file_name() { if let Some(file_name) = rust_crate.file_name() {
crate_names.push(file_name.to_str().unwrap().to_string()); crate_names.push(file_name.to_str().unwrap().to_string());
} }
directory = create_skeleton_files(directory, &rust_crate)?; directory = create_skeleton_files(directory, rust_crate)?;
} }
Ok((directory, crate_names)) Ok((directory, crate_names))
@@ -739,7 +728,7 @@ pub async fn base_rust_image(
.with_exec(vec!["rustup", "target", "add", rust_target]); .with_exec(vec!["rustup", "target", "add", rust_target]);
let target_cache = client.cache_volume(format!("rust_target_{}", profile)); let target_cache = client.cache_volume(format!("rust_target_{}", profile));
let mut build_options = vec!["cargo", "build", "--target", rust_target, "-p", &bin_name]; let mut build_options = vec!["cargo", "build", "--target", rust_target, "-p", bin_name];
if profile == "release" { if profile == "release" {
build_options.push("--release"); build_options.push("--release");
@@ -754,7 +743,7 @@ pub async fn base_rust_image(
let exclude = crates let exclude = crates
.iter() .iter()
.filter(|c| **c != "ci") .filter(|c| **c != "ci")
.map(|c| format!("**/*{}*", c.replace("-", "_"))) .map(|c| format!("**/*{}*", c.replace('-', "_")))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let exclude = exclude.iter().map(|c| c.as_str()).collect(); let exclude = exclude.iter().map(|c| c.as_str()).collect();

View File

@@ -50,10 +50,8 @@ impl ReleaseCommandHandler {
tracing::trace!("fetched commits since last version"); tracing::trace!("fetched commits since last version");
let current_version = get_current_version(significant_tag); let current_version = get_current_version(significant_tag);
tracing::trace!("found current version: {}", current_version.to_string()); tracing::trace!("found current version: {}", current_version.to_string());
self.ui.write_str_ln(&format!( self.ui
"found current version: {}", .write_str_ln(&format!("found current version: {}", current_version));
current_version
));
let conventional_commit_results = parse_conventional_commits(current_version, commits)?; let conventional_commit_results = parse_conventional_commits(current_version, commits)?;
tracing::trace!("parsing conventional commits"); tracing::trace!("parsing conventional commits");
@@ -64,10 +62,8 @@ impl ReleaseCommandHandler {
return Ok(()); return Ok(());
} }
let (commit_strs, next_version) = conventional_commit_results.unwrap(); let (commit_strs, next_version) = conventional_commit_results.unwrap();
self.ui.write_str_ln(&format!( self.ui
"calculated next version: {}", .write_str_ln(&format!("calculated next version: {}", next_version));
next_version
));
tracing::trace!("creating changelog"); tracing::trace!("creating changelog");
let (changelog_placement, changelog, changelog_last_changes) = let (changelog_placement, changelog, changelog_last_changes) =
@@ -153,7 +149,8 @@ impl ReleaseCommandHandler {
owner, owner,
repository, repository,
&next_version.to_string(), &next_version.to_string(),
&changelog_last_changes.unwrap(), &changelog_last_changes
.ok_or(anyhow::anyhow!("could not get the latest changes"))?,
existing_pr, existing_pr,
)? )?
} else { } else {
@@ -168,7 +165,8 @@ impl ReleaseCommandHandler {
owner, owner,
repository, repository,
&next_version.to_string(), &next_version.to_string(),
&changelog, &changelog_last_changes
.ok_or(anyhow::anyhow!("could not get the latest changes"))?,
branch, branch,
)? )?
} else { } else {
@@ -253,7 +251,6 @@ fn parse_conventional_commits(
} }
fn get_current_version(significant_tag: Option<Tag>) -> Version { fn get_current_version(significant_tag: Option<Tag>) -> Version {
significant_tag significant_tag
.map(|st| Version::try_from(st).unwrap()) .map(|st| Version::try_from(st).unwrap())
.unwrap_or(Version::new(0, 0, 0)) .unwrap_or(Version::new(0, 0, 0))

View File

@@ -30,10 +30,9 @@ const CUDDLE_CONFIG_FILE_NAME: &str = "cuddle.please";
const YAML_EXTENSION: &str = "yaml"; const YAML_EXTENSION: &str = "yaml";
pub fn get_config_from_config_file(current_dir: &Path) -> PleaseConfigBuilder { pub fn get_config_from_config_file(current_dir: &Path) -> PleaseConfigBuilder {
let current_cuddle_path = current_dir let current_cuddle_path = current_dir.join(format!("{CUDDLE_FILE_NAME}.{YAML_EXTENSION}"));
.join(format!("{CUDDLE_FILE_NAME}.{YAML_EXTENSION}")); let current_cuddle_config_path =
let current_cuddle_config_path = current_dir current_dir.join(format!("{CUDDLE_CONFIG_FILE_NAME}.{YAML_EXTENSION}"));
.join(format!("{CUDDLE_CONFIG_FILE_NAME}.{YAML_EXTENSION}"));
let mut please_config = PleaseConfigBuilder::default(); let mut please_config = PleaseConfigBuilder::default();
if let Some(config) = get_config_from_file::<CuddleEmbeddedPleaseConfig>(current_cuddle_path) { if let Some(config) = get_config_from_file::<CuddleEmbeddedPleaseConfig>(current_cuddle_path) {

View File

@@ -67,7 +67,7 @@ impl VcsClient {
"-c", "-c",
&format!("http.extraHeader='Authorization: token {}'", token), &format!("http.extraHeader='Authorization: token {}'", token),
"-c", "-c",
&format!("http.extraHeader='Sudo: kjuulh'"), "http.extraHeader='Sudo: kjuulh'",
"-c", "-c",
&format!("user.name={}", username), &format!("user.name={}", username),
"-c", "-c",

View File

@@ -330,7 +330,7 @@ impl RemoteGitEngine for GiteaClient {
base: base.into(), base: base.into(),
body: body.into(), body: body.into(),
head: "cuddle-please/release".into(), head: "cuddle-please/release".into(),
title: format!("chore(release): {}", version), title: format!("chore(release): v{}", version),
}; };
tracing::trace!( tracing::trace!(
@@ -377,7 +377,7 @@ impl RemoteGitEngine for GiteaClient {
let request = CreatePullRequestOption { let request = CreatePullRequestOption {
body: body.into(), body: body.into(),
title: format!("chore(release): {}", version), title: format!("chore(release): v{}", version),
}; };
tracing::trace!( tracing::trace!(
@@ -429,9 +429,9 @@ impl RemoteGitEngine for GiteaClient {
let request = CreateReleaseOption { let request = CreateReleaseOption {
body: body.into(), body: body.into(),
draft: false, draft: false,
name: version.into(), name: format!("v{version}"),
prerelease, prerelease,
tag_name: version.into(), tag_name: format!("v{version}"),
}; };
tracing::trace!( tracing::trace!(