Skip to content

Commit

Permalink
chore: add --author= flag to git-commit cmd in new flow
Browse files Browse the repository at this point in the history
  • Loading branch information
dj8yf0μl committed Oct 22, 2024
1 parent 22cc88d commit f9b7660
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ jobs:

- name: Install packages (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install --assume-yes libudev-dev git
run: sudo apt-get update && sudo apt-get install --assume-yes libudev-dev

- name: Carg |
git --version
git config user.name "GitHub Actions Bot"
git config user.email "<>"
o check
- name: Cargo check
run: |
cargo check -p cargo-near
cargo check -p cargo-near-build --all-features
Expand Down Expand Up @@ -69,13 +65,12 @@ jobs:

- name: Install packages (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install --assume-yes libudev-dev git
run: sudo apt-get update && sudo apt-get install --assume-yes libudev-dev

- name: Run tests
run: |
git --version
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git config --global user.email "[email protected]"
git config --global user.name "nearprotocol-ci"
cargo test --workspace
lint:
Expand Down
12 changes: 2 additions & 10 deletions cargo-near/src/commands/new/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,20 @@ impl NewContext {
));
}

// let status = std::process::Command::new("git")
let child = std::process::Command::new("git")
.arg("commit")
.arg("-m")
.arg("init")
.arg("--author=nearprotocol-ci <[email protected]>")
.current_dir(project_dir)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
// .stdout(Stdio::null())
// .stderr(Stdio::null())
// .status()?;
.spawn()?;
// if !status.success() {
// return Err(color_eyre::eyre::eyre!(
// "Failed to execute process: `git commit -m init`"
// ));
// }
let output = child.wait_with_output()?;
if !output.status.success() {
println!("{}", String::from_utf8_lossy(&output.stderr));
return Err(color_eyre::eyre::eyre!(
"Failed to execute process: `cargo update`"
"Failed to execute process: `git commit -m init --author='nearprotocol-ci <[email protected]>'`"
));
}

Expand Down
7 changes: 6 additions & 1 deletion integration-tests/tests/cargo_near_new_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ fn test_docker_build() -> cargo_near::CliResult {
Ok(())
}

#[test]
fn test_new_command() -> cargo_near::CliResult {
let _generated_dir = run_cargo_near_new()?;
Ok(())
}

#[cfg(target_os = "linux")]
fn get_workspaces_rs_version(manifest_path: &camino::Utf8PathBuf) -> color_eyre::Result<String> {
use color_eyre::eyre::OptionExt;
Expand Down Expand Up @@ -69,7 +75,6 @@ fn get_workspaces_rs_version(manifest_path: &camino::Utf8PathBuf) -> color_eyre:
Ok(result)
}

#[cfg(target_os = "linux")]
fn run_cargo_near_new() -> color_eyre::Result<std::path::PathBuf> {
let out_path = {
let tmp_dir = tempfile::Builder::new()
Expand Down

0 comments on commit f9b7660

Please sign in to comment.