Fix Rust version compatibility in Forgejo Actions workflows
- Add Rust version checking to ensure 1.84.1+ requirement is met - Force install latest nightly toolchain if version is too old - Consolidate Rust installation and environment setup in simple workflow - Fix PATH persistence between workflow steps - Add better error handling and version validation
This commit is contained in:
parent
ae634b196f
commit
df5a4bf585
2 changed files with 57 additions and 25 deletions
|
|
@ -46,18 +46,33 @@ jobs:
|
|||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
. ~/.cargo/env
|
||||
|
||||
# Set default toolchain for rustup and update to latest
|
||||
rustup default stable
|
||||
rustup update
|
||||
|
||||
# Install nightly toolchain for newer Cargo.lock compatibility
|
||||
# Install and use the latest nightly toolchain
|
||||
rustup toolchain install nightly
|
||||
rustup default nightly
|
||||
rustup update
|
||||
|
||||
# Verify Rust version
|
||||
# Verify we have a recent enough version
|
||||
rustc --version
|
||||
cargo --version
|
||||
|
||||
# Check if Rust version meets requirements (need 1.84.1+)
|
||||
RUST_VERSION=$(rustc --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -1)
|
||||
echo "Extracted Rust version: $RUST_VERSION"
|
||||
|
||||
# Verify minimum version requirement
|
||||
if [ "$(printf '%s\n' "1.84.1" "$RUST_VERSION" | sort -V | head -n1)" != "1.84.1" ]; then
|
||||
echo "❌ Rust version $RUST_VERSION is too old, need 1.84.1+"
|
||||
echo "Available toolchains:"
|
||||
rustup toolchain list
|
||||
echo "Installing latest nightly..."
|
||||
rustup toolchain install nightly --force
|
||||
rustup default nightly
|
||||
rustup update
|
||||
rustc --version
|
||||
else
|
||||
echo "✅ Rust version $RUST_VERSION meets requirement (1.84.1+)"
|
||||
fi
|
||||
|
||||
# Install additional build dependencies
|
||||
apt install -y libssl-dev libsystemd-dev
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue