fix: Update Cargo.lock version to match Cargo.toml (2.6.0) #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| # ============================================================================ | |
| # Code Quality and Testing | |
| # ============================================================================ | |
| test: | |
| name: Test and Quality Checks | |
| runs-on: ubuntu-latest | |
| container: | |
| image: rust:1.90-bullseye | |
| options: --user root | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system dependencies | |
| run: | | |
| apt-get update && apt-get install -y \ | |
| build-essential \ | |
| pkg-config \ | |
| libudev-dev \ | |
| libssl-dev \ | |
| ca-certificates \ | |
| curl | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup component add clippy rustfmt | |
| rustup show | |
| - name: Check code formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run Clippy lints | |
| run: cargo clippy --all-targets --all-features -- -D warnings -A dead_code | |
| - name: Run tests | |
| run: cargo test --verbose --all-features | |
| - name: Run integration tests | |
| run: cargo test --test integration_tests --verbose | |
| - name: Check documentation | |
| run: cargo doc --no-deps --document-private-items | |
| # ============================================================================ | |
| # Security Audit | |
| # ============================================================================ | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| container: | |
| image: rust:1.90-bullseye | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check for known vulnerabilities in dependencies | |
| run: | | |
| echo "Checking for known vulnerable dependencies..." | |
| # Simple check for known problematic crates | |
| if grep -r "openssl.*0\." Cargo.toml; then | |
| echo "Warning: Old OpenSSL version detected" | |
| fi | |
| # Check for outdated critical dependencies | |
| cargo tree --depth 1 | grep -E "(openssl|ring|rustls)" || echo "No critical security crates found" | |
| echo "Security check completed - manual audit recommended for production" | |
| # ============================================================================ | |
| # Build Matrix - Multiple Targets | |
| # ============================================================================ | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: ubuntu-latest | |
| needs: [test, security] | |
| container: | |
| image: rust:1.90-bullseye | |
| options: --user root | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - aarch64-unknown-linux-gnu | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| artifact_name: eink-power-cli-linux-x64 | |
| - target: aarch64-unknown-linux-gnu | |
| artifact_name: eink-power-cli-linux-arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| apt-get update && apt-get install -y \ | |
| build-essential \ | |
| pkg-config \ | |
| libudev-dev \ | |
| libssl-dev \ | |
| gcc-aarch64-linux-gnu \ | |
| libc6-dev-arm64-cross | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-${{ matrix.target }}- | |
| ${{ runner.os }}-cargo- | |
| - name: Install Rust target | |
| run: | | |
| rustup target add ${{ matrix.target }} | |
| rustup show | |
| - name: Configure cross-compilation environment | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
| echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
| echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar" >> $GITHUB_ENV | |
| echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
| - name: Build release binary | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} --verbose | |
| - name: Strip binary | |
| run: | | |
| if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then | |
| aarch64-linux-gnu-strip target/${{ matrix.target }}/release/eink-power-cli | |
| else | |
| strip target/${{ matrix.target }}/release/eink-power-cli | |
| fi | |
| - name: Create artifact directory | |
| run: | | |
| mkdir -p artifacts | |
| cp target/${{ matrix.target }}/release/eink-power-cli artifacts/${{ matrix.artifact_name }} | |
| # Create build info | |
| cat > artifacts/build-info-${{ matrix.target }}.txt << EOF | |
| Build Information | |
| ================= | |
| Target: ${{ matrix.target }} | |
| Commit: ${{ github.sha }} | |
| Branch: ${{ github.ref_name }} | |
| Build Date: $(date -u '+%Y-%m-%d %H:%M:%S UTC') | |
| Rust Version: $(rustc --version) | |
| Cargo Version: $(cargo --version) | |
| EOF | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: | | |
| artifacts/${{ matrix.artifact_name }} | |
| artifacts/build-info-${{ matrix.target }}.txt | |
| retention-days: 30 | |
| - name: Generate checksums | |
| run: | | |
| cd artifacts | |
| sha256sum ${{ matrix.artifact_name }} > ${{ matrix.artifact_name }}.sha256 | |
| md5sum ${{ matrix.artifact_name }} > ${{ matrix.artifact_name }}.md5 | |
| - name: Upload checksums | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }}-checksums | |
| path: | | |
| artifacts/${{ matrix.artifact_name }}.sha256 | |
| artifacts/${{ matrix.artifact_name }}.md5 | |
| retention-days: 30 | |
| # ============================================================================ | |
| # Create Release (on tags) | |
| # ============================================================================ | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release-assets | |
| # Copy all binaries and checksums | |
| find artifacts -name "eink-power-cli-*" -type f | while read file; do | |
| cp "$file" release-assets/ | |
| done | |
| # Create combined checksums file | |
| cat artifacts/*/*.sha256 > release-assets/SHA256SUMS | |
| cat artifacts/*/*.md5 > release-assets/MD5SUMS | |
| # Create release notes | |
| cat > release-assets/RELEASE_NOTES.md << EOF | |
| # E-ink Power CLI ${{ github.ref_name }} | |
| ## Build Information | |
| - **Commit**: ${{ github.sha }} | |
| - **Build Date**: $(date -u '+%Y-%m-%d %H:%M:%S UTC') | |
| - **Rust Version**: 1.81 | |
| ## Supported Platforms | |
| - **Linux x86_64**: \`eink-power-cli-linux-x64\` | |
| - **Linux ARM64**: \`eink-power-cli-linux-arm64\` | |
| ## Installation | |
| 1. Download the appropriate binary for your platform | |
| 2. Make it executable: \`chmod +x eink-power-cli-*\` | |
| 3. Move to your PATH: \`sudo mv eink-power-cli-* /usr/local/bin/eink-power-cli\` | |
| ## Verification | |
| Verify the download integrity using the provided checksums: | |
| \`\`\`bash | |
| sha256sum -c SHA256SUMS | |
| \`\`\` | |
| ## Target Hardware | |
| - **Board**: i.MX93 Jaguar E-ink | |
| - **Controller**: MCXC143VFM power management controller | |
| - **Interface**: Serial UART (/dev/ttyUSB0 at 115200 baud) | |
| EOF | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: release-assets/* | |
| body_path: release-assets/RELEASE_NOTES.md | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ============================================================================ | |
| # Build Status Summary | |
| # ============================================================================ | |
| build-summary: | |
| name: Build Summary | |
| runs-on: ubuntu-latest | |
| needs: [test, security, build] | |
| if: always() | |
| steps: | |
| - name: Build Summary | |
| run: | | |
| echo "## Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Tests & Quality | ${{ needs.test.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Security Audit | ${{ needs.security.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Build Matrix | ${{ needs.build.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ needs.test.result }}" = "success" ] && [ "${{ needs.security.result }}" = "success" ] && [ "${{ needs.build.result }}" = "success" ]; then | |
| echo "✅ All builds completed successfully!" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "❌ Some builds failed. Check the individual job logs for details." >> $GITHUB_STEP_SUMMARY | |
| fi |