Files
dev/test-version-embedding.sh
T
James PeterandHanzo Dev 80bf3d50a9 feat: rebrand from openai/codex to just-every/coder
- Update GitHub Actions workflow for version handling
- Change command references from 'codex' to 'coder'
- Improve release script with better version validation
- Update browser mode UI displays
- Update repository references and branding

Co-authored-by: Hanzo Dev <[email protected]>
2025-08-12 22:51:50 +10:00

74 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Test script to verify that CARGO_PKG_VERSION gets set correctly
# This simulates what the GitHub Actions workflow does
set -euo pipefail
echo "๐Ÿงช Testing version embedding process..."
echo ""
# Save current state
ORIGINAL_VERSION=$(grep "^version = " codex-rs/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "Current version in Cargo.toml: $ORIGINAL_VERSION"
# Test version
TEST_VERSION="9.9.9-test"
echo "Test version to embed: $TEST_VERSION"
echo ""
# Change to codex-rs directory
cd codex-rs
# Update version (like the workflow does)
echo "๐Ÿ“ Updating version in Cargo.toml..."
sed -i.bak "s/^version = \".*\"/version = \"$TEST_VERSION\"/" Cargo.toml
# Verify the update
echo "Updated Cargo.toml:"
grep "^version = " Cargo.toml
echo ""
# Update Cargo.lock
echo "๐Ÿ”„ Updating Cargo.lock..."
cargo update --workspace
# Build a small test binary to check version embedding
echo "๐Ÿ”จ Building test binary to verify version embedding..."
cat > test-version/src/main.rs << 'EOF'
fn main() {
println!("CARGO_PKG_VERSION: {}", env!("CARGO_PKG_VERSION"));
}
EOF
# Create a minimal test crate if it doesn't exist
if [ ! -f test-version/Cargo.toml ]; then
mkdir -p test-version/src
cat > test-version/Cargo.toml << EOF
[package]
name = "test-version"
version = { workspace = true }
edition = "2024"
EOF
fi
# Build the test binary
cargo build --manifest-path test-version/Cargo.toml
# Run it to see the embedded version
echo ""
echo "โœ… Testing embedded version:"
./target/debug/test-version
# Clean up - restore original version
echo ""
echo "๐Ÿงน Restoring original version..."
sed -i.bak "s/^version = \".*\"/version = \"$ORIGINAL_VERSION\"/" Cargo.toml
cargo update --workspace
rm -rf test-version
echo ""
echo "โœ… Test complete!"
echo ""
echo "If the test showed 'CARGO_PKG_VERSION: $TEST_VERSION', then the version"
echo "embedding process is working correctly and will work in GitHub Actions."