From f134df548d3430e3ab20dcb8ba846c0efbb86c69 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Thu, 6 Apr 2023 16:19:15 +1000 Subject: [PATCH] Optimize `release-build.yml`: Avoid building benchmark dependencies (#981) Signed-off-by: Jiahao XU --- .github/workflows/release-build.yml | 4 +++- justfile | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 94fe2475..97a67cce 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -60,7 +60,9 @@ jobs: - name: Run unit tests in release build if: "matrix.r" - run: just unit-tests + run: | + just avoid-benchmark-deps + just unit-tests env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/justfile b/justfile index ae973e6d..c7dd34d4 100644 --- a/justfile +++ b/justfile @@ -220,7 +220,7 @@ fmt-check: fmt lint: clippy fmt-check -# Some dev-dependencies require a newer version of Rust, but it doesn't matter for MSRV check +# Rm dev-dependencies for `cargo-check` and clippy to speedup compilation. # This is a workaround for the cargo nightly option `-Z avoid-dev-deps` avoid-dev-deps: for crate in ./crates/*; do \ @@ -228,6 +228,12 @@ avoid-dev-deps: mv "$crate/Cargo.toml.tmp" "$crate/Cargo.toml" \ ; done +# leon dev-dependencies pulls in crates for benchmark but not used in test. +# This is a workaround for the lack of `benchmark-dependencies`. +avoid-benchmark-deps: + sed 's/\[dev-dependencies\]/[workaround-avoid-dev-deps]/g' ./crates/leon/Cargo.toml >./crates/leon/Cargo.toml.tmp + mv ./crates/leon/Cargo.toml.tmp ./crates/leon/Cargo.toml + package-dir: rm -rf packages/prep mkdir -p packages/prep