# Define the sequence of steps for the CI pipeline steps: # Step 1: Run tests and checks (formatting, clippy, build, test) test-and-check: image: ubuntu:latest commands: # Install dependencies - apt-get update && apt-get install -y curl git # Install Rust toolchain - curl https://sh.rustup.rs -sSf | sh -s -- -y # Source the cargo environment to make rustup/cargo available - source "$HOME/.cargo/env" # Run formatting check - cargo fmt --all -- --check # Run clippy linter with warnings as errors - cargo clippy --jobs 2 -- -D warnings # Build the project in release mode - cargo build --verbose --release --jobs 2 # Run tests - cargo test --verbose --jobs 2 when: branch: main event: [ push, pull_request ] # Step 2: Build for x86_64 architecture build-x86_64: image: ubuntu:latest commands: # Install dependencies - apt-get update && apt-get install -y curl git # Install Rust toolchain - curl https://sh.rustup.rs -sSf | sh -s -- -y # Source the cargo environment - source "$HOME/.cargo/env" # Add the x86_64 target - rustup target add x86_64-unknown-linux-gnu # Build for x86_64 target - cargo build --target x86_64-unknown-linux-gnu --release --verbose --jobs 2 when: branch: main event: [ push, pull_request ] # Step 3: Build for aarch64 architecture build-aarch64: image: ubuntu:latest commands: # Install dependencies including aarch64 cross-compiler - apt-get update && apt-get install -y curl git gcc-aarch64-linux-gnu # Install Rust toolchain - curl https://sh.rustup.rs -sSf | sh -s -- -y # Source the cargo environment - source "$HOME/.cargo/env" # Add the aarch64 target - rustup target add aarch64-unknown-linux-gnu # Configure the linker for aarch64 target in Cargo config - echo '[target.aarch64-unknown-linux-gnu]' >> "$HOME/.cargo/config.toml" - echo 'linker = "aarch64-linux-gnu-gcc"' >> "$HOME/.cargo/config.toml" # Build for aarch64 target - cargo build --target aarch64-unknown-linux-gnu --release --verbose --jobs 2 when: branch: main event: [ push, pull_request ]