Skip to content

Commit

Permalink
Trim Cargo state
Browse files Browse the repository at this point in the history
  • Loading branch information
benjyw committed Oct 10, 2022
1 parent f218cdc commit 2a6cee6
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions build-support/bin/generate_github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 2a6cee6

Please sign in to comment.