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

chore: improve cache utility #2540

Merged
merged 5 commits into from
Jan 31, 2024
Merged
Changes from all 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
84 changes: 34 additions & 50 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ jobs:
name: toolchain cache
with:
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
key: ${{ runner.os }}-toolchain-build-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-pkg-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-pkg-build-
- uses: actions/cache@v4
name: build cache
with:
Expand Down Expand Up @@ -69,11 +70,14 @@ jobs:
just-version: "1.23.0"
- uses: actions/cache@v4
name: nightly toolchain cache
id: lint-toolchain
with:
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rustfmt.toml') }}
key: ${{ runner.os }}-toolchain-lint-${{ hashFiles('**/rustfmt.toml') }}
- run: rustup install nightly
if: ${{ steps.lint-toolchain.outputs.cache-hit != 'true' }}
- run: rustup component add rustfmt --toolchain nightly
if: ${{ steps.lint-toolchain.outputs.cache-hit != 'true' }}
- run: just fmt-check


Expand All @@ -88,16 +92,20 @@ jobs:
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache/restore@v4
- uses: actions/cache@v4
name: toolchain cache
with:
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache/restore@v4
key: ${{ runner.os }}-toolchain-build-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-pkg-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-pkg-build-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-pkg-lint-
${{ runner.os }}-cargo-pkg-build-
- uses: actions/cache/restore@v4
name: build cache
with:
Expand All @@ -123,12 +131,16 @@ jobs:
name: toolchain cache
with:
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
key: ${{ runner.os }}-toolchain-build-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-pkg-python-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-pkg-build-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-pkg-python-
${{ runner.os }}-cargo-pkg-build-
- uses: actions/cache@v4
name: build cache
with:
Expand Down Expand Up @@ -157,14 +169,14 @@ jobs:
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache/restore@v4
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-build-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
path: ~/.cargo/
key: ${{ runner.os }}-cargo-pkg-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-pkg-build-
- uses: actions/cache/restore@v4
name: build cache
with:
Expand All @@ -191,13 +203,17 @@ jobs:
name: toolchain cache
with:
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
key: ${{ runner.os }}-toolchain-build-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
key: ${{ runner.os }}-cargo-pkg-unit-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-pkg-build-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-pkg-unit-
${{ runner.os }}-cargo-pkg-build-
- uses: actions/cache/restore@v4
name: build cache
with:
path: |
Expand All @@ -213,33 +229,6 @@ jobs:
- run: just unit-tests


cache:
# update a cache that can be used between builds, but do it
# outside of the hot path.
name: cache helper
needs: ["build", "python-binding-tests", "unit-tests"]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/cache/restore@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
!target/**/pgprototest
key: ${{ runner.os }}-cargo-glaredb-build-${{ github.ref_name }}
- uses: actions/cache/save@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
!target/**/pgprototest
key: ${{ runner.os }}-cargo-glaredb-build-${{ hashFiles('**/Cargo.lock') }}


pg-protocol:
name: PG Protocol Tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -323,11 +312,6 @@ jobs:
with:
path: target/debug/glaredb
key: ${{ runner.os }}-glaredb-bin-${{ github.run_id }}
- uses: actions/cache@v4
name: py cache
with:
path: tests/.venv/
key: ${{ runner.os }}-poetry-${{ hashFiles('tests/poetry.lock') }}
- run: just venv
- run: just pytest

Expand Down
Loading