-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2cf9d9
commit 90d9414
Showing
19 changed files
with
358 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,5 +71,5 @@ fn check_npm() -> Result<()> { | |
} | ||
|
||
fn check_mkdocs() -> Result<()> { | ||
Mkdocs::build() | ||
Mkdocs::check() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use anyhow::Result; | ||
|
||
use crate::toolchains::mkdocs::Mkdocs; | ||
|
||
pub fn publish_mkdocs(dry_run: bool) -> Result<()> { | ||
Mkdocs::publish(dry_run) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use anyhow::Result; | ||
use infra_utils::commands::Command; | ||
use infra_utils::github::GitHub; | ||
|
||
pub fn setup_git() -> Result<()> { | ||
if !GitHub::is_running_in_ci() { | ||
println!("No need to modify local dev environments."); | ||
return Ok(()); | ||
} | ||
|
||
Command::new("git") | ||
.arg("config") | ||
.property("user.name", "github-actions") | ||
.run()?; | ||
|
||
Command::new("git") | ||
.arg("config") | ||
.property("user.email", "[email protected]") | ||
.run()?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,7 @@ | ||
use std::collections::HashMap; | ||
use std::path::Path; | ||
use anyhow::Result; | ||
|
||
use anyhow::{Context, Result}; | ||
use infra_utils::commands::Command; | ||
use infra_utils::github::GitHub; | ||
use infra_utils::paths::PathExtensions; | ||
use serde::Deserialize; | ||
use crate::toolchains::pipenv::PipEnv; | ||
|
||
pub fn setup_pipenv() -> Result<()> { | ||
// Install the 'pipenv' binary using the version defined in the `Pipfile`. | ||
install_pipenv_binary()?; | ||
|
||
// Use it to install other dependencies: | ||
install_project_packages()?; | ||
|
||
Ok(()) | ||
} | ||
|
||
#[derive(Deserialize)] | ||
struct Pipfile { | ||
packages: HashMap<String, String>, | ||
} | ||
|
||
fn install_pipenv_binary() -> Result<()> { | ||
let pip_file_toml = Path::repo_path("Pipfile").read_to_string()?; | ||
let pip_file: Pipfile = toml::from_str(&pip_file_toml)?; | ||
|
||
// This should be a value like "==YYYY.MM.DD" | ||
let version = pip_file | ||
.packages | ||
.get("pipenv") | ||
.context("Failed to find 'pipenv' in 'Pipfile' packages.")?; | ||
|
||
// pip3 install "pipenv==YYYY.MM.DD" | ||
Command::new("pip3") | ||
.arg("install") | ||
.arg(format!("pipenv{version}")) | ||
.run() | ||
} | ||
|
||
fn install_project_packages() -> Result<()> { | ||
let mut command = Command::new("python3") | ||
.property("-m", "pipenv") | ||
.arg("install"); | ||
|
||
if GitHub::is_running_in_ci() { | ||
command = command.flag("--deploy"); | ||
} | ||
|
||
command.run() | ||
PipEnv::install_packages() | ||
} |
Oops, something went wrong.