Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f201939
ci: add GitHub release workflow with dynamic versioning
nerdCopter Dec 4, 2025
0ddc469
fix: github-release workflow - wire inputs, outputs, tags, and upgrad…
nerdCopter Dec 9, 2025
1259466
refactor: simplify github-release workflow (Option B)
nerdCopter Dec 9, 2025
b1df57e
improve: add format validation and explicit error handling in github-…
nerdCopter Dec 9, 2025
b537015
Merge branch 'master' into 20251204_vergen_CI
nerdCopter Dec 9, 2025
9125c08
refactor: consolidate release workflows - remove github-release.yml
nerdCopter Dec 9, 2025
1babe27
feat: include full version info (semver + vergen) in CLI and release …
nerdCopter Dec 9, 2025
f86b1e9
fix: extract version on all platforms in release workflow
nerdCopter Dec 9, 2025
5dd4366
refactor: remove duplicate version extraction from publish-crates job
nerdCopter Dec 9, 2025
2318223
refactor: move version extraction out of matrix to separate job
nerdCopter Dec 9, 2025
1d5ccbb
fix: remove unconditional version print and replace gh-release action…
nerdCopter Dec 9, 2025
1a327d6
fix: harden version extraction step in release workflow
nerdCopter Dec 9, 2025
47fa5c7
fix: add build info to release notes in GitHub release workflow
nerdCopter Dec 9, 2025
26778a1
refactor: extract version from Cargo.toml and git, not from binary
nerdCopter Dec 9, 2025
db57cc3
fix: align release notes date with binary output and prevent race con…
nerdCopter Dec 10, 2025
79ff3ac
feat: add status indicators throughout release workflow for better vi…
nerdCopter Dec 10, 2025
47b2e93
refactor: use prebuilt artifact for version verification instead of r…
nerdCopter Dec 10, 2025
bd9977e
ci,build: eliminate duplicate builds in release workflow
nerdCopter Dec 10, 2025
8cc806a
docs: add GitHub Actions & workflow design guidelines to AGENTS.md
nerdCopter Dec 10, 2025
8a09dca
docs: condense GitHub Actions guidelines in AGENTS.md
nerdCopter Dec 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 171 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
publish:
publish-crates:
name: Publish to crates.io
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -32,17 +32,177 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Verify version matches tag
- name: Run tests
run: |
cargo test --all-features
echo "✅ All tests passed"

- name: Publish to crates.io
run: |
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
echo "✅ Successfully published to crates.io"

build-release-assets:
name: Build Release Assets
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: bbl_parser-linux-x64
binary_path: target/release/bbl_parser
asset_name: bbl_parser-linux-x64
- os: windows-latest
artifact_name: bbl_parser-windows-x64
binary_path: target/release/bbl_parser.exe
asset_name: bbl_parser-windows-x64.exe
- os: macos-latest
artifact_name: bbl_parser-macos-x64
binary_path: target/release/bbl_parser
asset_name: bbl_parser-macos-x64

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run tests
run: |
cargo test --all-features --verbose
echo "✅ Tests passed on ${{ matrix.os }}"

- name: Build release binary
run: |
CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
TAG_VERSION=${GITHUB_REF#refs/tags/v}
if [[ "$CARGO_VERSION" != "$TAG_VERSION" ]]; then
echo "Version mismatch: Cargo.toml has $CARGO_VERSION, tag is v$TAG_VERSION"
cargo build --release
echo "✅ Built ${{ matrix.asset_name }}"

- name: Strip binary (Linux/macOS)
if: runner.os != 'Windows'
run: |
strip ${{ matrix.binary_path }}
echo "✅ Binary stripped"

- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.binary_path }}
overwrite: true
if-no-files-found: error

- name: Confirm artifact uploaded
run: echo "✅ ${{ matrix.asset_name }} artifact uploaded"

determine-version:
name: Extract Version Information
runs-on: ubuntu-latest
outputs:
build_info: ${{ steps.extract.outputs.build_info }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract version from Cargo.toml and git
id: extract
run: |
set -e

# Extract semver from Cargo.toml
SEMVER=$(grep '^version' Cargo.toml | head -1 | cut -d'"' -f2)

# Get git info from GitHub context
GIT_SHA="${{ github.sha }}"
GIT_SHA_SHORT="${GIT_SHA:0:7}"

# Get git commit date from repository (matches VERGEN_GIT_COMMIT_DATE in binary)
GIT_COMMIT_DATE=$(git log -1 --format=%ci "${{ github.sha }}" | cut -d' ' -f1)

# Format version string to match binary output
BUILD_INFO="${SEMVER} ${GIT_SHA_SHORT} (${GIT_COMMIT_DATE})"

echo "✅ Extracted version: $BUILD_INFO"

# Write output with proper quoting
echo "build_info<<EOF" >> $GITHUB_OUTPUT
echo "$BUILD_INFO" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build binary for version validation
run: cargo build --release

- name: Verify version consistency
env:
EXPECTED: ${{ steps.extract.outputs.build_info }}
run: |
set -e

BINARY_VERSION=$(./target/release/bbl_parser -V)
if [ "$BINARY_VERSION" = "$EXPECTED" ]; then
echo "✅ Version match confirmed: binary='$BINARY_VERSION'"
else
echo "❌ Version mismatch detected:"
echo " Binary output: '$BINARY_VERSION'"
echo " Expected: '$EXPECTED'"
exit 1
fi

- name: Run tests
run: cargo test --all-features
upload-release-assets:
name: Upload Assets to GitHub Release
needs: [build-release-assets, determine-version]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts

- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Upload release assets
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
BUILD_INFO="${{ needs.determine-version.outputs.build_info }}"

# Upload all artifacts for this release
gh release upload "${{ github.ref_name }}" release-artifacts/*/* \
--repo "$GH_REPO" \
--clobber

# Update release notes with build information
gh release edit "${{ github.ref_name }}" \
--notes "**Build Information:** $BUILD_INFO" \
--repo "$GH_REPO"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
echo "✅ Release notes updated with build information"
echo ""
echo "🎉 Release complete! Version $BUILD_INFO is now live."
15 changes: 6 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ use bbl_parser::types::{BBLHeader, DecodedFrame, FrameDefinition, FrameStats};
// Import ExportOptions from crate library
use bbl_parser::ExportOptions;

// Include vergen generated environment variables
const GIT_SHA: &str = env!("VERGEN_GIT_SHA", "unknown");
const GIT_COMMIT_DATE: &str = env!("VERGEN_GIT_COMMIT_DATE", "unknown");

// Build version string from git info
// Build version string with semver + git info
// Format: "0.9.0 14be1ee (2025-12-04)"
const VERSION_STR: &str = concat!(
env!("CARGO_PKG_VERSION"),
" ",
env!("VERGEN_GIT_SHA", "unknown"),
" (",
env!("VERGEN_GIT_COMMIT_DATE", "unknown"),
Expand Down Expand Up @@ -259,10 +258,8 @@ fn should_have_frame(frame_index: u32, sysconfig: &HashMap<String, i32>) -> bool
}

fn build_command() -> Command {
let about_text = format!(
"\n\nRead and parse BBL blackbox log files. Exports to CSV by default (optionally GPX/JSON).\n {} {} ({})",
env!("CARGO_PKG_NAME"), GIT_SHA, GIT_COMMIT_DATE
);
let about_text =
"Read and parse BBL blackbox log files. Exports to CSV by default (optionally GPX/JSON).";

Command::new(env!("CARGO_PKG_NAME"))
.version(VERSION_STR)
Expand Down