Skip to content

Commit

Permalink
Trim the cached Cargo state.
Browse files Browse the repository at this point in the history
Because of the restore-keys it can otherwise grow without bound.
  • Loading branch information
benjyw committed Oct 9, 2022
1 parent cbaf090 commit ae5e5af
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 24 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/test-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ jobs:
restore-keys: 'Linux-x86_64-cargo-${ hashFiles(''rust-toolchain'') }-
'
- name: Trim Cargo cache
uses: actions-rs/install@v0.1.2
with:
crate: cargo-trim
version: 0.8.0
- id: get-engine-hash
name: Get native engine hash
run: 'echo "::set-output name=hash::$(./build-support/bin/rust/print_engine_hash.sh)"
Expand Down Expand Up @@ -218,6 +223,11 @@ jobs:
restore-keys: 'macOS11-x86_64-cargo-${ hashFiles(''rust-toolchain'') }-
'
- name: Trim Cargo cache
uses: actions-rs/install@v0.1.2
with:
crate: cargo-trim
version: 0.8.0
- id: get-engine-hash
name: Get native engine hash
run: 'echo "::set-output name=hash::$(./build-support/bin/rust/print_engine_hash.sh)"
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ jobs:
restore-keys: 'Linux-x86_64-cargo-${ hashFiles(''rust-toolchain'') }-
'
- name: Trim Cargo cache
uses: actions-rs/install@v0.1.2
with:
crate: cargo-trim
version: 0.8.0
- id: get-engine-hash
name: Get native engine hash
run: 'echo "::set-output name=hash::$(./build-support/bin/rust/print_engine_hash.sh)"
Expand Down Expand Up @@ -223,6 +228,11 @@ jobs:
restore-keys: 'macOS11-x86_64-cargo-${ hashFiles(''rust-toolchain'') }-
'
- name: Trim Cargo cache
uses: actions-rs/install@v0.1.2
with:
crate: cargo-trim
version: 0.8.0
- id: get-engine-hash
name: Get native engine hash
run: 'echo "::set-output name=hash::$(./build-support/bin/rust/print_engine_hash.sh)"
Expand Down Expand Up @@ -438,6 +448,11 @@ jobs:
restore-keys: 'macOS10-15-x86_64-cargo-${ hashFiles(''rust-toolchain'') }-
'
- name: Trim Cargo cache
uses: actions-rs/install@v0.1.2
with:
crate: cargo-trim
version: 0.8.0
- env:
ARCHFLAGS: -arch x86_64
if: github.event_name == 'push' || !contains(env.COMMIT_MESSAGE, '[ci skip-build-wheels]')
Expand Down Expand Up @@ -542,6 +557,11 @@ jobs:
restore-keys: 'macOS11-ARM64-cargo-${ hashFiles(''rust-toolchain'') }-
'
- name: Trim Cargo cache
uses: actions-rs/install@v0.1.2
with:
crate: cargo-trim
version: 0.8.0
- id: get-engine-hash
name: Get native engine hash
run: 'echo "::set-output name=hash::$(./build-support/bin/rust/print_engine_hash.sh)"
Expand Down Expand Up @@ -681,6 +701,11 @@ jobs:
restore-keys: 'macOS11-x86_64-cargo-${ hashFiles(''rust-toolchain'') }-
'
- name: Trim Cargo cache
uses: actions-rs/install@v0.1.2
with:
crate: cargo-trim
version: 0.8.0
- env:
ARCHFLAGS: -arch x86_64
if: github.event_name == 'push' || !contains(env.COMMIT_MESSAGE, '[ci skip-build-wheels]')
Expand Down
34 changes: 10 additions & 24 deletions build-support/bin/generate_github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,28 +227,6 @@ def install_rustup() -> Step:
}


def rust_caches() -> Sequence[Step]:
return [
{
"name": "Cache Rust toolchain",
"uses": "actions/cache@v3",
"with": {
"path": f"~/.rustup/toolchains/{rust_channel()}-*\n~/.rustup/update-hashes\n~/.rustup/settings.toml\n",
"key": "${{ runner.os }}-rustup-${{ hashFiles('rust-toolchain') }}-v1",
},
},
{
"name": "Cache Cargo",
"uses": "actions/cache@v3",
"with": {
"path": "~/.cargo/registry\n~/.cargo/git\n",
"key": "${{ runner.os }}-cargo-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('src/rust/engine/Cargo.*') }}-v1\n",
"restore-keys": "${{ runner.os }}-cargo-${{ hashFiles('rust-toolchain') }}-\n",
},
},
]


def install_jdk() -> Step:
return {
"name": "Install AdoptJDK",
Expand Down Expand Up @@ -399,6 +377,14 @@ def rust_caches(self) -> Sequence[Step]:
"restore-keys": f"{self.platform_name()}-cargo-${{ hashFiles('rust-toolchain') }}-\n",
},
},
{
"name": "Trim Cargo cache",
"uses": "actions-rs/install@v0.1.2",
"with": {
"crate": "cargo-trim",
"version": "0.8.0",
}
},
]

def bootstrap_caches(self) -> Sequence[Step]:
Expand Down Expand Up @@ -674,7 +660,7 @@ def macos11_x86_64_jobs(python_versions: list[str], *, cron: bool) -> Jobs:
return jobs


def macos_10_15_x86_64_jobs(python_versions: list[str]) -> Jobs:
def macos_10_15_x86_64_jobs() -> Jobs:
helper = Helper(Platform.MACOS10_15_X86_64)
return {
"build_wheels_macos10_15_x86_64": {
Expand Down Expand Up @@ -748,7 +734,7 @@ def test_workflow_jobs(python_versions: list[str], *, cron: bool) -> Jobs:
jobs.update(**linux_x86_64_jobs(python_versions, cron=cron))
jobs.update(**macos11_x86_64_jobs(python_versions, cron=cron))
if not cron:
jobs.update(**macos_10_15_x86_64_jobs(python_versions))
jobs.update(**macos_10_15_x86_64_jobs())
jobs.update(**macos11_arm64_jobs())
jobs.update(
{
Expand Down

0 comments on commit ae5e5af

Please sign in to comment.