Fix Rust SIGSEGV: switch to stable image, add compilation safeguards and toolchain verification

This commit is contained in:
robojerk 2025-08-10 08:45:58 -07:00
parent 8158c6d85b
commit 4524cddff7
2 changed files with 111 additions and 23 deletions

View file

@ -23,12 +23,14 @@ jobs:
# Use actual IP if available, fallback to hostname
FORGEJO_IP: ${{ secrets.FORGEJO_IP || '' }}
container:
image: 'rust:1.89-slim-trixie'
image: 'rust:1.89'
options: |
--dns=8.8.8.8
--dns=8.8.4.4
--add-host=git.raines.xyz:host-gateway
--add-host=forgejo:host-gateway
--memory=4g
--memory-swap=4g
steps:
- name: Checkout code and setup environment
run: |
@ -95,6 +97,34 @@ jobs:
rustc --version
cargo --version
# Verify Rust toolchain health
echo "=== RUST TOOLCHAIN VERIFICATION ==="
echo "Testing rustc compilation..."
echo 'fn main() { println!("Hello, Rust!"); }' > /tmp/test.rs
rustc /tmp/test.rs -o /tmp/test || {
echo "❌ Rust compiler test failed - toolchain may be corrupted"
exit 1
}
/tmp/test || {
echo "❌ Rust binary execution test failed"
exit 1
}
echo "✅ Rust toolchain verification passed"
# Test cargo operations
echo "Testing cargo operations..."
cargo new /tmp/test-project --bin || {
echo "❌ Cargo project creation failed"
exit 1
}
cd /tmp/test-project
cargo check || {
echo "❌ Cargo check failed"
exit 1
}
echo "✅ Cargo operations test passed"
cd /tmp/deb-bootupd
# Clone repository
git clone https://git.raines.xyz/robojerk/deb-bootupd.git /tmp/deb-bootupd
cd /tmp/deb-bootupd
@ -124,34 +154,39 @@ jobs:
run: |
cd /tmp/deb-bootupd
# Show project structure
echo "Project structure:"
ls -la
# Set Rust compilation safeguards
export RUSTFLAGS="-C target-cpu=native -C target-feature=+crt-static"
export CARGO_INCREMENTAL=0
export CARGO_NET_RETRY=3
# Check Cargo.toml
echo "Cargo.toml contents:"
cat Cargo.toml
# Set memory limits for compilation
ulimit -v 3145728 # 3GB virtual memory limit
# Check Cargo.lock version
echo "Cargo.lock version:"
head -n 1 Cargo.lock
# Rust 1.89.0 should handle any Cargo.lock version without issues
echo "Using Rust 1.89.0 - should handle all Cargo.lock versions"
# Build in release mode
echo "Building deb-bootupd in release mode..."
cargo build --release
echo "Rust flags: $RUSTFLAGS"
echo "Memory limit: $(ulimit -v) KB"
# Try building with increased verbosity
RUST_BACKTRACE=1 cargo build --release --verbose || {
echo "❌ Build failed, trying with debug mode..."
RUST_BACKTRACE=1 cargo build --debug --verbose || {
echo "❌ Debug build also failed, checking Rust installation..."
rustc --version --verbose
cargo --version --verbose
exit 1
}
}
# Verify binaries were created
echo "Build artifacts:"
ls -la target/release/
ls -la target/release/ || ls -la target/debug/
# Show binary information
# Show binary info
if [ -f target/release/bootupd ]; then
echo "bootupd binary info:"
file target/release/bootupd
ldd target/release/bootupd || echo "Static binary or no dynamic dependencies"
elif [ -f target/debug/bootupd ]; then
echo "bootupd binary info (debug):"
file target/debug/bootupd
fi
- name: Run tests

View file

@ -19,12 +19,14 @@ jobs:
# Use actual IP if available, fallback to hostname
FORGEJO_IP: ${{ secrets.FORGEJO_IP || '' }}
container:
image: 'rust:1.89-slim-trixie'
image: 'rust:1.89'
options: |
--dns=8.8.8.8
--dns=8.8.4.4
--add-host=git.raines.xyz:host-gateway
--add-host=forgejo:host-gateway
--memory=4g
--memory-swap=4g
steps:
- name: Checkout code and setup environment
run: |
@ -91,6 +93,34 @@ jobs:
rustc --version
cargo --version
# Verify Rust toolchain health
echo "=== RUST TOOLCHAIN VERIFICATION ==="
echo "Testing rustc compilation..."
echo 'fn main() { println!("Hello, Rust!"); }' > /tmp/test.rs
rustc /tmp/test.rs -o /tmp/test || {
echo "❌ Rust compiler test failed - toolchain may be corrupted"
exit 1
}
/tmp/test || {
echo "❌ Rust binary execution test failed"
exit 1
}
echo "✅ Rust toolchain verification passed"
# Test cargo operations
echo "Testing cargo operations..."
cargo new /tmp/test-project --bin || {
echo "❌ Cargo project creation failed"
exit 1
}
cd /tmp/test-project
cargo check || {
echo "❌ Cargo check failed"
exit 1
}
echo "✅ Cargo operations test passed"
cd /tmp/deb-bootupd
# Clone repository
git clone https://git.raines.xyz/robojerk/deb-bootupd.git /tmp/deb-bootupd
cd /tmp/deb-bootupd
@ -120,16 +150,39 @@ jobs:
run: |
cd /tmp/deb-bootupd
# Set Rust compilation safeguards
export RUSTFLAGS="-C target-cpu=native -C target-feature=+crt-static"
export CARGO_INCREMENTAL=0
export CARGO_NET_RETRY=3
# Set memory limits for compilation
ulimit -v 3145728 # 3GB virtual memory limit
echo "Building deb-bootupd in release mode..."
cargo build --release
echo "Rust flags: $RUSTFLAGS"
echo "Memory limit: $(ulimit -v) KB"
# Try building with increased verbosity
RUST_BACKTRACE=1 cargo build --release --verbose || {
echo "❌ Build failed, trying with debug mode..."
RUST_BACKTRACE=1 cargo build --debug --verbose || {
echo "❌ Debug build also failed, checking Rust installation..."
rustc --version --verbose
cargo --version --verbose
exit 1
}
}
echo "Build artifacts:"
ls -la target/release/
ls -la target/release/ || ls -la target/debug/
# Show binary info
if [ -f target/release/bootupd ]; then
echo "bootupd binary info:"
file target/release/bootupd
elif [ -f target/debug/bootupd ]; then
echo "bootupd binary info (debug):"
file target/debug/bootupd
fi
- name: Run tests