Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(source-scan): git checks, git metadata #159

Merged
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
664564b
chore: remove `Cargo.lock` from ommission in git-dirty check
dj8yfo Apr 24, 2024
794a96c
chore: replace `clone` with `clone_recurse` in clone local dir before…
dj8yfo Apr 24, 2024
ed52df5
feat: extract *git dirty* check
dj8yfo Apr 24, 2024
6df6ec1
todo: markup TODOs
dj8yfo Apr 25, 2024
48fa5f6
chore: extract `git_dirty_check` with output to method
dj8yfo Apr 25, 2024
aeacb99
feat: git pushed check during deploy reworked
dj8yfo Apr 25, 2024
3d9227b
feat: opening repo and determining HEAD
dj8yfo Apr 25, 2024
4ccee98
feat: opening repo with crate in non-root location
dj8yfo Apr 25, 2024
275dec6
chore: extract container paths compute
dj8yfo Apr 26, 2024
c163122
feat: export additional `CARGO_NEAR_...` variables
dj8yfo Apr 26, 2024
3c7c9c5
chore: make `CONTRACT_PATH_ENV_KEY` export optional
dj8yfo May 2, 2024
a80f7a0
chore: use `CARGO_NEAR_SOURCE_CODE_SNAPSHOT` instead of two separate …
dj8yfo May 2, 2024
1f015dd
ci: fix clippy
dj8yfo May 3, 2024
7a61bd8
feat: add `CARGO_NEAR_REPO_HINT_LINK` export for `/tree/{commit}` suffix
dj8yfo May 3, 2024
1ba99c0
chore: move `source_id` module to `crate::types`
dj8yfo May 3, 2024
7bf9423
fix: use only `unix_path::PathBuf` for contract in docker/metadata
dj8yfo May 6, 2024
0b16dad
chore: replace volume dir compute from `git2::Repository::workdir()` …
dj8yfo May 6, 2024
d8598df
fix: replace `#[cfg(unix)]` with `#[cfg(target_os = "linux")]` around…
dj8yfo May 8, 2024
db93a3c
fix: reduce number of `Option` combinators
dj8yfo May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
82 changes: 29 additions & 53 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions cargo-near/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ near-cli-rs = { version = "0.9.0", default-features = false }
dunce = "1"
tempfile = "3.10.1"
git2 = "0.18"
cargo_toml = "0.19.1"
reqwest = "0.11.24"
home = "0.5.9"
pathdiff = { version = "0.2.1", features = ["camino"]}
unix_path = "1.0.1"
url = { version = "2.5.0", features = ["serde"]}

[target.'cfg(unix)'.dependencies]
nix = { version = "0.28.0", features = ["user", "process"] }
Expand Down
21 changes: 19 additions & 2 deletions cargo-near/src/commands/build_command/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use near_abi::BuildInfo;
use sha2::{Digest, Sha256};

use crate::commands::abi_command::abi::{AbiCompression, AbiFormat, AbiResult};
use crate::commands::build_command::BUILD_CMD_ENV_KEY;
use crate::commands::build_command::{
BUILD_CMD_ENV_KEY, CONTRACT_PATH_ENV_KEY, SOURCE_CODE_SNAPSHOT_ENV_KEY,
};
use crate::common::ColorPreference;
use crate::types::manifest::MANIFEST_FILE_NAME;
use crate::types::{manifest::CargoManifestPath, metadata::CrateMetadata};
Expand All @@ -22,6 +24,7 @@ pub(super) fn run(
color.apply();

export_nep_330_build_command();
print_nep_330_env();

util::handle_step("Checking the host environment...", || {
if !wasm32_target_libdir_exists() {
Expand Down Expand Up @@ -139,5 +142,19 @@ fn export_nep_330_build_command() {
let cmd = cmd.join(" ");

std::env::set_var(BUILD_CMD_ENV_KEY, cmd.clone());
log::info!("exported: {}='{}'", BUILD_CMD_ENV_KEY, cmd);
}

fn print_nep_330_env() {
log::info!("Variables, relevant for reproducible builds:");
for key in [
INSIDE_DOCKER_ENV_KEY,
BUILD_CMD_ENV_KEY,
CONTRACT_PATH_ENV_KEY,
SOURCE_CODE_SNAPSHOT_ENV_KEY,
] {
let value = std::env::var(key)
.map(|val| format!("'{}'", val))
.unwrap_or("unset".to_string());
log::info!("{}={}", key, value);
}
}