Fix Rust version compatibility in Forgejo Actions workflows
Some checks failed
Build deb-bootupd Artifacts / Build deb-bootupd Artifacts (push) Failing after 2m54s
Simple Build & Upload / build (push) Failing after 2m14s

- 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:
robojerk 2025-08-09 23:49:13 -07:00
parent ae634b196f
commit df5a4bf585
2 changed files with 57 additions and 25 deletions

View file

@ -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

View file

@ -16,36 +16,53 @@ jobs:
container:
image: ubuntu:latest
steps:
- name: Checkout code manually
- name: Checkout code and setup environment
run: |
apt update -y
apt install -y git curl
git clone https://git.raines.xyz/robojerk/deb-bootupd.git /tmp/deb-bootupd
cd /tmp/deb-bootupd
echo "Repository: $(git remote get-url origin)"
echo "Branch: $(git branch --show-current)"
echo "Commit: $(git rev-parse --short HEAD)"
- name: Install Rust and dependencies
run: |
cd /tmp/deb-bootupd
apt install -y git curl pkg-config libssl-dev libsystemd-dev build-essential
# Install Rust using rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. ~/.cargo/env
rustup default stable
rustup update
# Install nightly for Cargo.lock compatibility
# Install and use the latest nightly toolchain
rustup toolchain install nightly
rustup default nightly
rustup update
# Install system dependencies
apt install -y pkg-config libssl-dev libsystemd-dev build-essential
# Clone repository
git clone https://git.raines.xyz/robojerk/deb-bootupd.git /tmp/deb-bootupd
cd /tmp/deb-bootupd
# Verify Rust
rustc --version
cargo --version
echo "Repository: $(git remote get-url origin)"
echo "Branch: $(git branch --show-current)"
echo "Commit: $(git rev-parse --short HEAD)"
# Verify Rust and check version requirements
echo "Rust version: $(rustc --version)"
echo "Cargo 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
# Set PATH for subsequent steps
echo "export PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
echo "export CARGO_HOME=$HOME/.cargo" >> $GITHUB_ENV
- name: Build project
run: |