From 99897ec5909c128fd2d43d360c530d22cbf7c24b Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 31 Jan 2023 16:21:42 +0800 Subject: [PATCH 1/3] test(bootstrap): build sdist using maturin sdist --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 188915eac..97fc10a8f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -419,7 +419,6 @@ jobs: test-bootstrap: name: Test Bootstrap - if: github.event_name != 'pull_request' runs-on: ${{ matrix.os }} strategy: fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }} @@ -453,9 +452,8 @@ jobs: shell: bash run: | set -ex - pip install build - python3 -m build --wheel -o dist - pip install dist/maturin*.whl + cargo run sdist -o dist + pip install -v dist/maturin-*.tar.gz if: steps.changes.outputs.changed == 'true' - run: maturin --version if: steps.changes.outputs.changed == 'true' From b1e118dc83aaa1db1da7482401f0f8c132b3c84c Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 31 Jan 2023 16:27:44 +0800 Subject: [PATCH 2/3] Keep dev-dependencies in sdist when there are no path dependencies --- src/source_distribution.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/source_distribution.rs b/src/source_distribution.rs index 28acb6b7f..6ecb8639a 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -67,8 +67,10 @@ fn rewrite_cargo_toml( // ^^^^^^^^^^^^^ dep_name for dep_category in ["dependencies", "dev-dependencies", "build-dependencies"] { if let Some(table) = data.get_mut(dep_category).and_then(|x| x.as_table_mut()) { - if dep_category == "dev-dependencies" { - // Remove dev-dependencies since building from sdist doesn't need them + if dep_category == "dev-dependencies" && !known_path_deps.is_empty() { + // Remove dev-dependencies since building from sdist doesn't need them, + // Keep it when there are no path dependencies to support building from + // sdist with `--locked`/`--frozen`. data.remove(dep_category); rewritten = true; continue; From 61ff70e9e7a5952a2d86bbaf3d492a59691e8ca5 Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 31 Jan 2023 16:38:34 +0800 Subject: [PATCH 3/3] test(bootstrap): use sccache --- .github/workflows/test.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 97fc10a8f..2d905f223 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -420,6 +420,9 @@ jobs: test-bootstrap: name: Test Bootstrap runs-on: ${{ matrix.os }} + env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" strategy: fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }} matrix: @@ -439,11 +442,11 @@ jobs: - uses: dtolnay/rust-toolchain@beta if: steps.changes.outputs.changed == 'true' # Caching - - name: Cache cargo build + - name: Sccache Setup if: steps.changes.outputs.changed == 'true' - uses: Swatinem/rust-cache@v2 + uses: Xuanwo/sccache-action@c94e27bef21ab3fb4a5152c8a878c53262b4abb0 with: - shared-key: maturin-build + version: "v0.4.0-pre.6" - uses: actions/setup-python@v4 if: steps.changes.outputs.changed == 'true' with: