diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 710db5ecf..e4e5bd78a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -224,7 +224,7 @@ jobs: with: rust-version: stable target: ${{ matrix.target }} - cache-shared-key: build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + cache-shared-key: build-${{ matrix.target }} github-token: ${{ secrets.GITHUB_TOKEN }} cache-save-if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }} install-cross-tools: ${{ matrix.cross }} @@ -260,14 +260,8 @@ jobs: touch rustfs/build.rs if [[ "${{ matrix.cross }}" == "true" ]]; then - if [[ "${{ matrix.platform }}" == "windows" ]]; then - # Use cross for Windows ARM64 - cargo install cross --git https://github.com/cross-rs/cross - cross build --release --target ${{ matrix.target }} -p rustfs --bins - else - # Use zigbuild for other cross-compilation - cargo zigbuild --release --target ${{ matrix.target }} -p rustfs --bins - fi + # All cross targets in the matrix are Linux; zigbuild handles them. + cargo zigbuild --release --target ${{ matrix.target }} -p rustfs --bins else cargo build --release --target ${{ matrix.target }} -p rustfs --bins fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e48d72a17..555728228 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,6 @@ concurrency: env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 - CARGO_BUILD_JOBS: 2 jobs: @@ -102,6 +101,38 @@ jobs: - name: Typos check with custom config file uses: crate-ci/typos@37bb98842b0d8c4ffebdb75301a13db0267cef89 # master + # Fast, compile-free checks that fail early so contributors get feedback in + # ~1 minute instead of waiting for the full test job. + quick-checks: + name: Quick Checks + needs: skip-check + if: needs.skip-check.outputs.should_skip != 'true' + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 + + - name: Install ripgrep + run: sudo apt-get update && sudo apt-get install -y ripgrep + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + with: + components: rustfmt + + - name: Check code formatting + run: cargo fmt --all --check + + - name: Check unsafe code allowances + run: ./scripts/check_unsafe_code_allowances.sh + + - name: Check layered dependencies + run: ./scripts/check_layer_dependencies.sh + + - name: Check architecture migration rules + run: ./scripts/check_architecture_migration_rules.sh + test-and-lint: name: Test and Lint needs: skip-check @@ -118,7 +149,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-test-${{ hashFiles('**/Cargo.lock') }} + cache-shared-key: ci-test github-token: ${{ secrets.GITHUB_TOKEN }} cache-save-if: ${{ github.ref == 'refs/heads/main' }} @@ -127,29 +158,17 @@ jobs: cargo nextest run --all --exclude e2e_test cargo test --all --doc + # Explicit gate for migration-critical suites. These tests already ran in + # the full nextest pass above; a single filtered nextest invocation keeps + # the named gate without rebuilding or re-running them one package at a time. - name: Run rebalance/decommission migration proofs run: | - cargo test -p rustfs-ecstore data_movement --lib - cargo test -p rustfs-ecstore rebalance --lib - cargo test -p rustfs-ecstore decommission --lib - cargo test -p rustfs-ecstore source_cleanup --lib - cargo test -p rustfs-ecstore delete_marker --lib - - - name: Check code formatting - run: cargo fmt --all --check - - - name: Check unsafe code allowances - run: ./scripts/check_unsafe_code_allowances.sh + cargo nextest run -p rustfs-ecstore --lib \ + -E 'test(data_movement) or test(rebalance) or test(decommission) or test(source_cleanup) or test(delete_marker)' - name: Run clippy lints run: cargo clippy --all-targets -- -D warnings - - name: Check layered dependencies - run: ./scripts/check_layer_dependencies.sh - - - name: Check architecture migration rules - run: ./scripts/check_architecture_migration_rules.sh - test-and-lint-rio-v2: name: Test and Lint (rio-v2) needs: skip-check @@ -166,7 +185,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-test-rio-v2-${{ hashFiles('**/Cargo.lock') }} + cache-shared-key: ci-test-rio-v2 github-token: ${{ secrets.GITHUB_TOKEN }} cache-save-if: ${{ github.ref == 'refs/heads/main' }} @@ -202,7 +221,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-test-${{ matrix.features.name }}-${{ hashFiles('**/Cargo.lock') }} + cache-shared-key: ci-test-${{ matrix.features.name }} github-token: ${{ secrets.GITHUB_TOKEN }} cache-save-if: ${{ github.ref == 'refs/heads/main' }} @@ -230,14 +249,12 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-rustfs-debug-binary-${{ hashFiles('**/Cargo.lock') }} + cache-shared-key: ci-rustfs-debug-binary cache-save-if: ${{ github.ref == 'refs/heads/main' }} github-token: ${{ secrets.GITHUB_TOKEN }} - name: Build debug binary - run: | - touch rustfs/build.rs - cargo build -p rustfs --bins --jobs 2 + run: cargo build -p rustfs --bins - name: Upload debug binary uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 @@ -263,14 +280,12 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-rustfs-debug-binary-rio-v2-${{ hashFiles('**/Cargo.lock') }} + cache-shared-key: ci-rustfs-debug-binary-rio-v2 cache-save-if: ${{ github.ref == 'refs/heads/main' }} github-token: ${{ secrets.GITHUB_TOKEN }} - name: Build debug binary with rio-v2 - run: | - touch rustfs/build.rs - cargo build -p rustfs --bins --features rio-v2 --jobs 2 + run: cargo build -p rustfs --bins --features rio-v2 - name: Upload debug binary uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 @@ -290,6 +305,19 @@ jobs: - name: Checkout repository uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 + # Full setup with dependency caching: the migration-proof step below + # compiles the e2e_test crate, which pulls in most of the workspace. + # Without a restored cache this was a cold multi-GB build on every run. + - name: Setup Rust environment + uses: ./.github/actions/setup + with: + rust-version: stable + cache-shared-key: ci-e2e + github-token: ${{ secrets.GITHUB_TOKEN }} + cache-save-if: ${{ github.ref == 'refs/heads/main' }} + + # Download after the cache restore so the freshly built binary from the + # build job always wins over anything restored into target/debug. - name: Download debug binary uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7 with: @@ -299,9 +327,6 @@ jobs: - name: Make binary executable run: chmod +x ./target/debug/rustfs - - name: Setup Rust toolchain for s3s-e2e installation - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - - name: Run delete-marker migration proof run: cargo test -p e2e_test delete_marker_migration_semantics -- --nocapture --test-threads=1 diff --git a/Cargo.toml b/Cargo.toml index e3de0dd8a..a22abfc57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -341,6 +341,13 @@ insta = { version = "1.48", features = ["yaml", "json"] } [workspace.metadata.cargo-shear] ignored = ["rustfs"] +[profile.dev] +# Full debuginfo roughly doubles compile+link time and produces multi-GB +# target dirs (slow CI cache save/restore, slow artifact upload). Line tables +# keep meaningful backtraces. For local debugging with full debuginfo, run: +# CARGO_PROFILE_DEV_DEBUG=full cargo build +debug = "line-tables-only" + [profile.release] opt-level = 3