Skip to content

Commit

Permalink
chore(ci): use sccache for base venv builds (#10211)
Browse files Browse the repository at this point in the history
Builds on top of #10181 by enabling sccache in CircleCI build base venvs
job.

It drops about 30-60 seconds from the build step.

## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [ ] Reviewer has checked that all the criteria below are met 
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
  • Loading branch information
brettlangdon authored Aug 14, 2024
1 parent 96ce8a2 commit 00a66eb
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .circleci/config.templ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,34 @@ commands:
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
- run: echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> "$BASH_ENV"

setup_sccache:
description: "Install and configure sccache"
steps:
- run:
name: "Install sccache"
command: |
curl -L https://github.com/mozilla/sccache/releases/download/v0.8.1/sccache-v0.8.1-x86_64-unknown-linux-musl.tar.gz | tar zx --strip-components=1 -C /usr/local/bin/ sccache-v0.8.1-x86_64-unknown-linux-musl/sccache
echo "export SCCACHE_DIR=/root/.cache/sccache" >> "$BASH_ENV"
echo "export SCCACHE_CACHE_SIZE=1G" >> "$BASH_ENV"
echo "export SCCACHE_DIRECT=true" >> "$BASH_ENV"
echo "export DD_USE_SCCACHE=1" >> "$BASH_ENV"
/usr/local/bin/sccache --version
- restore_cache:
name: Restore sccache cache
key: v0-sccache-cache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ .Environment.CIRCLE_NODE_INDEX }}

save_sccache:
description: "Save the sccache cache"
steps:
- run:
name: "sccache stats"
command: /usr/local/bin/sccache --show-stats
- save_cache:
name: Save sccache cache
key: v0-sccache-cache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ .Environment.CIRCLE_NODE_INDEX }}-{{ epoch }}
paths:
- /root/.cache/sccache/

setup_hatch:
description: "Install hatch"
steps:
Expand Down Expand Up @@ -455,13 +483,15 @@ jobs:
steps:
- checkout
- setup_riot
- setup_sccache
- run:
name: "Generate base virtual environments."
# DEV: riot list -i tracer lists all supported Python versions
command: "riot list -i tracer | circleci tests split | xargs -I PY riot -P -v generate --python=PY"
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 12
PIP_VERBOSE: 1
- save_sccache
- persist_to_workspace:
root: .
paths:
Expand Down

0 comments on commit 00a66eb

Please sign in to comment.