This directory contains GitHub Actions workflows for the Image Packaging System (IPS) project.
The rust.yml
workflow is the main CI pipeline for the IPS project. It uses the xtask build system to build, test, and validate the codebase.
The workflow consists of several jobs that run in sequence:
- Format: Checks that the code follows Rust formatting standards using
rustfmt
. - Clippy: Runs the Rust linter to check for common mistakes and enforce code quality.
- Build: Builds the project using the xtask build system.
- Test: Runs unit tests for all crates.
- End-to-End Tests: Builds the binaries for end-to-end tests and runs them.
- Documentation: Builds the Rust documentation for the project.
The workflow uses the xtask build system for most operations. Xtask is a Rust-based build system that allows us to write build scripts and automation tasks in Rust instead of shell scripts, making them more maintainable and cross-platform.
The following xtask commands are used in the workflow:
cargo run -p xtask -- build
: Builds the projectcargo run -p xtask -- build -r
: Builds the project in release modecargo run -p xtask -- test
: Runs unit testscargo run -p xtask -- build-e2e
: Builds binaries for end-to-end testscargo run -p xtask -- run-e2e
: Runs end-to-end tests
For more information about xtask, see the xtask README.
The workflow follows several best practices for GitHub Actions:
- Caching: Dependencies are cached to speed up builds.
- Matrix Strategy: The build and test jobs use a matrix strategy to allow testing on multiple platforms and Rust versions.
- Job Dependencies: Jobs are properly sequenced to ensure efficient execution.
- Artifact Uploads: Build artifacts and documentation are uploaded for later use.
- Error Handling: Warnings are treated as errors to maintain code quality.
- Manual Triggering: The workflow can be triggered manually using the workflow_dispatch event.
You can run the same checks locally using the following commands:
# Format check
cargo fmt --all -- --check
# Clippy
cargo clippy --all-targets --all-features -- -D warnings
# Build
cargo run -p xtask -- build
# Test
cargo run -p xtask -- test
# End-to-End Tests
cargo run -p xtask -- build-e2e
cargo run -p xtask -- run-e2e
# Documentation
cargo doc --no-deps
If you encounter issues with the workflow:
- Check that your code passes all checks locally.
- Ensure that the xtask crate is properly set up.
- Look at the workflow logs for specific error messages.
- For end-to-end test failures, try running the tests locally with more verbose output.