Skip to content

CI: Replace custom caching with rust-cache action #3980

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

Merged
merged 1 commit into from
Oct 14, 2021
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
71 changes: 5 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,46 +69,23 @@ jobs:
runs-on: ubuntu-20.04

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-D warnings"

steps:
- uses: actions/checkout@v2

# Current size as of 2021-02-15: ~105 MB
- name: Cache cargo registry and git deps
uses: actions/[email protected]
with:
path: |
~/.cargo/registry/cache
~/.cargo/registry/index
~/.cargo/git/db
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install Rust
run: |
rustup set profile minimal
# Pin to older version until a clippy regression is fixed
rustup update 1.54.0
rustup default 1.54.0

- id: rustc
run:
echo "::set-output name=version::$(rustc -V)"

- name: Cache cargo build
uses: actions/[email protected]
with:
path: target
key: v2-${{ runner.os }}-cargo-clippy-${{ steps.rustc.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
v2-${{ runner.os }}-cargo-clippy-${{ steps.rustc.outputs.version }}-

- run: rustup component add rustfmt
- run: rustup component add clippy

- uses: Swatinem/[email protected]

- run: cargo fmt -- --check
- run: cargo clippy --all-targets --all-features --all

Expand All @@ -127,7 +104,6 @@ jobs:
RUST_BACKTRACE: 1
DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-D warnings"
MALLOC_CONF: "background_thread:true,abort_conf:true,abort:true,junk:true"

Expand Down Expand Up @@ -161,29 +137,6 @@ jobs:
fi
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

# Cache `diesel` binary
#
# The other binaries (like `rustc`) will be overwritten by rustup.
#
# Current size as of 2021-02-15: ~15 MB
- name: Cache cargo binaries
uses: actions/[email protected]
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ matrix.rust }}-${{ hashFiles('.diesel_version') }}-v3

# Current size as of 2021-02-15: ~105 MB
- name: Cache cargo registry and git deps
uses: actions/[email protected]
with:
path: |
~/.cargo/registry/cache
~/.cargo/registry/index
~/.cargo/git/db
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install ${{ matrix.rust }} Rust
run: |
if [[ ! -d "$HOME/.cargo" || ! -d "$HOME/.rustup" ]]; then
Expand All @@ -194,27 +147,16 @@ jobs:
rustup update ${{ matrix.rust }}
rustup default ${{ matrix.rust }}

- id: rustc
run:
echo "::set-output name=version::$(rustc -V)"

# Current size as of 2021-02-12: ~325 MB
- name: Cache cargo build
uses: actions/[email protected]
with:
path: target
key: v2-${{ runner.os }}-cargo-build-target-${{ steps.rustc.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
v2-${{ runner.os }}-cargo-build-target-${{ steps.rustc.outputs.version }}-
- uses: Swatinem/[email protected]

- name: Setup database
run: |
which diesel || cargo install diesel_cli --vers $(cat .diesel_version) --no-default-features --features postgres --debug
cargo install diesel_cli --vers $(cat .diesel_version) --no-default-features --features postgres --debug
diesel database setup --locked-schema

- name: Install cargo-tarpaulin
if: matrix.rust == 'stable'
run: which cargo-tarpaulin || cargo install cargo-tarpaulin --version ~0.18.0-alpha.3
run: cargo install cargo-tarpaulin --version ~0.18.0-alpha.3

- name: Run tests (with coverage report)
if: matrix.rust == 'stable'
Expand All @@ -224,9 +166,6 @@ jobs:
if: matrix.rust != 'stable'
run: cargo test --workspace

- name: Prune unnecessary cache
run: script/ci/prune-cache.sh


# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
Expand Down
36 changes: 0 additions & 36 deletions script/ci/prune-cache.sh

This file was deleted.