From ebe6b907d457a955f01ff1e1de2f314c9185500a Mon Sep 17 00:00:00 2001 From: Jiangzhou He Date: Wed, 15 Oct 2025 15:58:17 -0700 Subject: [PATCH 1/3] workflow: make build/test faster and consume less space --- .github/workflows/_docs_release.yml | 2 ++ .github/workflows/_test.yml | 27 +++++++++++++++------------ .github/workflows/docs_test.yml | 2 ++ .github/workflows/format.yml | 4 ++++ .github/workflows/release.yml | 10 ++++++++++ Cargo.toml | 1 + 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_docs_release.yml b/.github/workflows/_docs_release.yml index 5d7e26412..7e91543a6 100644 --- a/.github/workflows/_docs_release.yml +++ b/.github/workflows/_docs_release.yml @@ -13,6 +13,8 @@ jobs: environment: docs-release steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: actions/setup-node@v4 with: cache: yarn diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 7c745fe7f..f9dae71a3 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -21,8 +21,19 @@ jobs: - { runner: macos-13, python_exec: ".venv/bin/python" } - { runner: windows-latest, python_exec: ".venv\\Scripts\\python" } runs-on: ${{ matrix.platform.runner }} + env: + RUSTFLAGS: "-C debuginfo=0 -C split-debuginfo=off" + CARGO_INCREMENTAL: "0" + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.9 - uses: actions/setup-python@v5 id: setup_python @@ -31,23 +42,13 @@ jobs: cache: 'pip' - run: rustup toolchain install stable --profile minimal - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - key: rust-${{ matrix.platform.runner }}-${{ matrix.python-version }} + - name: Rust tests (no default features) run: cargo test --no-default-features --verbose - name: Rust tests run: cargo test --verbose - - uses: actions/cache@v4 - with: - path: .venv - key: pyenv-${{ matrix.platform.runner }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }} - restore-keys: | - pyenv-${{ matrix.platform.runner }}-${{ steps.setup_python.outputs.python-version }}- - - name: Setup venv run: | python -m venv .venv @@ -56,7 +57,7 @@ jobs: ${{ matrix.platform.python_exec }} -m pip install maturin mypy pytest pytest-asyncio - name: Python build run: | - ${{ matrix.platform.python_exec }} -m maturin develop -E all + ${{ matrix.platform.python_exec }} -m maturin develop --strip -E all - name: Python type check (mypy) run: | ${{ matrix.platform.python_exec }} -m mypy python @@ -68,6 +69,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - uses: taiki-e/install-action@v2 diff --git a/.github/workflows/docs_test.yml b/.github/workflows/docs_test.yml index 3f3fe9dbf..b1acc551f 100644 --- a/.github/workflows/docs_test.yml +++ b/.github/workflows/docs_test.yml @@ -15,6 +15,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: actions/setup-node@v4 with: cache: yarn diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 8e40d0177..c0e388eb1 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -29,6 +29,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: dtolnay/rust-toolchain@stable with: components: rustfmt @@ -41,6 +43,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: actions/setup-python@v5 with: python-version: 3.11 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8748aca89..f91d9d1e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - run: ./.github/scripts/update_version.sh - uses: actions/upload-artifact@v4 with: @@ -30,6 +32,8 @@ jobs: needs: [create-versioned-toml] steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: actions/download-artifact@v4 with: name: Cargo.toml @@ -61,6 +65,8 @@ jobs: - { os: windows, runner: windows-latest, target: x64 } steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: actions/download-artifact@v4 with: name: Cargo.toml @@ -107,6 +113,8 @@ jobs: needs: [create-versioned-toml, generate-3p-notices] steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: actions/download-artifact@v4 with: name: Cargo.toml @@ -138,6 +146,8 @@ jobs: environment: release steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: actions/download-artifact@v4 with: name: Cargo.toml diff --git a/Cargo.toml b/Cargo.toml index 684a8e8e9..98866836b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ license = "Apache-2.0" [profile.release] codegen-units = 1 +strip = "symbols" lto = true [lib] From c4b07f3757e60e9589322924673e341752976dce Mon Sep 17 00:00:00 2001 From: Jiangzhou He Date: Wed, 15 Oct 2025 16:07:09 -0700 Subject: [PATCH 2/3] fix: only provide `-C split-debuginfo=off` for macOS --- .github/workflows/_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index f9dae71a3..ce2bbf2b3 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -17,12 +17,12 @@ jobs: platform: - { runner: ubuntu-latest, python_exec: ".venv/bin/python" } - { runner: ubuntu-24.04-arm, python_exec: ".venv/bin/python" } - - { runner: macos-latest, python_exec: ".venv/bin/python" } - - { runner: macos-13, python_exec: ".venv/bin/python" } + - { runner: macos-latest, python_exec: ".venv/bin/python", extra_rustflags: "-C split-debuginfo=off"} + - { runner: macos-13, python_exec: ".venv/bin/python", extra_rustflags: "-C split-debuginfo=off"} - { runner: windows-latest, python_exec: ".venv\\Scripts\\python" } runs-on: ${{ matrix.platform.runner }} env: - RUSTFLAGS: "-C debuginfo=0 -C split-debuginfo=off" + RUSTFLAGS: "-C debuginfo=0 ${{ matrix.platform.extra_rustflags }}" CARGO_INCREMENTAL: "0" SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: "sccache" From 9fd948ad464cbe41a3838f046980463165bccc9f Mon Sep 17 00:00:00 2001 From: Jiangzhou He Date: Wed, 15 Oct 2025 16:14:49 -0700 Subject: [PATCH 3/3] bring back Rust cache with tuning --- .github/workflows/_test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index ce2bbf2b3..a386481ca 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -43,6 +43,14 @@ jobs: - run: rustup toolchain install stable --profile minimal + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + with: + key: rust-${{ matrix.platform.runner }}-${{ matrix.python-version }} + cache-targets: 'false' + cache-all-crates: 'false' + cache-workspace-crates: 'false' + - name: Rust tests (no default features) run: cargo test --no-default-features --verbose