Skip to content

Commit d954c42

Browse files
authored
Use more caching to reduce CI times for Mac and Linux (#252)
* Try caching ICU build prefix to speed up CI times * Don't bother with Linux ICU cache The Linux build spends most of its time installng packages with apt not building ICU * Reduce ICU cache size by not including src dir * Try caching linux apt packages * Find cached ICU correctly * Use specific version of cache-apt-packages-action * Format CMakeLists.txt * Fix checking of find_library vars * Empty commit to check improved build times after caching * Add qt base dev packages to cached CI packages
1 parent c268af7 commit d954c42

4 files changed

Lines changed: 61 additions & 21 deletions

File tree

.github/scripts/utils.zsh/setup_linux

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ if (( ! ${+target} )) {
1212

1313
pushd ${project_root}
1414

15-
typeset -g QT_VERSION
16-
1715
local -a apt_args=(
1816
${CI:+-y}
1917
--no-install-recommends
@@ -45,20 +43,11 @@ if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
4543

4644
local -a _qt_packages=()
4745

48-
if (( QT_VERSION == 5 )) {
49-
_qt_packages+=(
50-
qtbase5-dev${suffix}
51-
libqt5svg5-dev${suffix}
52-
qtbase5-private-dev${suffix}
53-
libqt5x11extras5-dev${suffix}
54-
)
55-
} else {
56-
_qt_packages+=(
57-
qt6-base-dev${suffix}
58-
libqt6svg6-dev${suffix}
59-
qt6-base-private-dev${suffix}
60-
)
61-
}
46+
_qt_packages+=(
47+
qt6-base-dev${suffix}
48+
libqt6svg6-dev${suffix}
49+
qt6-base-private-dev${suffix}
50+
)
6251

6352
sudo apt-get install ${apt_args} ${_qt_packages}
6453
log_group

.github/workflows/build-project.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,20 @@ jobs:
120120
restore-keys: |
121121
${{ runner.os }}-ccache-${{ matrix.architecture }}-
122122
123+
- uses: actions/cache@v4
124+
id: icu-cache
125+
with:
126+
path: |
127+
${{ github.workspace }}/build_macos/ICU_build-prefix/bin
128+
${{ github.workspace }}/build_macos/ICU_build-prefix/include
129+
${{ github.workspace }}/build_macos/ICU_build-prefix/lib
130+
${{ github.workspace }}/build_macos/ICU_build-prefix/sbin
131+
${{ github.workspace }}/build_macos/ICU_build-prefix/share
132+
${{ github.workspace }}/build_macos/ICU_build-prefix/tmp
133+
key: ${{ runner.os }}-icu-build-${{ needs.check-event.outputs.config }}-${{ matrix.architecture }}
134+
restore-keys: |
135+
${{ runner.os }}-icu-build-${{ matrix.architecture }}-
136+
123137
- uses: actions-rust-lang/setup-rust-toolchain@v1
124138
if: matrix.architecture == 'arm64'
125139
with:
@@ -153,6 +167,7 @@ jobs:
153167
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
154168
env:
155169
MACOS_ARCH: ${{ matrix.architecture }}
170+
GITHUB_WORKSPACE: ${{ github.workspace }}
156171

157172
- name: Package Plugin 📀
158173
uses: ./.github/actions/package-plugin
@@ -196,6 +211,25 @@ jobs:
196211
submodules: recursive
197212
fetch-depth: 0
198213

214+
- uses: awalsh128/cache-apt-pkgs-action@v1.6.0
215+
with:
216+
packages: |
217+
ccache
218+
libcurl4-openssl-dev
219+
libicu-dev
220+
libgles2-mesa-dev
221+
libopenblas-dev
222+
libopenblas-openmp-dev
223+
libqt6svg6-dev
224+
libsimde-dev
225+
libvulkan-dev
226+
obs-studio
227+
pkg-config
228+
qt6-base-dev
229+
qt6-base-private-dev
230+
add-repository: ppa:obsproject/obs-studio
231+
version: 1.0
232+
199233
- name: Set Up Environment 🔧
200234
id: setup
201235
run: |

CMakeLists.txt

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,26 @@ if(USE_SYSTEM_ICU)
116116
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE "${ICU_LIBRARIES}")
117117
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM PUBLIC "${ICU_INCLUDE_DIRS}")
118118
else()
119-
include(cmake/BuildICU.cmake)
120-
# Add ICU to the target
121-
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ICU)
122-
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM PUBLIC ${ICU_INCLUDE_DIR})
119+
find_library(ICU_DATA_LIB icudata OPTIONAL)
120+
find_library(ICU_UC_LIB icuuc OPTIONAL)
121+
find_library(ICU_I18N_LIB icui18n OPTIONAL)
122+
123+
if(ICU_DATA_LIB
124+
AND ICU_UC_LIB
125+
AND ICU_I18N_LIB)
126+
list(APPEND ICU_LIBRARIES ${ICU_DATA_LIB} ${ICU_UC_LIB} ${ICU_I18N_LIB})
127+
message(STATUS "Cached ICU libs: " ${ICU_LIBRARIES})
128+
set(ICU_INCLUDE_DIR "${CMAKE_BINARY_DIR}/ICU_build-prefix/include")
129+
message(STATUS "Cached ICU include dir: " ${ICU_INCLUDE_DIR})
130+
131+
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE "${ICU_LIBRARIES}")
132+
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM PUBLIC ${ICU_INCLUDE_DIR})
133+
else()
134+
include(cmake/BuildICU.cmake)
135+
# Add ICU to the target
136+
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ICU)
137+
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM PUBLIC ${ICU_INCLUDE_DIR})
138+
endif()
123139
endif()
124140

125141
# check env var for extra verbose logging

CMakePresets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"description": "Build for macOS 12.0+ (Universal binary) for CI",
4141
"generator": "Xcode",
4242
"cacheVariables": {
43-
"CMAKE_COMPILE_WARNING_AS_ERROR": true
43+
"CMAKE_COMPILE_WARNING_AS_ERROR": true,
44+
"CMAKE_PREFIX_PATH": "$penv{GITHUB_WORKSPACE}/build_macos/ICU_build-prefix"
4445
}
4546
},
4647
{

0 commit comments

Comments
 (0)