Skip to content

Commit

Permalink
cache cargo builds in CI (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
QP Hou authored Aug 9, 2021
1 parent 7dc0c6c commit 5926052
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 31 deletions.
70 changes: 53 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
${{ runner.os }}-cargo-
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
Expand All @@ -57,6 +69,18 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: test-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
test-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
test-${{ runner.os }}-cargo-
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
Expand All @@ -69,20 +93,32 @@ jobs:
s3_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
override: true
- name: Setup localstack
run: docker-compose up setup
- name: Run tests
# As there's no way to run tests which are feature only, one should explicitly tell which tests to execute.
# Using `cargo test s3` requires tests to include _s3_ part in a name which is easily human error prone.
run: |
cargo test s3 --test simple_commit_test --features s3
cargo test s3 --test concurrent_writes_test --features s3
cargo test --test dynamodb_lock_test --features s3
cargo test --test repair_s3_rename_test --features s3
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: s3-test-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
s3-test-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
s3-test-${{ runner.os }}-cargo-
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
override: true
- name: Setup localstack
run: docker-compose up setup
- name: Run tests
# As there's no way to run tests which are feature only, one should explicitly tell which tests to execute.
# Using `cargo test s3` requires tests to include _s3_ part in a name which is easily human error prone.
run: |
cargo test s3 --test simple_commit_test --features s3
cargo test s3 --test concurrent_writes_test --features s3
cargo test --test dynamodb_lock_test --features s3
cargo test --test repair_s3_rename_test --features s3
24 changes: 10 additions & 14 deletions .github/workflows/ruby_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,18 @@ jobs:

steps:
- uses: actions/checkout@v2
# the whole target dir is over 400MB cache limit, so we have to split up
# the cache step to avoid caching deps dir
- name: Cache Rust build
uses: actions/cache@v1.0.1
- uses: actions/cache@v2
with:
path: target/release/build
key: ruby-${{ runner.OS }}-target-release-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ruby-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
ruby-${{ runner.OS }}-target-build-
- name: Cache Rust incremental build
uses: actions/cache@v1.0.1
with:
path: target/release/incremental
key: ruby-${{ runner.OS }}-target-release-incremental-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
ruby-${{ runner.OS }}-target-incremental-
ruby-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
ruby-${{ runner.os }}-cargo-
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
Expand Down

0 comments on commit 5926052

Please sign in to comment.