diff --git a/.github/actions/save-sccache/action.yml b/.github/actions/save-sccache/action.yml new file mode 100644 index 000000000..78038aae0 --- /dev/null +++ b/.github/actions/save-sccache/action.yml @@ -0,0 +1,38 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Save sccache +description: Show sccache stats and save the cache on main branch runs after setup-sccache. + +inputs: + key-prefix: + description: Cache key prefix without the run id or Windows compiler suffix. + required: true + +runs: + using: composite + steps: + - name: Show sccache stats + shell: bash + run: sccache --show-stats + + - name: Save sccache cache + if: ${{ github.ref == 'refs/heads/main' }} + uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ${{ github.workspace }}/.sccache + key: ${{ inputs.key-prefix }}${{ env.SCCACHE_KEY_SUFFIX }}-${{ github.run_id }} diff --git a/.github/actions/sccache/resolve-msvc-key-suffix.ps1 b/.github/actions/sccache/resolve-msvc-key-suffix.ps1 new file mode 100644 index 000000000..6e431a1f2 --- /dev/null +++ b/.github/actions/sccache/resolve-msvc-key-suffix.ps1 @@ -0,0 +1,43 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +$PSNativeCommandUseErrorActionPreference = $false + +$suffix = '-unknown' +$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' +if (Test-Path $vswhere) { + $installationPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | + Select-Object -First 1 + $installationPath = "$installationPath".Trim() + if ($installationPath) { + $toolsVersionFile = Join-Path $installationPath 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt' + if (Test-Path $toolsVersionFile) { + $toolsVersion = (Get-Content -Path $toolsVersionFile -Raw).Trim() + if ($toolsVersion) { + $suffix = "-$toolsVersion" + } + } + } +} + +if ($suffix -eq '-unknown') { + Write-Host "::warning::could not resolve MSVC toolset version for sccache key, using '$suffix'" +} + +Add-Content -Path $env:GITHUB_OUTPUT -Value "suffix=$suffix" +Add-Content -Path $env:GITHUB_ENV -Value "SCCACHE_KEY_SUFFIX=$suffix" +Write-Host "Resolved SCCACHE_KEY_SUFFIX=$suffix" diff --git a/.github/actions/setup-sccache/action.yml b/.github/actions/setup-sccache/action.yml new file mode 100644 index 000000000..f97c98aa4 --- /dev/null +++ b/.github/actions/setup-sccache/action.yml @@ -0,0 +1,57 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Set up sccache +description: Configure sccache, restore its cache, and start the sccache action. + +inputs: + key-prefix: + description: Cache key prefix without the run id or Windows compiler suffix. + required: true + cache-size: + description: Maximum sccache cache size. + required: false + default: 2G + +runs: + using: composite + steps: + - name: Configure sccache environment + shell: bash + run: | + echo "SCCACHE_DIR=${{ github.workspace }}/.sccache" >> "$GITHUB_ENV" + echo "SCCACHE_CACHE_SIZE=${{ inputs.cache-size }}" >> "$GITHUB_ENV" + echo "SCCACHE_KEY_SUFFIX=" >> "$GITHUB_ENV" + + # Windows caches include the MSVC toolset version because GitHub runner image + # rollouts can change the compiler while keeping the same image label. + - name: Resolve MSVC toolset version for sccache key + if: ${{ runner.os == 'Windows' }} + id: msvc-key + shell: pwsh + run: '& "${{ github.action_path }}/../sccache/resolve-msvc-key-suffix.ps1"' + + - name: Restore sccache cache + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ${{ github.workspace }}/.sccache + key: ${{ inputs.key-prefix }}${{ steps.msvc-key.outputs.suffix }}-${{ github.run_id }} + restore-keys: | + ${{ inputs.key-prefix }}${{ steps.msvc-key.outputs.suffix }}- + + - name: Setup sccache + uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 diff --git a/.github/workflows/aws_test.yml b/.github/workflows/aws_test.yml index cb486034b..951ba2658 100644 --- a/.github/workflows/aws_test.yml +++ b/.github/workflows/aws_test.yml @@ -74,8 +74,6 @@ jobs: AWS_DEFAULT_REGION: us-east-1 AWS_ENDPOINT_URL: http://127.0.0.1:9000 AWS_EC2_METADATA_DISABLED: "TRUE" - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -115,29 +113,19 @@ jobs: if: ${{ matrix.s3 == 'ON' }} shell: bash run: bash ci/scripts/start_minio.sh - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-aws-${{ matrix.runs-on }}-bundle${{ matrix.bundle_awssdk }}-s3${{ matrix.s3 }}-sigv4${{ matrix.sigv4 }}-${{ github.run_id }} - restore-keys: | - sccache-aws-${{ matrix.runs-on }}-bundle${{ matrix.bundle_awssdk }}-s3${{ matrix.s3 }}-sigv4${{ matrix.sigv4 }}- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-aws-${{ matrix.runs-on }}-bundle${{ matrix.bundle_awssdk }}-s3${{ matrix.s3 }}-sigv4${{ matrix.sigv4 }} - name: Build and test Iceberg shell: bash env: CMAKE_TOOLCHAIN_FILE: ${{ startsWith(matrix.runs-on, 'ubuntu') && matrix.bundle_awssdk == 'OFF' && '/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake' || '' }} run: ci/scripts/build_iceberg.sh "$(pwd)" OFF ON ${{ matrix.s3 }} ${{ matrix.sigv4 }} ${{ matrix.bundle_awssdk }} - - name: Show sccache stats - shell: bash - run: sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-aws-${{ matrix.runs-on }}-bundle${{ matrix.bundle_awssdk }}-s3${{ matrix.s3 }}-sigv4${{ matrix.sigv4 }}-${{ github.run_id }} + key-prefix: sccache-aws-${{ matrix.runs-on }}-bundle${{ matrix.bundle_awssdk }}-s3${{ matrix.s3 }}-sigv4${{ matrix.sigv4 }} # Exercise the Meson build with SigV4 enabled (resolves aws-cpp-sdk-core via # its CMake config, not pkg-config whose Cflags force -std=c++11). @@ -146,9 +134,6 @@ jobs: name: Meson SigV4 (AMD64 Ubuntu 26.04) runs-on: ubuntu-26.04 timeout-minutes: 45 - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" steps: - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: @@ -189,15 +174,10 @@ jobs: run: | echo "CC=sccache gcc-14" >> $GITHUB_ENV echo "CXX=sccache g++-14" >> $GITHUB_ENV - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-meson-sigv4-${{ github.run_id }} - restore-keys: | - sccache-meson-sigv4- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-meson-sigv4 - name: Build and test Iceberg shell: bash env: @@ -205,11 +185,8 @@ jobs: run: | meson setup builddir -Dsigv4=enabled meson compile -C builddir - sccache --show-stats meson test -C builddir --timeout-multiplier 0 --print-errorlogs - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-meson-sigv4-${{ github.run_id }} + key-prefix: sccache-meson-sigv4 diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 304d1a58b..597655e90 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -45,9 +45,6 @@ jobs: permissions: contents: read pull-requests: write - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -58,15 +55,10 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libcurl4-openssl-dev libsqlite3-dev libpq-dev default-libmysqlclient-dev - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-cpp-linter-ubuntu-${{ github.run_id }} - restore-keys: | - sccache-cpp-linter-ubuntu- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-cpp-linter-ubuntu - name: Run build env: CC: gcc-14 @@ -81,15 +73,10 @@ jobs: -DICEBERG_SQL_POSTGRESQL=ON \ -DICEBERG_SQL_MYSQL=ON cmake --build . - - name: Show sccache stats - shell: bash - run: sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-cpp-linter-ubuntu-${{ github.run_id }} + key-prefix: sccache-cpp-linter-ubuntu - uses: cpp-linter/cpp-linter-action@0f6d1b8d7e38b584cbee606eb23d850c217d54f8 # v2.15.1 id: linter if: github.event_name == 'pull_request' diff --git a/.github/workflows/sanitizer_test.yml b/.github/workflows/sanitizer_test.yml index 48eb57846..dbc4b3fb5 100644 --- a/.github/workflows/sanitizer_test.yml +++ b/.github/workflows/sanitizer_test.yml @@ -39,9 +39,6 @@ jobs: if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} name: "ASAN and UBSAN Tests" runs-on: ubuntu-26.04 - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -50,15 +47,10 @@ jobs: - name: Install dependencies shell: bash run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-sanitizer-ubuntu-${{ github.run_id }} - restore-keys: | - sccache-sanitizer-ubuntu- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-sanitizer-ubuntu - name: Configure and Build with ASAN & UBSAN env: CC: gcc-14 @@ -68,15 +60,10 @@ jobs: cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DICEBERG_ENABLE_ASAN=ON -DICEBERG_ENABLE_UBSAN=ON \ -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache cmake --build . --verbose - - name: Show sccache stats - shell: bash - run: sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-sanitizer-ubuntu-${{ github.run_id }} + key-prefix: sccache-sanitizer-ubuntu - name: Run Tests working-directory: build env: diff --git a/.github/workflows/sql_catalog_test.yml b/.github/workflows/sql_catalog_test.yml index 905b4a06c..08d61543e 100644 --- a/.github/workflows/sql_catalog_test.yml +++ b/.github/workflows/sql_catalog_test.yml @@ -61,9 +61,6 @@ jobs: runs-on: windows-2025 cmake_build_type: Release cmake_extra_args: -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -74,26 +71,6 @@ jobs: uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 with: arch: x64 - # GitHub patches the Windows image roughly weekly via gradual rollouts, so - # back-to-back runs can hit different cl.exe builds. sccache keys on the compiler, - # so a shared key would miss after each bump; the version keeps caches separate. - # Non-Windows legs get an empty suffix, leaving their keys unchanged. - - name: Resolve MSVC version for sccache key - if: ${{ startsWith(matrix.runs-on, 'windows') }} - shell: pwsh - run: | - $PSNativeCommandUseErrorActionPreference = $false - $banner = (cl.exe 2>&1 | Out-String) - if ($banner -match 'Version ([\d.]+)') { - $suffix = "-$($Matches[1])" - } else { - # The key is only a cache hint, so degrade to a shared bucket rather than - # fail the build; the warning flags that the parse needs fixing. - $suffix = '-unknown' - Write-Host "::warning::could not parse cl.exe version for sccache key, using '$suffix'; banner was: $banner" - } - Add-Content -Path $env:GITHUB_ENV -Value "SCCACHE_KEY_SUFFIX=$suffix" - Write-Host "SCCACHE_KEY_SUFFIX=$suffix" - name: Install dependencies on Ubuntu if: ${{ startsWith(matrix.runs-on, 'ubuntu') }} shell: bash @@ -115,15 +92,10 @@ jobs: shell: pwsh run: | vcpkg install zlib:x64-windows nlohmann-json:x64-windows nanoarrow:x64-windows roaring:x64-windows sqlite3:x64-windows - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-sqlcatalog-${{ matrix.runs-on }}${{ env.SCCACHE_KEY_SUFFIX }}-${{ github.run_id }} - restore-keys: | - sccache-sqlcatalog-${{ matrix.runs-on }}${{ env.SCCACHE_KEY_SUFFIX }}- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-sqlcatalog-${{ matrix.runs-on }} - name: Configure Iceberg shell: bash run: | @@ -141,15 +113,10 @@ jobs: - name: Build SQL catalog tests shell: bash run: cmake --build build --target sql_catalog_test - - name: Show sccache stats - shell: bash - run: sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-sqlcatalog-${{ matrix.runs-on }}${{ env.SCCACHE_KEY_SUFFIX }}-${{ github.run_id }} + key-prefix: sccache-sqlcatalog-${{ matrix.runs-on }} - name: Run SQL catalog tests shell: bash run: ctest --test-dir build -R '^sql_catalog_test$' --output-on-failure -C ${{ matrix.cmake_build_type }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 23fcc2d1c..6713fd763 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,9 +45,6 @@ jobs: timeout-minutes: 30 strategy: fail-fast: false - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -56,30 +53,20 @@ jobs: - name: Install dependencies shell: bash run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-test-ubuntu-${{ github.run_id }} - restore-keys: | - sccache-test-ubuntu- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-test-ubuntu - name: Build Iceberg shell: bash env: CC: gcc-14 CXX: g++-14 run: ci/scripts/build_iceberg.sh $(pwd) ON ON - - name: Show sccache stats - shell: bash - run: sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-test-ubuntu-${{ github.run_id }} + key-prefix: sccache-test-ubuntu - name: Build Example shell: bash env: @@ -93,35 +80,22 @@ jobs: timeout-minutes: 30 strategy: fail-fast: false - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-test-macos-${{ github.run_id }} - restore-keys: | - sccache-test-macos- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-test-macos - name: Build Iceberg shell: bash run: ci/scripts/build_iceberg.sh $(pwd) OFF ON - - name: Show sccache stats - shell: bash - run: sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-test-macos-${{ github.run_id }} + key-prefix: sccache-test-macos - name: Build Example shell: bash run: ci/scripts/build_example.sh $(pwd)/example @@ -132,9 +106,6 @@ jobs: timeout-minutes: 60 strategy: fail-fast: false - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -144,24 +115,6 @@ jobs: uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 with: arch: x64 - # GitHub patches the Windows image roughly weekly via gradual rollouts, so - # back-to-back runs can hit different cl.exe builds. sccache keys on the compiler, - # so a shared key would miss after each bump; the version keeps caches separate. - - name: Resolve MSVC version for sccache key - shell: pwsh - run: | - $PSNativeCommandUseErrorActionPreference = $false - $banner = (cl.exe 2>&1 | Out-String) - if ($banner -match 'Version ([\d.]+)') { - $msvc = $Matches[1] - } else { - # The key is only a cache hint, so degrade to a shared bucket rather than - # fail the build; the warning flags that the parse needs fixing. - $msvc = 'unknown' - Write-Host "::warning::could not parse cl.exe version for sccache key, using '$msvc'; banner was: $banner" - } - Add-Content -Path $env:GITHUB_ENV -Value "MSVC_VER=$msvc" - Write-Host "Resolved MSVC_VER=$msvc" - name: Cache vcpkg packages uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 id: vcpkg-cache @@ -173,28 +126,20 @@ jobs: shell: pwsh run: | vcpkg install zlib:x64-windows nlohmann-json:x64-windows nanoarrow:x64-windows roaring:x64-windows cpr:x64-windows - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-test-windows-${{ env.MSVC_VER }}-${{ github.run_id }} - restore-keys: | - sccache-test-windows-${{ env.MSVC_VER }}- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-test-windows - name: Build Iceberg shell: pwsh run: | $ErrorActionPreference = "Stop" bash -lc 'ci/scripts/build_iceberg.sh $(pwd) OFF ON' if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-test-windows-${{ env.MSVC_VER }}-${{ github.run_id }} + key-prefix: sccache-test-windows - name: Build Example shell: pwsh run: | @@ -205,9 +150,6 @@ jobs: name: Meson - ${{ matrix.title }} runs-on: ${{ matrix.runs-on }} timeout-minutes: 30 - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" strategy: max-parallel: 15 fail-fast: false @@ -243,27 +185,18 @@ jobs: run: | echo "CC=sccache ${{ matrix.CC }}" >> $GITHUB_ENV echo "CXX=sccache ${{ matrix.CXX }}" >> $GITHUB_ENV - - name: Restore sccache cache - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Set up sccache + uses: ./.github/actions/setup-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-meson-${{ matrix.runs-on }}-${{ github.run_id }} - restore-keys: | - sccache-meson-${{ matrix.runs-on }}- - - name: Setup sccache - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + key-prefix: sccache-meson-${{ matrix.runs-on }} - name: Build Iceberg run: | meson setup builddir ${{ matrix.meson-setup-args || '' }} meson compile -C builddir - - name: Show sccache stats - run: sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - name: Save sccache + uses: ./.github/actions/save-sccache with: - path: ${{ github.workspace }}/.sccache - key: sccache-meson-${{ matrix.runs-on }}-${{ github.run_id }} + key-prefix: sccache-meson-${{ matrix.runs-on }} - name: Test Iceberg run: | meson test -C builddir --timeout-multiplier 0 --print-errorlogs