mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
~~Improve CI runs by adding a caching action. Between each run crates should be cached to speed up building datahaven binary.~~ ## Summary In the end the real issue was not that we were missing a caching action but that we were caching too much. We went way over the 10GB limit imposed by github (we were using 60GB of cache). So the most recent cache were deleted right away or not cache at all. The over use of the cache was happening because we were caching twice sccache folder. Once with the `mozilla-actions/sccache-action` and an other time with `Swatinem/rust-cache`. The solution was to keep caching sccache on github with `mozilla-actions/sccache-action`. In this PR we also exchange the `Swatinem/rust-cache` action to use the more standard `actions/cache@v4`. It would avoid in the future unwanted breaking changes and security issues. --------- Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
53 lines
No EOL
1.5 KiB
YAML
53 lines
No EOL
1.5 KiB
YAML
name: "Setup Rust Environment"
|
|
description: "Creates a Rust environment with the specified toolchain, cache, and dependencies"
|
|
|
|
inputs:
|
|
cache-key:
|
|
description: "Cache key used to retrieve built data. Usually matches the profile of the build"
|
|
required: false
|
|
default: "cache"
|
|
|
|
install-deps:
|
|
description: "Whether to install system dependencies (libpq-dev, libclang-dev)"
|
|
required: false
|
|
default: "true"
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Set Rust version
|
|
shell: bash
|
|
run: |
|
|
echo "BUILD_RUST_VERSION=$(rustc --version)" >> $GITHUB_ENV
|
|
- name: Run sccache-cache
|
|
uses: mozilla-actions/sccache-action@v0.0.9
|
|
|
|
- name: Show sccache stats
|
|
shell: bash
|
|
run: sccache --show-stats
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
|
|
- uses: rui314/setup-mold@v1
|
|
|
|
- name: Install system dependencies
|
|
if: inputs.install-deps == 'true'
|
|
shell: bash
|
|
run: sudo apt-get update && sudo apt-get install -y libpq-dev libclang-dev
|
|
- name: Install Protoc
|
|
if: inputs.install-deps == 'true'
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
repo-token: ${{ github.token }} |