Skip to content

Commit

Permalink
Build cache improvements (risc0#1137)
Browse files Browse the repository at this point in the history
* Refactor env vars to part of composite actions
* Attempt to speed up C++ builds
  • Loading branch information
flaub authored Nov 10, 2023
1 parent ba4f01b commit 4ab1f0b
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 101 deletions.
5 changes: 4 additions & 1 deletion .github/actions/rustup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ runs:
run: rustup component add ${{ inputs.components }}
shell: bash

- run: echo CARGO_TERM_COLOR=always >> $GITHUB_ENV
- run: |
echo "CARGO_NET_RETRY=10" >> $GITHUB_ENV
echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
echo "RUSTUP_MAX_RETRIES=10" >> $GITHUB_ENV
shell: bash
- run: rustc --version --verbose
Expand Down
20 changes: 13 additions & 7 deletions .github/actions/sccache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@ runs:
shell: bash

- if: runner.os == 'Linux'
env:
SCCACHE_REGION: us-west-2
SCCACHE_BUCKET: risc0-ci-cache
SCCACHE_S3_KEY_PREFIX: public/${{ inputs.key }}/sccache
run: |
echo "SCCACHE_REGION=${{ env.SCCACHE_REGION }}" >> $GITHUB_ENV
echo "SCCACHE_BUCKET=${{ env.SCCACHE_BUCKET }}" >> $GITHUB_ENV
echo "SCCACHE_S3_KEY_PREFIX=${{ env.SCCACHE_S3_KEY_PREFIX }}" >> $GITHUB_ENV
echo "SCCACHE_REGION=us-west-2" >> $GITHUB_ENV
echo "SCCACHE_BUCKET=risc0-ci-cache" >> $GITHUB_ENV
echo "SCCACHE_S3_KEY_PREFIX=public/${{ inputs.key }}/sccache" >> $GITHUB_ENV
shell: bash

- run: |
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo "CARGO_PROFILE_DEV_DEBUG=0" >> $GITHUB_ENV
echo "CC=sccache clang" >> $GITHUB_ENV
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
echo "CXX=sccache clang++" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
shell: bash
- if: runner.os == 'Linux'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/bench_applications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
env:
CUDA_LIBRARY_PATH: /usr/lib/cuda
FEATURE: ${{ matrix.feature }}
RUSTC_WRAPPER: sccache

steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/bench_datasheet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
env:
CUDA_LIBRARY_PATH: /usr/lib/cuda
FEATURE: ${{ matrix.feature }}
RUSTC_WRAPPER: sccache

steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/bench_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
env:
CUDA_LIBRARY_PATH: /usr/lib/cuda
FEATURE: ${{ matrix.feature }}
RUSTC_WRAPPER: sccache

steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/bench_trends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
env:
CUDA_LIBRARY_PATH: /usr/lib/cuda
FEATURE: ${{ matrix.feature }}
RUSTC_WRAPPER: sccache

steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/bonsai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ permissions:
contents: read

env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_PROFILE_DEV_DEBUG: 0
RISC0_BUILD_LOCKED: 1
RISC0_TOOLCHAIN_VERSION: test-release-2
RUSTC_WRAPPER: sccache
RUSTUP_MAX_RETRIES: 10

jobs:
changes:
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ permissions:
contents: read

env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_PROFILE_DEV_DEBUG: 0
RISC0_TOOLCHAIN_VERSION: test-release-2
RUSTUP_MAX_RETRIES: 10

jobs:
changes:
Expand Down Expand Up @@ -147,7 +143,6 @@ jobs:
FEATURE: ${{ matrix.feature }}
RISC0_BUILD_LOCKED: 1
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
Expand Down Expand Up @@ -218,7 +213,6 @@ jobs:
RISC0_PROVER: ipc
RISC0_SERVER_PATH: ${{ github.workspace }}/target/release/r0vm
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
Expand Down Expand Up @@ -247,8 +241,6 @@ jobs:
if: needs.changes.outputs.doc == 'true'
needs: changes
runs-on: [self-hosted, prod, macOS, cpu]
env:
RUSTC_WRAPPER: sccache
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
Expand All @@ -268,8 +260,6 @@ jobs:
if: needs.changes.outputs.check-benchmarks == 'true'
needs: changes
runs-on: [self-hosted, prod, macOS, cpu]
env:
RUSTC_WRAPPER: sccache
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
Expand All @@ -293,8 +283,6 @@ jobs:
fail-fast: false
matrix:
os: [Linux, macOS]
env:
RUSTC_WRAPPER: sccache
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
Expand Down Expand Up @@ -326,7 +314,6 @@ jobs:
runs-on: [self-hosted, prod, macOS, cpu]
env:
RISC0_BUILD_LOCKED: 1
RUSTC_WRAPPER: sccache
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
Expand All @@ -350,7 +337,6 @@ jobs:
runs-on: ubuntu-latest-8-cores
env:
RISC0_BUILD_LOCKED: 1
RUSTC_WRAPPER: sccache
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
Expand Down Expand Up @@ -379,8 +365,6 @@ jobs:
if: needs.changes.outputs.test == 'true'
needs: changes
runs-on: [self-hosted, prod, Linux, cpu, docker]
env:
RUSTC_WRAPPER: sccache
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
- os: macOS
target: aarch64-apple-darwin
env:
RUSTC_WRAPPER: sccache
TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/website-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ permissions:
contents: read

env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_PROFILE_DEV_DEBUG: 0
RISC0_TOOLCHAIN_VERSION: test-release-2
RUSTC_WRAPPER: sccache
RUSTUP_MAX_RETRIES: 10

jobs:
doc-test:
Expand Down
36 changes: 22 additions & 14 deletions benchmarks/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 21 additions & 14 deletions bonsai/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 21 additions & 14 deletions bonsai/examples/governance/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4ab1f0b

Please sign in to comment.