Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: persist Rust caches for Pip package build #4480

Merged
merged 3 commits into from
Dec 15, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ jobs:
with:
python-version: '3.8'
architecture: 'x64'
- name: 'Cache Cargo home directory'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also includes tensorboard/data/server/target/ which isn't the Cargo home directory (as I understand it) - maybe broaden description slightly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, yes. Renamed in both cases. (I think “Cargo artifacts” is probably
fine, since it’s Cargo (not rustc) that sets up this structure. But
happy to entertain other suggestions.)

uses: actions/cache@v2
with:
path: |
tensorboard/data/server/target/
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
# Needed for installing binaries with cache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand this comment. Could you elaborate slightly?

Update: read the other version of this comment which mentions cargo-raze so I assume this has something to do with raze generating these artifacts? Slightly more elaboration would still be useful IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elaborated. This is needed only if you cargo install a binary, like
cargo-raze or hyperfine or something. Upstream documentation issue:
rust-lang/cargo#8841

We don’t actually need it for this job. I kept it to reduce headache in
case we later update it to cargo install. Clarified in comment.

~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: build-data-server-pip-${{ runner.os }}-cargo-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/ci.yml') }}
- name: 'Install Rust toolchain'
uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -214,7 +228,7 @@ jobs:
# Needed for installing binaries (`cargo-raze`) with cache
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ${{ runner.os }}-cargo-${{ matrix.rust_version }}-${{ matrix.cargo_raze_version }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/ci.yml') }}
key: lint-rust-${{ runner.os }}-cargo-${{ matrix.rust_version }}-${{ matrix.cargo_raze_version }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/ci.yml') }}
- name: 'Install Rust toolchain'
uses: actions-rs/toolchain@v1
with:
Expand Down