Skip to content

Commit

Permalink
test build_info
Browse files Browse the repository at this point in the history
  • Loading branch information
sukoneck committed Nov 12, 2024
1 parent 977c892 commit 5fa7c52
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
runner: warp-ubuntu-latest-x64-16x

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

- name: Install dependencies
run: |
Expand All @@ -92,17 +92,17 @@ jobs:
echo diff && git diff --cached --name-status
echo ls-files && git ls-files --others --exclude-standard
# - name: Build binary
# run: |
# git config --global --add safe.directory "$(pwd)"
# . $HOME/.cargo/env
# cargo build --release --target ${{ matrix.configs.target }}

# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.OUTPUT_FILENAME }}
# path: target/${{ matrix.configs.target }}/release/rbuilder
- name: Build binary
run: |
git config --global --add safe.directory "$(pwd)"
. $HOME/.cargo/env
cargo build --release --target ${{ matrix.configs.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.OUTPUT_FILENAME }}
path: target/${{ matrix.configs.target }}/release/rbuilder

draft-release:
name: Draft release
Expand Down
27 changes: 14 additions & 13 deletions src/build_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ mod internal {

use internal::{
BUILT_TIME_UTC, FEATURES, GIT_COMMIT_HASH_SHORT, GIT_DIRTY, GIT_HEAD_REF, PROFILE,
RUSTC_VERSION,
RUSTC_VERSION, CI_PLATFORM,
};
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!("dirty: {}", GIT_DIRTY.unwrap_or_default());
println!("commit: {}", GIT_COMMIT_HASH_SHORT.unwrap_or_default());
println!("branch: {}", GIT_HEAD_REF.unwrap_or_default());
println!("build_platform: {}", CI_PLATFORM);
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 +27,11 @@ 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 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 5fa7c52

Please sign in to comment.