Truly independent web browser
CI: Cache Rust compiles with sccache, as ccache caches C++ compiles
sideshowbarker2945c8316f73
diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.ymlindex 8fee73b8954..e0bb94a59c5 100644--- a/.github/actions/build/action.yml+++ b/.github/actions/build/action.yml@@ -106,6 +106,7 @@ runs:toolchain: ${{ inputs.toolchain }}cache_key_extra: ${{ inputs.os == 'Windows' && inputs.build_preset || steps.build-parameters.outputs.ccache_key }}ccache_path: ${{ steps.setup.outputs.ccache_path }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}- name: Cache the WebAssembly spec test suite@@ -182,5 +183,7 @@ runs:arch: ${{ inputs.arch }}ccache_path: ${{ steps.setup.outputs.ccache_path }}ccache_primary_key: ${{ steps.cache-restore.outputs.ccache_primary_key }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}+ sccache_primary_key: ${{ steps.cache-restore.outputs.sccache_primary_key }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}vcpkg_cache_primary_key: ${{ steps.cache-restore.outputs.vcpkg_cache_primary_key }}diff --git a/.github/actions/cache-restore/action.yml b/.github/actions/cache-restore/action.ymlindex 5a7a6006341..8b39023d95b 100644--- a/.github/actions/cache-restore/action.yml+++ b/.github/actions/cache-restore/action.yml@@ -18,6 +18,9 @@ inputs:ccache_path:description: 'Path to the ccache directory'required: true+ sccache_path:+ description: 'Path to the sccache directory'+ required: truevcpkg_cache_path:description: 'Path to vcpkg binary cache'required: true@@ -26,6 +29,9 @@ outputs:ccache_primary_key:description: 'Primary ccache key'value: ${{ steps.ccache.outputs.cache-primary-key }}+ sccache_primary_key:+ description: 'Primary sccache key'+ value: ${{ steps.sccache.outputs.cache-primary-key }}vcpkg_cache_primary_key:description: 'Primary vcpkg binary cache key, or empty if the cache was restored from an exact key match'value: ${{ steps.vcpkg.outputs.cache-hit != 'true' && steps.vcpkg.outputs.cache-primary-key || '' }}@@ -79,6 +85,15 @@ runs:ccache -sccache -z+ - name: 'Rust Compiler Cache'+ uses: actions/cache/restore@v6+ id: 'sccache'+ with:+ path: ${{ inputs.sccache_path }}+ key: sccache | ${{ inputs.os }} | ${{ inputs.arch }} | ${{ inputs.toolchain }} | ${{ inputs.cache_key_extra }} | ${{ steps.date-stamp.outputs.timestamp }}+ restore-keys: |+ sccache | ${{ inputs.os }} | ${{ inputs.arch }} | ${{ inputs.toolchain }} | ${{ inputs.cache_key_extra }}+- name: 'Restore vcpkg cache'uses: actions/cache/restore@v6id: 'vcpkg'diff --git a/.github/actions/cache-save/action.yml b/.github/actions/cache-save/action.ymlindex ef8e1c44728..25f6c6f5dc9 100644--- a/.github/actions/cache-save/action.yml+++ b/.github/actions/cache-save/action.yml@@ -12,6 +12,12 @@ inputs:ccache_primary_key:description: 'Primary ccache key'required: true+ sccache_path:+ description: 'Path to the sccache directory'+ required: true+ sccache_primary_key:+ description: 'Primary sccache key'+ required: truevcpkg_cache_path:description: 'Path to the vcpkg binary cache directory'required: true@@ -42,6 +48,19 @@ runs:run: |ccache -s+ # Stopping the server gives its in-flight requests up to 10 seconds to finish, and prints the stats for the job's+ # Rust compiles. It isn't running if nothing invoked it, or on Windows, where it doesn't outlive the build step.+ - name: 'Stop the Rust compiler cache server'+ shell: bash+ run: |+ sccache --stop-server || true++ - name: 'Rust Compiler Cache'+ uses: actions/cache/save@v6+ with:+ path: ${{ inputs.sccache_path }}+ key: ${{ inputs.sccache_primary_key }}+- name: 'vcpkg binary cache'if: ${{ inputs.vcpkg_cache_primary_key != '' }}uses: actions/cache/save@v6diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.ymlindex 89371e7811f..b4180c3f4f6 100644--- a/.github/actions/setup/action.yml+++ b/.github/actions/setup/action.yml@@ -26,6 +26,9 @@ outputs:ccache_path:description: 'Path to the ccache directory'value: ${{ steps.workspace.outputs.ccache_path }}+ sccache_path:+ description: 'Path to the sccache directory'+ value: ${{ steps.workspace.outputs.sccache_path }}vcpkg_cache_path:description: 'Path to the vcpkg binary cache'value: ${{ steps.workspace.outputs.vcpkg_cache_path }}@@ -40,6 +43,10 @@ runs:echo "LADYBIRD_SOURCE_DIR=${GITHUB_WORKSPACE}" >> "$GITHUB_ENV"echo "CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache" >> "$GITHUB_ENV"echo "ccache_path=${GITHUB_WORKSPACE}/.ccache" >> "$GITHUB_OUTPUT"+ echo "SCCACHE_DIR=${GITHUB_WORKSPACE}/.sccache" >> "$GITHUB_ENV"+ echo "SCCACHE_CACHE_SIZE=2G" >> "$GITHUB_ENV"+ echo "SCCACHE_IDLE_TIMEOUT=0" >> "$GITHUB_ENV"+ echo "sccache_path=${GITHUB_WORKSPACE}/.sccache" >> "$GITHUB_OUTPUT"echo "vcpkg_cache_path=${GITHUB_WORKSPACE}/Build/caches/vcpkg-binary-cache" >> "$GITHUB_OUTPUT"echo "GIT_CONFIG_GLOBAL=${RUNNER_TEMP}/gitconfig" >> "$GITHUB_ENV"git config --file "${RUNNER_TEMP}/gitconfig" --add safe.directory "${GITHUB_WORKSPACE}"@@ -211,6 +218,73 @@ runs:shell: bashrun: echo "${GITHUB_WORKSPACE}/wasm-tools" >> "$GITHUB_PATH"+ # The build uses sccache as the rustc wrapper whenever it finds sccache on the PATH, so that our Rust code gets the+ # same compile caching as ccache gives our C++ code.+ - name: 'Resolve sccache release'+ id: 'sccache'+ if: ${{ inputs.type == 'build' }}+ shell: bash+ run: |+ VERSION=0.18.0+ if ${{ runner.arch == 'ARM64' }} ; then+ ARCH=aarch64+ else+ ARCH=x86_64+ fi+ case "${{ runner.os }}" in+ Linux) TRIPLE="${ARCH}-unknown-linux-musl" ;;+ macOS) TRIPLE="${ARCH}-apple-darwin" ;;+ Windows) TRIPLE="${ARCH}-pc-windows-msvc" ;;+ esac+ NAME="sccache-v${VERSION}-${TRIPLE}"+ echo "version=${VERSION}" >> "$GITHUB_OUTPUT"+ echo "name=${NAME}" >> "$GITHUB_OUTPUT"++ - name: 'Restore sccache'+ id: 'sccache-cache'+ if: ${{ inputs.type == 'build' }}+ uses: actions/cache/restore@v6+ with:+ path: ${{ github.workspace }}/sccache+ key: ${{ steps.sccache.outputs.name }}++ - name: 'Install sccache'+ if: ${{ inputs.type == 'build' && steps.sccache-cache.outputs.cache-hit != 'true' }}+ shell: bash+ run: |+ FILENAME="${{ steps.sccache.outputs.name }}.tar.gz"+ URL="https://github.com/mozilla/sccache/releases/download/v${{ steps.sccache.outputs.version }}/${FILENAME}"++ delays=(5 15 45)+ attempt=1+ until curl --fail --location --output "${FILENAME}" "${URL}"; do+ if (( attempt > ${#delays[@]} )); then+ echo "sccache download failed after $(( ${#delays[@]} + 1 )) attempts" >&2+ exit 1+ fi+ echo "sccache download failed; retrying in ${delays[attempt-1]}s" >&2+ sleep "${delays[attempt-1]}"+ attempt=$(( attempt + 1 ))+ done++ tar -xzf "${FILENAME}"+ rm "${FILENAME}"+ mv "${{ steps.sccache.outputs.name }}" sccache++ # Saved right after the install rather than by actions/cache's post-job step, which runs only if the whole job+ # succeeds — so a flaky test would keep the cache from ever being saved.+ - name: 'Save sccache'+ if: ${{ inputs.type == 'build' && steps.sccache-cache.outputs.cache-hit != 'true' }}+ uses: actions/cache/save@v6+ with:+ path: ${{ github.workspace }}/sccache+ key: ${{ steps.sccache-cache.outputs.cache-primary-key }}++ - name: 'Add sccache to PATH'+ if: ${{ inputs.type == 'build' }}+ shell: bash+ run: echo "${GITHUB_WORKSPACE}/sccache" >> "$GITHUB_PATH"+- name: 'Restore cargo registry'id: 'cargo-registry'uses: actions/cache/restore@v6diff --git a/.github/workflows/js-and-wasm-artifacts.yml b/.github/workflows/js-and-wasm-artifacts.ymlindex 63de3dd171a..43bfa07c6d8 100644--- a/.github/workflows/js-and-wasm-artifacts.yml+++ b/.github/workflows/js-and-wasm-artifacts.yml@@ -82,6 +82,7 @@ jobs:toolchain: ${{ matrix.toolchain }}cache_key_extra: 'LibJS and LibWasm Artifacts'ccache_path: ${{ steps.setup.outputs.ccache_path }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}- name: Create build directory Ubuntu@@ -136,6 +137,8 @@ jobs:arch: 'Lagom'ccache_path: ${{ steps.setup.outputs.ccache_path }}ccache_primary_key: ${{ steps.cache-restore.outputs.ccache_primary_key }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}+ sccache_primary_key: ${{ steps.cache-restore.outputs.sccache_primary_key }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}vcpkg_cache_primary_key: ${{ steps.cache-restore.outputs.vcpkg_cache_primary_key }}diff --git a/.github/workflows/libjs-test262.yml b/.github/workflows/libjs-test262.ymlindex 0b3fbe44d5a..a6716ff0440 100644--- a/.github/workflows/libjs-test262.yml+++ b/.github/workflows/libjs-test262.yml@@ -72,6 +72,7 @@ jobs:toolchain: 'Clang'cache_key_extra: 'test262'ccache_path: ${{ steps.setup.outputs.ccache_path }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}- name: Get previous results@@ -98,6 +99,8 @@ jobs:arch: 'x86_64'ccache_path: ${{ steps.setup.outputs.ccache_path }}ccache_primary_key: ${{ steps.cache-restore.outputs.ccache_primary_key }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}+ sccache_primary_key: ${{ steps.cache-restore.outputs.sccache_primary_key }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}vcpkg_cache_primary_key: ${{ steps.cache-restore.outputs.vcpkg_cache_primary_key }}diff --git a/.github/workflows/nightly-android.yml b/.github/workflows/nightly-android.ymlindex 07b31951150..d4a7304f2b7 100644--- a/.github/workflows/nightly-android.yml+++ b/.github/workflows/nightly-android.yml@@ -56,6 +56,7 @@ jobs:toolchain: 'Clang'cache_key_extra: 'Nightly Android'ccache_path: ${{ steps.setup.outputs.ccache_path }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}- name: Assign Build Parameters@@ -104,5 +105,7 @@ jobs:arch: 'Lagom'ccache_path: ${{ steps.setup.outputs.ccache_path }}ccache_primary_key: ${{ steps.cache-restore.outputs.ccache_primary_key }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}+ sccache_primary_key: ${{ steps.cache-restore.outputs.sccache_primary_key }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}vcpkg_cache_primary_key: ${{ steps.cache-restore.outputs.vcpkg_cache_primary_key }}diff --git a/.github/workflows/web-benchmarks.yml b/.github/workflows/web-benchmarks.ymlindex 2e1914e50a4..eaa218f9ec1 100644--- a/.github/workflows/web-benchmarks.yml+++ b/.github/workflows/web-benchmarks.yml@@ -77,6 +77,7 @@ jobs:toolchain: 'Clang'cache_key_extra: 'Distribution'ccache_path: ${{ steps.setup.outputs.ccache_path }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}- name: 'Assign Build Parameters'@@ -110,6 +111,8 @@ jobs:arch: ${{ matrix.arch }}ccache_path: ${{ steps.setup.outputs.ccache_path }}ccache_primary_key: ${{ steps.cache-restore.outputs.ccache_primary_key }}+ sccache_path: ${{ steps.setup.outputs.sccache_path }}+ sccache_primary_key: ${{ steps.cache-restore.outputs.sccache_primary_key }}vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}vcpkg_cache_primary_key: ${{ steps.cache-restore.outputs.vcpkg_cache_primary_key }}