Skip to content

Commit 646a26c

Browse files
committed
chore: optimize windows ci
1 parent e2cf82f commit 646a26c

File tree

4 files changed

+54
-4
lines changed

4 files changed

+54
-4
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ jobs:
7777
shell: bash
7878
run: ci/scripts/build_example.sh $(pwd)/example
7979
windows:
80-
name: AMD64 Windows 2022
81-
runs-on: windows-2022
82-
timeout-minutes: 30
80+
name: AMD64 Windows 2025
81+
runs-on: windows-2025
82+
timeout-minutes: 60
8383
strategy:
8484
fail-fast: false
8585
steps:
@@ -89,11 +89,18 @@ jobs:
8989
shell: cmd
9090
run: |
9191
vcpkg install zlib:x64-windows nlohmann-json:x64-windows nanoarrow:x64-windows roaring:x64-windows cpr:x64-windows
92+
- name: Setup sccache
93+
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
94+
with:
95+
disable_annotations: true
9296
- name: Build Iceberg
9397
shell: cmd
98+
env:
99+
SCCACHE_GHA_ENABLED: "true"
94100
run: |
95101
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
96-
bash -c "ci/scripts/build_iceberg.sh $(pwd)"
102+
bash -c "ci/scripts/build_iceberg.sh $(pwd) OFF ON"
103+
sccache --show-stats
97104
- name: Build Example
98105
shell: cmd
99106
run: |

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ endif()
6969
include(CMakeParseArguments)
7070
include(IcebergBuildUtils)
7171
include(IcebergSanitizer)
72+
include(IcebergSccache)
7273
include(IcebergThirdpartyToolchain)
7374

7475
if(ICEBERG_BUILD_TESTS)

ci/scripts/build_iceberg.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set -eux
2222
source_dir=${1}
2323
build_dir=${1}/build
2424
build_rest_integration_test=${2:-OFF}
25+
build_enable_sccache=${3:-OFF}
2526

2627
mkdir ${build_dir}
2728
pushd ${build_dir}
@@ -45,6 +46,11 @@ else
4546
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Debug")
4647
fi
4748

49+
if [[ "${build_enable_sccache}" == "ON" ]]; then
50+
CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER_LAUNCHER=sccache")
51+
CMAKE_ARGS+=("-DCMAKE_C_COMPILER_LAUNCHER=sccache")
52+
fi
53+
4854
cmake "${CMAKE_ARGS[@]}" ${source_dir}
4955
if is_windows; then
5056
cmake --build . --config Release --target install

cmake_modules/IcebergSccache.cmake

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
if(MSVC_TOOLCHAIN AND "${CMAKE_CXX_COMPILER_LAUNCHER}" STREQUAL "sccache")
19+
message(STATUS "Configuring sccache for MSVC")
20+
21+
# Remove /Zi or /ZI
22+
string(REGEX REPLACE "/Z[iI]" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
23+
string(REGEX REPLACE "/Z[iI]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
24+
25+
string(REGEX REPLACE "/Z[iI]" "" CMAKE_C_FLAGS_RELWITHDEBINFO
26+
"${CMAKE_C_FLAGS_RELWITHDEBINFO}")
27+
string(REGEX REPLACE "/Z[iI]" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO
28+
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
29+
30+
# Add /Z7
31+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Z7")
32+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7")
33+
34+
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /Z7")
35+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Z7")
36+
endif()

0 commit comments

Comments
 (0)