mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-16 06:42:14 +00:00
This is a fresh start for the `artcraft` repo. The old monorepo, which included our web API gateway, job services, SRE tools, various frontends, and more has moved to `artcraft-services` You can find the full git history here: https://github.com/storytold/artcraft-services This change was motivated by the fact that the entire git history was hundreds of gigabytes in size, which is unwieldy for anyone not in the core team that doesn't care about support services outside of the core artcraft app. We wanted to keep this repo in its well-known place since we already have users and activity here. Please update your remotes to either `artcraft-services` or make a fresh clone of this repo. History can be found at the artcraft-services repo.
44 lines
914 B
Rust
44 lines
914 B
Rust
use std::ops::Deref;
|
|
use build_info::chrono::{DateTime, Utc};
|
|
|
|
build_info::build_info!(fn version);
|
|
|
|
pub fn build_timestamp() -> DateTime<Utc> {
|
|
version().timestamp
|
|
}
|
|
|
|
pub fn git_commit_id() -> Option<&'static str> {
|
|
version().version_control
|
|
.as_ref()
|
|
.map(|vc| vc.git())
|
|
.flatten()
|
|
.map(|git| git.commit_id.deref())
|
|
}
|
|
|
|
pub fn git_commit_short_id() -> Option<&'static str> {
|
|
version().version_control
|
|
.as_ref()
|
|
.map(|vc| vc.git())
|
|
.flatten()
|
|
.map(|git| git.commit_short_id.deref())
|
|
}
|
|
|
|
pub fn git_commit_timestamp() -> Option<DateTime<Utc>> {
|
|
version().version_control
|
|
.as_ref()
|
|
.map(|vc| vc.git())
|
|
.flatten()
|
|
.map(|git| git.commit_timestamp)
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use crate::git_commit_id;
|
|
|
|
#[test]
|
|
#[ignore] // Run manually for testing, not in CI
|
|
fn test_git_commit_id() {
|
|
assert_eq!(git_commit_id(), None);
|
|
}
|
|
}
|