diff --git a/.github/workflows/test-cron.yaml b/.github/workflows/test-cron.yaml index 7e42e666e5b6..d0a34a3c6710 100644 --- a/.github/workflows/test-cron.yaml +++ b/.github/workflows/test-cron.yaml @@ -143,6 +143,19 @@ jobs: ./cargo check --benches + ' + - if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' + name: Cargo Trim + run: './cargo install cargo-trim@0.9.0 + + ./cargo trim init + + ./cargo trim --query + + ./cargo trim --orphan + + ./cargo trim --query + ' strategy: matrix: @@ -277,6 +290,19 @@ jobs: if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' name: Test Rust run: ./cargo test --tests -- --nocapture + - if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' + name: Cargo Trim + run: './cargo install cargo-trim@0.9.0 + + ./cargo trim init + + ./cargo trim --query + + ./cargo trim --orphan + + ./cargo trim --query + + ' strategy: matrix: python-version: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c97e4fbdbc24..5609540dbe9e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -146,6 +146,19 @@ jobs: ./cargo check --benches + ' + - if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' + name: Cargo Trim + run: './cargo install cargo-trim@0.9.0 + + ./cargo trim init + + ./cargo trim --query + + ./cargo trim --orphan + + ./cargo trim --query + ' strategy: matrix: @@ -282,6 +295,19 @@ jobs: if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' name: Test Rust run: ./cargo test --tests -- --nocapture + - if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' + name: Cargo Trim + run: './cargo install cargo-trim@0.9.0 + + ./cargo trim init + + ./cargo trim --query + + ./cargo trim --orphan + + ./cargo trim --query + + ' strategy: matrix: python-version: @@ -359,6 +385,19 @@ jobs: if: github.event_name == 'push' name: Build fs_util run: ./build-support/bin/release.sh build-fs-util + - if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' + name: Cargo Trim + run: './cargo install cargo-trim@0.9.0 + + ./cargo trim init + + ./cargo trim --query + + ./cargo trim --orphan + + ./cargo trim --query + + ' - continue-on-error: true if: always() name: Upload pants.log @@ -460,6 +499,19 @@ jobs: if: github.event_name == 'push' name: Build fs_util run: ./build-support/bin/release.sh build-fs-util + - if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' + name: Cargo Trim + run: './cargo install cargo-trim@0.9.0 + + ./cargo trim init + + ./cargo trim --query + + ./cargo trim --orphan + + ./cargo trim --query + + ' - continue-on-error: true if: always() name: Upload pants.log @@ -603,6 +655,19 @@ jobs: - if: github.event_name == 'push' name: Build fs_util run: USE_PY39=true arch -arm64 ./build-support/bin/release.sh build-fs-util + - if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' + name: Cargo Trim + run: './cargo install cargo-trim@0.9.0 + + ./cargo trim init + + ./cargo trim --query + + ./cargo trim --orphan + + ./cargo trim --query + + ' - env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -703,6 +768,19 @@ jobs: if: github.event_name == 'push' name: Build fs_util run: ./build-support/bin/release.sh build-fs-util + - if: '!contains(env.COMMIT_MESSAGE, ''[ci skip-rust]'')' + name: Cargo Trim + run: './cargo install cargo-trim@0.9.0 + + ./cargo trim init + + ./cargo trim --query + + ./cargo trim --orphan + + ./cargo trim --query + + ' - continue-on-error: true if: always() name: Upload pants.log diff --git a/build-support/bin/generate_github_workflows.py b/build-support/bin/generate_github_workflows.py index bf3d6f594158..b81c1b94dfde 100644 --- a/build-support/bin/generate_github_workflows.py +++ b/build-support/bin/generate_github_workflows.py @@ -265,6 +265,22 @@ def rust_caches() -> Sequence[Step]: ] +def cargo_trim() -> Step: + return { + "name": "Cargo Trim", + "run": dedent( + """\ + ./cargo install cargo-trim@0.9.0 + ./cargo trim init + ./cargo trim --query + ./cargo trim --orphan + ./cargo trim --query + """ + ), + "if": DONT_SKIP_RUST, + } + + def install_jdk() -> Step: return { "name": "Install AdoptJDK", @@ -494,6 +510,7 @@ def build_steps(self) -> list[Step]: "if": "github.event_name == 'push'", "env": self.platform_env(), }, + cargo_trim(), ] def upload_log_artifacts(self, name: str) -> Step: @@ -574,6 +591,7 @@ def test_python_linux(shard: str) -> dict[str, Any]: ), "if": DONT_SKIP_RUST, }, + cargo_trim(), ], }, "test_python_linux_x86_64_0": test_python_linux("0/3"), @@ -633,6 +651,7 @@ def macos11_x86_64_jobs(python_versions: list[str], *, cron: bool) -> Jobs: "env": {"TMPDIR": f"{gha_expr('runner.temp')}"}, "if": DONT_SKIP_RUST, }, + cargo_trim(), ], }, "test_python_macos11_x86_64": { @@ -737,6 +756,7 @@ def macos11_arm64_jobs() -> Jobs: "if": "github.event_name == 'push'", } ) + steps.append(cargo_trim()) steps.append(deploy_to_s3()) return { "build_wheels_macos11_arm64": {