Skip to content

Commit

Permalink
Add sccache in CI (nautechsystems#2093)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunlei authored Dec 8, 2024
1 parent ab4e460 commit aa03dfb
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ jobs:
python-version: ["3.11", "3.12"]
name: build - Python ${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1
RUSTC_WRAPPER: "sccache"
CC: "sccache clang"
CXX: "sccache clang"

steps:
- name: Free disk space (Ubuntu)
Expand All @@ -35,6 +42,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Set up Rust toolchain
run: |
rustup toolchain add --profile minimal stable --component clippy,rustfmt
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
env:
BUILD_MODE: debug
RUST_BACKTRACE: 1
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1
RUSTC_WRAPPER: "sccache"
CC: "sccache clang"
CXX: "sccache clang"

services:
redis:
Expand Down Expand Up @@ -60,6 +66,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Set up Rust toolchain
run: |
rustup toolchain add --profile minimal stable --component clippy,rustfmt
Expand Down Expand Up @@ -186,11 +195,23 @@ jobs:
env:
BUILD_MODE: debug
RUST_BACKTRACE: 1
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Set sccache-cache env vars (Windows)
run: |
echo RUSTC_WRAPPER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
echo CMAKE_C_COMPILER_LAUNCHER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
echo CMAKE_CXX_COMPILER_LAUNCHER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
- name: Free disk space (Windows)
run: |
rm -rf "/c/Program Files/dotnet"
Expand Down Expand Up @@ -288,11 +309,20 @@ jobs:
env:
BUILD_MODE: debug
RUST_BACKTRACE: 1
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1
RUSTC_WRAPPER: "sccache"
CC: "sccache clang"
CXX: "sccache clang"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Free disk space (macOS)
run: |
sudo rm -rf ~/Library/Caches/*
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ jobs:
python-version: ["3.11"]
name: build - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1
RUSTC_WRAPPER: "sccache"
CC: "sccache clang"
CXX: "sccache clang"
services:
redis:
image: redis
Expand Down Expand Up @@ -52,6 +59,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Set up Rust toolchain
run: |
rustup toolchain add --profile minimal stable --component clippy,rustfmt
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
shell: bash
name: test-pip-install - Python ${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1

steps:
- name: Free disk space (Ubuntu)
Expand Down Expand Up @@ -50,6 +54,23 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Set sccache-cache env vars (non-Windows)
if: runner.os != 'Windows'
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "CC=sccache clang" >> $GITHUB_ENV
echo "CXX=sccache clang" >> $GITHUB_ENV
- name: Set sccache-cache env vars (Windows)
if: runner.os == 'Windows'
run: |
echo RUSTC_WRAPPER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
echo CMAKE_C_COMPILER_LAUNCHER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
echo CMAKE_CXX_COMPILER_LAUNCHER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
- name: Set up Rust toolchain
run: |
rustup toolchain add --profile minimal stable --component clippy,rustfmt
Expand Down Expand Up @@ -81,6 +102,13 @@ jobs:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
env:
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1
RUSTC_WRAPPER: "sccache"
CC: "sccache clang"
CXX: "sccache clang"

steps:
- name: Free disk space (Ubuntu)
Expand All @@ -103,6 +131,9 @@ jobs:
with:
fetch-depth: 2

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Set up Rust toolchain
run: |
rustup toolchain add --profile minimal stable --component clippy,rustfmt
Expand Down Expand Up @@ -173,6 +204,12 @@ jobs:
runs-on: ubuntu-latest
env:
COPY_TO_SOURCE: false # Do not copy built *.so files back into source tree
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1
RUSTC_WRAPPER: "sccache"
CC: "sccache clang"
CXX: "sccache clang"

steps:
- name: Free disk space (Ubuntu)
Expand All @@ -192,6 +229,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Set up Rust toolchain
run: |
rustup toolchain add --profile minimal stable --component clippy,rustfmt
Expand Down Expand Up @@ -272,6 +312,9 @@ jobs:
runs-on: ${{ matrix.os }}
env:
BUILD_MODE: release
# https://github.com/Mozilla-Actions/sccache-action
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_MULTIARCH: 1

steps:
- name: Free disk space (Ubuntu)
Expand Down Expand Up @@ -299,6 +342,23 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Set sccache-cache env vars (non-Windows)
if: runner.os != 'Windows'
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "CC=sccache clang" >> $GITHUB_ENV
echo "CXX=sccache clang" >> $GITHUB_ENV
- name: Set sccache-cache env vars (Windows)
if: runner.os == 'Windows'
run: |
echo RUSTC_WRAPPER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
echo CMAKE_C_COMPILER_LAUNCHER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
echo CMAKE_CXX_COMPILER_LAUNCHER="${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
- name: Set up Rust toolchain
run: |
rustup toolchain add --profile minimal stable --component clippy,rustfmt
Expand Down

0 comments on commit aa03dfb

Please sign in to comment.