Skip to content

Commit 6b04d77

Browse files
committed
GH-50170: [CI][Packaging][Linux] Fix cache
1 parent a81e6c6 commit 6b04d77

11 files changed

Lines changed: 46 additions & 20 deletions

File tree

.github/workflows/package_linux.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ jobs:
7676

7777
package:
7878
permissions:
79-
# Upload to GitHub Release
79+
# Upload artifacts to GitHub Release
8080
contents: write
81+
# Upload cached Docker images to GitHub Packages
82+
packages: write
8183
name: ${{ matrix.id }}
8284
runs-on: ${{ contains(matrix.id, 'amd64') && 'ubuntu-latest' || 'ubuntu-24.04-arm' }}
8385
needs: check-labels
@@ -186,12 +188,11 @@ jobs:
186188
version="${GITHUB_REF_NAME#apache-arrow-}"
187189
echo "ARROW_VERSION=${version}" >> "${GITHUB_ENV}"
188190
fi
189-
- name: Cache ccache
190-
uses: actions/cache@v5
191+
- name: Restore ccache
192+
uses: apache/infrastructure-actions/stash/restore@0ba14156c9f4c3cfbe4b0c9f36339ab0f8d81e53
191193
with:
192-
path: ${{ env.BUILD_DIR }}/ccache
193-
key: package-linux-${{ matrix.id }}-${{ hashFiles('cpp/**', 'c_glib/**') }}
194-
restore-keys: package-linux-${{ matrix.id }}-
194+
path: ${{ env.BUILD_DIR }}
195+
key: package-linux-${{ matrix.id }}
195196
- name: Install dependencies
196197
run: |
197198
sudo apt update
@@ -249,16 +250,25 @@ jobs:
249250
env:
250251
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
251252
run: |
252-
rake -C dev/tasks/linux-packages docker:pull || :
253+
rake -C dev/tasks/linux-packages/apache-arrow docker:pull:${TARGET} || :
253254
rake -C dev/tasks/linux-packages ${TASK_NAMESPACE}:build
255+
- name: Save ccache
256+
if: >-
257+
!cancelled()
258+
continue-on-error: true
259+
uses: apache/infrastructure-actions/stash/save@0ba14156c9f4c3cfbe4b0c9f36339ab0f8d81e53
260+
with:
261+
path: ${{ env.BUILD_DIR }}
262+
key: package-linux-${{ matrix.id }}
263+
include-hidden-files: true
254264
- name: Docker Push
255265
continue-on-error: true
256266
if: >-
257267
success() &&
258268
github.event_name == 'push' &&
259269
github.ref_name == 'main'
260270
run: |
261-
rake -C dev/tasks/linux-packages docker:push
271+
rake -C dev/tasks/linux-packages/apache-arrow docker:push:${TARGET}
262272
- name: Build artifact tarball
263273
run: |
264274
mkdir -p "${DISTRIBUTION}"
@@ -339,7 +349,6 @@ jobs:
339349
env:
340350
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
341351
run: |
342-
rake -C dev/tasks/linux-packages docker:pull || :
343352
# Validate reproducibility. Reprotest runs the build twice
344353
# inside its own tempdir and doesn't copy artifacts back,
345354
# so this is purely a verification step.

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,6 +2791,7 @@ function(build_rapidjson)
27912791
URL ${RAPIDJSON_SOURCE_URL}
27922792
URL_HASH "SHA256=${ARROW_RAPIDJSON_BUILD_SHA256_CHECKSUM}")
27932793
prepare_fetchcontent()
2794+
set(CCACHE_FOUND OFF)
27942795
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
27952796
set(RAPIDJSON_BUILD_DOC OFF)
27962797
set(RAPIDJSON_BUILD_EXAMPLES OFF)

dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ RUN \
3838
apt update ${quiet} && \
3939
apt install -y -V ${quiet} \
4040
build-essential \
41+
ccache \
4142
clang \
4243
cmake \
4344
debhelper \

dev/tasks/linux-packages/apache-arrow/apt/debian-forky/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ RUN \
3939
apt install -y -V ${quiet} \
4040
base-files \
4141
build-essential \
42+
ccache \
4243
clang \
4344
cmake \
4445
debhelper \

dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ RUN \
3232
apt update ${quiet} && \
3333
apt install -y -V ${quiet} \
3434
build-essential \
35+
ccache \
3536
clang \
3637
cmake \
3738
curl \

dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ RUN \
3232
apt update ${quiet} && \
3333
apt install -y -V ${quiet} \
3434
build-essential \
35+
ccache \
3536
clang \
3637
clang-tools \
3738
cmake \

dev/tasks/linux-packages/apache-arrow/apt/ubuntu-resolute/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ RUN \
3232
apt update ${quiet} && \
3333
apt install -y -V ${quiet} \
3434
build-essential \
35+
ccache \
3536
clang \
3637
clang-tools \
3738
cmake \

dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ ARG DEBUG
2323
RUN \
2424
quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \
2525
dnf update -y ${quiet} && \
26+
dnf install -y ${quiet} spal-release && \
2627
dnf install -y ${quiet} \
2728
bison \
2829
boost-devel \
2930
brotli-devel \
3031
bzip2-devel \
3132
c-ares-devel \
33+
ccache \
3234
clang \
3335
cmake \
3436
curl-devel \

dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
%if %{_rhel} >= 9 || %{_amzn} >= 2023
3838
%define arrow_cmake_builddir %{__cmake_builddir}
3939
%define arrow_cmake %cmake
40-
%define arrow_cmake_build make -C %{arrow_cmake_builddir} %{?_smp_mflags}
40+
%define arrow_cmake_build cmake --build %{arrow_cmake_builddir}
4141
%define arrow_cmake_install %cmake_install
4242
%else
4343
%define arrow_cmake_builddir build
4444
%define arrow_cmake %cmake3 -S . -B %{arrow_cmake_builddir}
45-
%define arrow_cmake_build make -C %{arrow_cmake_builddir} %{?_smp_mflags}
46-
%define arrow_cmake_install DESTDIR="%{buildroot}" make -C %{arrow_cmake_builddir} install
45+
%define arrow_cmake_build cmake --build %{arrow_cmake_builddir}
46+
%define arrow_cmake_install DESTDIR="%{buildroot}" cmake --install %{arrow_cmake_builddir}
4747
%endif
4848

4949
%define use_bundled_absl (%{_rhel} < 10)
@@ -131,6 +131,11 @@ Apache Arrow is a data processing library for analysis.
131131

132132
%build
133133
cpp_build_type=release
134+
if [ -n "${X_SCLS:-}" ]; then
135+
ARROW_USE_CCACHE=ON
136+
else
137+
ARROW_USE_CCACHE=OFF
138+
fi
134139
cd cpp
135140
%arrow_cmake \
136141
-DARROW_AZURE=ON \
@@ -154,7 +159,7 @@ cd cpp
154159
%if %{use_s3}
155160
-DARROW_S3=ON \
156161
%endif
157-
-DARROW_USE_CCACHE=OFF \
162+
-DARROW_USE_CCACHE=${ARROW_USE_CCACHE} \
158163
-DARROW_WITH_BROTLI=ON \
159164
-DARROW_WITH_BZ2=ON \
160165
-DARROW_WITH_LZ4=ON \
@@ -170,7 +175,7 @@ cd cpp
170175
%if %{use_bundled_nlohmann_json}
171176
-Dnlohmann_json_SOURCE=BUNDLED \
172177
%endif
173-
-G"Unix Makefiles"
178+
-GNinja
174179
%arrow_cmake_build
175180
cd -
176181

dev/tasks/linux-packages/apt/build.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,18 @@ find . -not -path ./ccache -a -not -path "./ccache/*" -delete
7171
if which ccache > /dev/null 2>&1; then
7272
export CCACHE_COMPILERCHECK=content
7373
export CCACHE_COMPRESS=1
74-
export CCACHE_COMPRESSLEVEL=6
7574
export CCACHE_DIR="${PWD}/ccache"
76-
export CCACHE_MAXSIZE=500M
75+
export CCACHE_LOGFILE="${PWD}/ccache.log"
76+
export CCACHE_MAXSIZE=3GiB
77+
rm -f "${CCACHE_LOGFILE}"
78+
ccache --zero-stats
7779
ccache --show-stats --verbose || :
7880
debuild_options+=(-eCCACHE_COMPILERCHECK)
7981
debuild_options+=(-eCCACHE_COMPRESS)
80-
debuild_options+=(-eCCACHE_COMPRESSLEVEL)
8182
debuild_options+=(-eCCACHE_DIR)
83+
debuild_options+=(-eCCACHE_LOGFILE)
8284
debuild_options+=(-eCCACHE_MAXSIZE)
83-
if [ -d /usr/lib/ccache ] ;then
85+
if [ -d /usr/lib/ccache ]; then
8486
debuild_options+=(--prepend-path=/usr/lib/ccache)
8587
fi
8688
fi

0 commit comments

Comments
 (0)