deb-bootupd/.forgejo/workflows/simple-build.yml
Workflow config file is invalid. Please check your config file: yaml: line 16: mapping values are not allowed in this context
robojerk cfdf091bdd Switch workflows to Debian 13 (Trixie) containers
- Change from Ubuntu to Debian 13 containers for both workflows
- Update environment variables from UBUNTU_VERSION to DEBIAN_VERSION
- Add explanatory comments about using Debian for Debian-focused project
- Update build info files to reflect Debian version instead of Ubuntu
- Maintain all Rust toolchain and build logic improvements
2025-08-09 23:56:18 -07:00

119 lines
3.9 KiB
YAML

name: Simple Build & Upload
# Simple workflow for building deb-bootupd and uploading artifacts
# Based on patterns from: https://domaindrivenarchitecture.org/pages/dda-pallet/
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
# Use Debian 13 (Trixie) since this is a Debian-focused project
image: debian:13
steps:
- name: Checkout code and setup environment
run: |
apt update -y
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
# Install and use the latest nightly toolchain
rustup toolchain install nightly
rustup default nightly
rustup update
# Clone repository
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)"
# 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: |
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/
cp Cargo.toml artifacts/
# 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: /tmp/deb-bootupd/artifacts/
if-no-files-found: error
retention-days: 30