docs: streamline README for clarity and accuracy #12
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 | ||
| on: | ||
| push: | ||
| branches: ["*"] | ||
| pull_request: | ||
| workflow_dispatch: | ||
| # Cancel in-progress runs when a new commit is pushed | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_BACKTRACE: 1 | ||
| # Minimum supported Rust version | ||
| MSRV: "1.75" | ||
| jobs: | ||
| # ========================================================================== | ||
| # Format check | ||
| # ========================================================================== | ||
| fmt: | ||
| name: Format | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt | ||
| - name: Check formatting | ||
| run: cargo fmt --all -- --check | ||
| # ========================================================================== | ||
| # Clippy lints | ||
| # ========================================================================== | ||
| clippy: | ||
| name: Clippy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy | ||
| - name: Cache cargo | ||
| uses: Swatinem/rust-cache@v2 | ||
| - name: Run Clippy | ||
| run: cargo clippy --all-targets --all-features -- -D warnings | ||
| # ========================================================================== | ||
| # Tests | ||
| # ========================================================================== | ||
| test: | ||
| name: Test (${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| - name: Cache cargo | ||
| uses: Swatinem/rust-cache@v2 | ||
| - name: Run tests | ||
| run: cargo test --all-features | ||
| - name: Run doc tests | ||
| run: cargo test --doc | ||
| # ========================================================================== | ||
| # MSRV check | ||
| # ========================================================================== | ||
| msrv: | ||
| name: MSRV (${{ env.MSRV }}) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust ${{ env.MSRV }} | ||
| uses: dtolnay/rust-toolchain@master | ||
| with: | ||
| toolchain: ${{ env.MSRV }} | ||
| - name: Cache cargo | ||
| uses: Swatinem/rust-cache@v2 | ||
| - name: Check MSRV | ||
| run: cargo check --all-features | ||
| # ========================================================================== | ||
| # Documentation | ||
| # ========================================================================== | ||
| docs: | ||
| name: Documentation | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| - name: Cache cargo | ||
| uses: Swatinem/rust-cache@v2 | ||
| - name: Build docs | ||
| run: cargo doc --no-deps --all-features | ||
| env: | ||
| RUSTDOCFLAGS: -D warnings | ||
| # ========================================================================== | ||
| # Build | ||
| # ========================================================================== | ||
| build: | ||
| name: Build (${{ matrix.target }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - target: x86_64-unknown-linux-gnu | ||
| os: ubuntu-latest | ||
| - target: x86_64-unknown-linux-musl | ||
| os: ubuntu-latest | ||
| - target: aarch64-unknown-linux-gnu | ||
| os: ubuntu-latest | ||
| - target: x86_64-apple-darwin | ||
| os: macos-latest | ||
| - target: aarch64-apple-darwin | ||
| os: macos-latest | ||
| - target: x86_64-pc-windows-msvc | ||
| os: windows-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: ${{ matrix.target }} | ||
| - name: Install cross-compilation tools | ||
| if: matrix.target == 'aarch64-unknown-linux-gnu' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gcc-aarch64-linux-gnu | ||
| - name: Install musl tools | ||
| if: matrix.target == 'x86_64-unknown-linux-musl' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y musl-tools | ||
| - name: Cache cargo | ||
| uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| key: ${{ matrix.target }} | ||
| - name: Build | ||
| run: cargo build --release --target ${{ matrix.target }} | ||
| env: | ||
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: apc-${{ matrix.target }} | ||
| path: | | ||
| target/${{ matrix.target }}/release/apc | ||
| target/${{ matrix.target }}/release/apc.exe | ||
| if-no-files-found: ignore | ||
| # ========================================================================== | ||
| # Security audit | ||
| # ========================================================================== | ||
| security: | ||
| name: Security Audit | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install cargo-audit | ||
| run: cargo install cargo-audit | ||
| - name: Run audit | ||
| run: cargo audit | ||
| # ========================================================================== | ||
| # Coverage | ||
| # ========================================================================== | ||
| coverage: | ||
| name: Coverage | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: llvm-tools-preview | ||
| - name: Install cargo-llvm-cov | ||
| uses: taiki-e/install-action@cargo-llvm-cov | ||
| - name: Cache cargo | ||
| uses: Swatinem/rust-cache@v2 | ||
| - name: Generate coverage | ||
| run: cargo llvm-cov --all-features --lcov --output-path lcov.info | ||
| - name: Upload to Codecov | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| files: lcov.info | ||
| fail_ci_if_error: false | ||
| # ========================================================================== | ||
| # All checks passed - THIS IS THE REQUIRED CHECK FOR BRANCH PROTECTION | ||
| # Set "CI Success" as a required status check in GitHub branch protection | ||
| # ========================================================================== | ||
| ci-success: | ||
| name: CI Success | ||
| needs: [fmt, clippy, test, msrv, docs, build, security, coverage] | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| steps: | ||
| - name: Check all jobs passed | ||
| run: | | ||
| if [[ "${{ needs.fmt.result }}" != "success" ]] || \ | ||
| [[ "${{ needs.clippy.result }}" != "success" ]] || \ | ||
| [[ "${{ needs.test.result }}" != "success" ]] || \ | ||
| [[ "${{ needs.msrv.result }}" != "success" ]] || \ | ||
| [[ "${{ needs.docs.result }}" != "success" ]] || \ | ||
| [[ "${{ needs.build.result }}" != "success" ]] || \ | ||
| [[ "${{ needs.security.result }}" != "success" ]] || \ | ||
| [[ "${{ needs.coverage.result }}" != "success" ]]; then | ||
| echo "One or more jobs failed" | ||
| exit 1 | ||
| fi | ||
| echo "All CI checks passed!" | ||