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: (ci) split cache #2531

Merged
merged 10 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
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
137 changes: 85 additions & 52 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,13 @@ jobs:
- uses: actions/cache@v4
name: nightly toolchain cache
with:
path: |
~/.rustup/toolchains/
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rustfmt.toml') }}
- run: rustup install nightly
- run: rustup component add rustfmt --toolchain nightly
- run: just fmt-check


lint:
name: Lint (clippy)
# emperically runtimes are the same for big/small hosts:
runs-on: ubuntu-latest
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache/restore@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache/restore@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: just clippy


build:
name: Build
runs-on: ubuntu-latest-8-cores
Expand All @@ -72,23 +45,24 @@ jobs:
- uses: actions/cache@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
name: cargo cache
with:
path: |
~/.cargo/
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
name: workspace cache
name: build cache
with:
path: |
target/
!target/**/glaredb
!target/**/pgprototest
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-build-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-cargo-glaredb-build-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-glaredb-build-
- run: just build
- run: cargo build --bin pgprototest
- uses: actions/cache/save@v4
Expand All @@ -103,10 +77,66 @@ jobs:
key: ${{ github.run_id }}


cache:
# update a cache that can be used between builds, but do it
# outside of the hot path.
name: cache helper
needs: ["build"]
runs-on: ubuntu-latest
steps:
- uses: actions/cache/restore@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
!target/**/pgprototest
key: ${{ runner.os }}-cargo-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') }}

lint:
name: Lint (clippy)
# emperically runtimes are the same for big/small hosts:
runs-on: ubuntu-latest
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
- uses: extractions/setup-just@v1
with:
just-version: "1.23.0"
- uses: actions/cache/restore@v4
name: toolchain cache
with:
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache/restore@v4
name: cargo cache
with:
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache/restore@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
!target/**/pgprototest
key: ${{ runner.os }}-cargo-glaredb-${{ github.ref_name }}
- run: just clippy


python-binding-tests:
name: Python Binding Tests
runs-on: ubuntu-latest-4-cores
needs: ["fmt"]
needs: ["build"]
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -116,31 +146,29 @@ jobs:
- uses: actions/cache/restore@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache/restore@v4
name: cargo cache
with:
path: |
~/.cargo/
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache/restore@v4
name: workspace cache
name: build cache
with:
path: |
target/
!target/**/glaredb
!target/**/pgprototest
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-build-${{ github.ref_name }}
- run: just python build
- run: just python test


nodejs-bindings-tests:
name: Node.js Binding Tests
runs-on: ubuntu-latest-8-cores
needs: ["fmt"]
needs: ["build"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -155,20 +183,20 @@ jobs:
path: |
~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
name: cargo cache
with:
path: |
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache/restore@v4
name: workspace cache
name: build cache
with:
path: |
target/
!target/**/glaredb
!target/**/pgprototest
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-build-${{ github.ref_name }}
- run: just js build-debug
- run: just js test

Expand All @@ -186,15 +214,21 @@ jobs:
- uses: actions/cache/restore@v4
name: toolchain cache
with:
path: |
~/.rustup/toolchains/
path: ~/.rustup/toolchains/
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
- uses: actions/cache/restore@v4
name: cargo cache
with:
path: |
~/.cargo/
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache/restore@v4
name: build cache
with:
path: |
target/
!target/**/glaredb
!target/**/pgprototest
key: ${{ runner.os }}-cargo-build-${{ github.ref_name }}
- uses: actions/cache/restore@v4
name: glaredb cache
with:
Expand Down Expand Up @@ -289,9 +323,8 @@ jobs:
- uses: actions/cache@v4
name: py cache
with:
path: |
tests/.venv/
key: ${{ runner.os }}-poetry-${{ hashFiles('**/Cargo.lock') }}
path: tests/.venv/
key: ${{ runner.os }}-poetry-${{ hashFiles('tests/poetry.lock') }}
- run: just venv
- run: just pytest

Expand Down
Loading
Loading