Fix Forgejo Actions workflows for Cargo.lock compatibility
- Fix Cargo.lock version 4 compatibility by using nightly Rust toolchain - Replace actions/checkout with manual git clone to avoid Node.js dependency - Update simple-build.yml to use Ubuntu container and manual checkout - Add Cargo.lock regeneration logic for version compatibility - Ensure both workflows can handle modern Rust lock file versions
This commit is contained in:
parent
95c23891b6
commit
ae634b196f
2 changed files with 73 additions and 8 deletions
|
|
@ -46,8 +46,13 @@ jobs:
|
|||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
. ~/.cargo/env
|
||||
|
||||
# Set default toolchain for rustup
|
||||
# Set default toolchain for rustup and update to latest
|
||||
rustup default stable
|
||||
rustup update
|
||||
|
||||
# Install nightly toolchain for newer Cargo.lock compatibility
|
||||
rustup toolchain install nightly
|
||||
rustup default nightly
|
||||
|
||||
# Verify Rust version
|
||||
rustc --version
|
||||
|
|
@ -80,6 +85,19 @@ jobs:
|
|||
echo "Cargo.toml contents:"
|
||||
cat Cargo.toml
|
||||
|
||||
# Check Cargo.lock version and regenerate if needed
|
||||
echo "Cargo.lock version:"
|
||||
head -n 1 Cargo.lock
|
||||
|
||||
# If Cargo.lock version is too new, regenerate it
|
||||
if grep -q "version = 4" Cargo.lock; then
|
||||
echo "Cargo.lock version 4 detected, regenerating with nightly toolchain..."
|
||||
rm Cargo.lock
|
||||
cargo generate-lockfile
|
||||
echo "New Cargo.lock generated:"
|
||||
head -n 1 Cargo.lock
|
||||
fi
|
||||
|
||||
# Build in release mode
|
||||
echo "Building deb-bootupd in release mode..."
|
||||
cargo build --release
|
||||
|
|
|
|||
|
|
@ -14,29 +14,72 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: rust:1.75-slim
|
||||
image: ubuntu:latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://data.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Checkout code manually
|
||||
run: |
|
||||
apt update -y
|
||||
apt install -y pkg-config libssl-dev libsystemd-dev
|
||||
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
|
||||
|
||||
# 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
|
||||
rustup toolchain install nightly
|
||||
rustup default nightly
|
||||
|
||||
# Install system dependencies
|
||||
apt install -y pkg-config libssl-dev libsystemd-dev build-essential
|
||||
|
||||
# Verify Rust
|
||||
rustc --version
|
||||
cargo --version
|
||||
|
||||
- name: Build project
|
||||
run: |
|
||||
cd /tmp/deb-bootupd
|
||||
|
||||
echo "Building deb-bootupd in release mode..."
|
||||
cargo build --release
|
||||
|
||||
echo "Build artifacts:"
|
||||
ls -la target/release/
|
||||
|
||||
# Show binary info
|
||||
if [ -f target/release/bootupd ]; then
|
||||
echo "bootupd binary info:"
|
||||
file target/release/bootupd
|
||||
fi
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd /tmp/deb-bootupd
|
||||
|
||||
echo "Running tests..."
|
||||
cargo test --release
|
||||
|
||||
echo "Running clippy..."
|
||||
cargo clippy --release
|
||||
|
||||
echo "Checking formatting..."
|
||||
cargo fmt --check
|
||||
|
||||
- name: Create artifacts
|
||||
run: |
|
||||
cd /tmp/deb-bootupd
|
||||
|
||||
mkdir -p artifacts
|
||||
cp target/release/bootupd artifacts/
|
||||
cp -r src/ artifacts/
|
||||
|
|
@ -44,11 +87,15 @@ jobs:
|
|||
|
||||
# Create build info
|
||||
echo "Build: $(date) - $(git rev-parse --short HEAD)" > artifacts/build-info.txt
|
||||
echo "Rust Version: $(rustc --version)" >> artifacts/build-info.txt
|
||||
|
||||
echo "Artifacts created:"
|
||||
ls -la artifacts/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: https://data.forgejo.org/actions/upload-artifact@v3
|
||||
with:
|
||||
name: deb-bootupd-build
|
||||
path: artifacts/
|
||||
path: /tmp/deb-bootupd/artifacts/
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue