ci: bump checkout v4→v6, cache v4→v5 #8
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: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| fmt: | |
| name: cargo fmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install rustfmt | |
| run: rustup component add rustfmt | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| clippy: | |
| name: cargo clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install x86_64 musl target | |
| run: rustup target add x86_64-unknown-linux-musl | |
| - name: Install clippy | |
| run: rustup component add clippy | |
| - name: Cache cargo registry | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: clippy-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --release --target x86_64-unknown-linux-musl -- -D warnings | |
| test: | |
| name: cargo test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install musl tools | |
| run: sudo apt-get update && sudo apt-get install -y musl-tools | |
| - name: Install x86_64 musl target | |
| run: rustup target add x86_64-unknown-linux-musl | |
| - name: Cache cargo registry | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: test-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} | |
| - name: Run tests (native x86_64-linux-gnu — runner can execute these) | |
| run: cargo test --release | |
| build-musl: | |
| name: cargo build (${{ matrix.target }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-musl | |
| - aarch64-unknown-linux-musl | |
| - armv7-unknown-linux-musleabihf | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install target | |
| env: | |
| RUST_TARGET: ${{ matrix.target }} | |
| run: rustup target add "$RUST_TARGET" | |
| - name: Cache cargo registry | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: build-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} | |
| - name: Build release | |
| env: | |
| RUST_TARGET: ${{ matrix.target }} | |
| run: cargo build --release --target "$RUST_TARGET" | |
| - name: Report binary size | |
| env: | |
| RUST_TARGET: ${{ matrix.target }} | |
| run: ls -la "target/$RUST_TARGET/release/copyfail" |