Skip to content

Commit

Permalink
fix version report: replace git dirty with ci platform due to bug in …
Browse files Browse the repository at this point in the history
…crate (#23)

* test dirty cache

* add debug

* test build_info

* test build_info

* replace git dirty with ci platform due to bug in crate

* alphabetize vars

* appease lint
  • Loading branch information
sukoneck authored Nov 13, 2024
1 parent 0af371d commit 47710ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ jobs:
runner: warp-ubuntu-latest-x64-16x

steps:
- uses: WarpBuilds/rust-cache@v2

- name: Install dependencies
run: |
apt-get update
Expand All @@ -90,6 +88,7 @@ jobs:
git config --global --add safe.directory "$(pwd)"
. $HOME/.cargo/env
cargo build --release --target ${{ matrix.configs.target }}
./target/${{ matrix.configs.target }}/release/rbuilder version
- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
24 changes: 11 additions & 13 deletions src/build_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ mod internal {
}

use internal::{
BUILT_TIME_UTC, FEATURES, GIT_COMMIT_HASH_SHORT, GIT_DIRTY, GIT_HEAD_REF, PROFILE,
BUILT_TIME_UTC, CI_PLATFORM, FEATURES, GIT_COMMIT_HASH_SHORT, GIT_HEAD_REF, PROFILE,
RUSTC_VERSION,
};
use rbuilder::utils::build_info::Version;

pub fn print_version_info() {
println!("commit: {}", GIT_COMMIT_HASH_SHORT.unwrap_or_default());
println!("dirty: {}", GIT_DIRTY.unwrap_or_default());
println!("branch: {}", GIT_HEAD_REF.unwrap_or_default());
println!("build_time: {}", BUILT_TIME_UTC);
println!("rustc: {}", RUSTC_VERSION);
println!("features: {:?}", FEATURES);
println!("profile: {}", PROFILE);
println!(
"commit: {}",
GIT_COMMIT_HASH_SHORT.unwrap_or_default()
);
println!("branch: {}", GIT_HEAD_REF.unwrap_or_default());
println!("build_platform: {:?}", CI_PLATFORM.unwrap_or_default());
println!("build_time: {}", BUILT_TIME_UTC);
println!("features: {:?}", FEATURES);
println!("profile: {}", PROFILE);
println!("rustc: {}", RUSTC_VERSION);
}

pub fn rbuilder_version() -> Version {
Expand All @@ -26,11 +29,6 @@ pub fn rbuilder_version() -> Version {
if let Some(hash) = GIT_COMMIT_HASH_SHORT {
commit.push_str(hash);
}
if let Some(dirty) = GIT_DIRTY {
if dirty {
commit.push_str("-dirty");
}
}
if commit.is_empty() {
commit.push_str("unknown");
}
Expand Down

0 comments on commit 47710ab

Please sign in to comment.