Skip to content

Commit 843a00d

Browse files
Merge #6421: ci: merge bitcoin#30451, add macOS builds to GitHub Actions, refactor cache keys
106500c ci: add x86_64 macOS cross-compilation build to GitHub Actions (Kittywhiskers Van Gogh) 56d8a8e ci: add SDK (extracted) sources to separate SDK cache (Kittywhiskers Van Gogh) 9841155 ci: cleanup restore keys (Kittywhiskers Van Gogh) 2f28f3e ci: replace `runner.os` with adding CI `Dockerfile` to `hashFiles` (Kittywhiskers Van Gogh) 1d8868b merge bitcoin#30451: remove Darwin ENV unsetting (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Depends on #6400 * ~~`WINEPREFIX` needs to be overridden because of permissions issues with GitHub Actions ([build](https://github.com/kwvg/dash/actions/runs/11952384181/job/33318706080#step:8:3297))~~ Superseded by [dash#6563](#6563) * [bitcoin#30451](bitcoin#30451) will enable `ccache` to work with macOS cross-compilation builds (i.e. they will no longer be registered as uncacheable). * After merging in [dash#6564](#6564), existing caches resulted in across-the-board build failures ([build](https://github.com/dashpay/dash/actions/runs/13290871849/job/37113644102#step:7:2768), [build](https://github.com/dashpay/dash/actions/runs/13290791962/job/37113418275#step:7:2940), [build](https://github.com/dashpay/dash/actions/runs/13289932901/job/37109498600#step:7:2177)) due to differing compiler versions (GCC 13 build on GCC 11 based cache) and differing glibc versions (2.39 build vs 2.35 cache) due to the change from `jammy` (on which the caches were built) to `noble` (the new base image for CI). To prevent this from occurring in the future, we will add CI's [`Dockerfile`](https://github.com/dashpay/dash/blob/265d9b5f9f5af07ff9da3d6fcc318b783d18caea/contrib/containers/ci/Dockerfile) to the `hashFiles()` used to generate the root of the cache key to ensure that the cache is discarded if it is modified. * `runner.os` doesn't help us as it tells us what platform the _runner_ is on and is independent from what the base image in the container is using, we only care about the latter. * The SDKs were cached separately because * The sources cache is shared between variants and the fastest runner (usually a Linux runner) will set the cache and as the download and extraction of the macOS SDK is only done when expected to target macOS, the cache associated with the shared key will not have the requisite SDKs. Then when that cache key is used to pull the sources cache by the macOS build, it will succeed due to a cache hit and then fail building because the compiler cannot locate the SDK. * The build cache is expected to have a higher churn rate as it is tied to the platform, which will trigger more than necessary downloads of the SDK. * If placed here, the cache would need to be re-evaluated if the version of Xcode has been bumped, which involves modifying `depends/hosts/darwin.mk`. Meaning, that file needs to be included when computing `hashFiles()`. But this also would result in unnecessary cache misses for all the platforms that _aren't_ macOS (because the structure of the build key is the same among all variants). ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 106500c PastaPastaPasta: utACK 106500c; gonna do CI on my repo, and push an empty commit and ensure caches are working as expected Tree-SHA512: b51608d8791a0d87b6d43388d4173e31123fd62fc3ae346907102504a454133e7b862bf3be784a3610ebd2b816b2aaab8c1d4a2f33a4400cc6cf7bce380e9adf
2 parents 2484cda + 106500c commit 843a00d

File tree

7 files changed

+77
-20
lines changed

7 files changed

+77
-20
lines changed

.github/workflows/build-depends.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,37 @@ jobs:
5151
depends/sources
5252
key: depends-sources-${{ hashFiles('depends/packages/*') }}
5353
restore-keys: |
54-
depends-sources-${{ hashFiles('depends/packages/*') }}
5554
depends-sources-
5655
56+
- name: Cache SDKs
57+
uses: actions/cache@v4
58+
if: inputs.build-target == 'mac'
59+
with:
60+
path: |
61+
depends/SDKs
62+
key: depends-sdks-${{ hashFiles('depends/hosts/darwin.mk') }}
63+
restore-keys: |
64+
depends-sdks-
65+
5766
- name: Restore cached depends
5867
uses: actions/cache/restore@v4
5968
id: restore
6069
with:
6170
path: |
6271
depends/built
6372
depends/${{ steps.setup.outputs.HOST }}
64-
key: ${{ runner.os }}-depends-${{ inputs.build-target }}-${{ steps.setup.outputs.DEP_HASH }}-${{ hashFiles('depends/packages/*') }}
73+
key: depends-${{ hashFiles('contrib/containers/ci/Dockerfile') }}-${{ inputs.build-target }}-${{ steps.setup.outputs.DEP_HASH }}-${{ hashFiles('depends/packages/*') }}
6574
restore-keys: |
66-
${{ runner.os }}-depends-${{ inputs.build-target }}-${{ hashFiles('depends/packages/*') }}
67-
${{ runner.os }}-depends-${{ inputs.build-target }}
75+
depends-${{ hashFiles('contrib/containers/ci/Dockerfile') }}-${{ inputs.build-target }}-${{ steps.setup.outputs.DEP_HASH }}-
76+
depends-${{ hashFiles('contrib/containers/ci/Dockerfile') }}-${{ inputs.build-target }}-
6877
6978
- name: Build depends
70-
run: env ${{ steps.setup.outputs.DEP_OPTS }} HOST=${{ steps.setup.outputs.HOST }} make -j$(nproc) -C depends
79+
run: |
80+
export HOST="${{ steps.setup.outputs.HOST }}"
81+
if [ "${HOST}" = "x86_64-apple-darwin" ]; then
82+
./contrib/containers/guix/scripts/setup-sdk
83+
fi
84+
env ${{ steps.setup.outputs.DEP_OPTS }} make -j$(nproc) -C depends
7185
7286
- name: Save depends cache
7387
uses: actions/cache/save@v4

.github/workflows/build-src.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ jobs:
4444
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT
4545
shell: bash
4646

47+
- name: Restore SDKs cache
48+
uses: actions/cache/restore@v4
49+
if: inputs.build-target == 'mac'
50+
with:
51+
path: |
52+
depends/SDKs
53+
key: depends-sdks-${{ hashFiles('depends/hosts/darwin.mk') }}
54+
fail-on-cache-miss: true
55+
4756
- name: Restore depends cache
4857
uses: actions/cache/restore@v4
4958
with:
@@ -58,11 +67,9 @@ jobs:
5867
with:
5968
path: |
6069
/cache
61-
key: ${{ runner.os }}-${{ inputs.build-target }}-${{ github.sha }}
70+
key: ccache-${{ hashFiles('contrib/containers/ci/Dockerfile', 'depends/packages/*') }}-${{ inputs.build-target }}-${{ github.sha }}
6271
restore-keys: |
63-
${{ runner.os }}-${{ inputs.build-target }}-${{ github.sha }}
64-
${{ runner.os }}-${{ inputs.build-target }}-${{ steps.setup.outputs.HOST }}
65-
${{ runner.os }}-${{ inputs.build-target }}
72+
ccache-${{ hashFiles('contrib/containers/ci/Dockerfile', 'depends/packages/*') }}-${{ inputs.build-target }}-
6673
6774
- name: Build source and run unit tests
6875
run: |

.github/workflows/build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ jobs:
4949
build-target: linux64_nowallet
5050
container-path: ${{ needs.container.outputs.path }}
5151

52+
depends-mac:
53+
name: x86_64-apple-darwin
54+
uses: ./.github/workflows/build-depends.yml
55+
needs: [container]
56+
with:
57+
build-target: mac
58+
container-path: ${{ needs.container.outputs.path }}
59+
5260
depends-win64:
5361
name: x86_64-w64-mingw32
5462
uses: ./.github/workflows/build-depends.yml
@@ -129,6 +137,15 @@ jobs:
129137
container-path: ${{ needs.container.outputs.path }}
130138
depends-key: ${{ needs.depends-linux64.outputs.key }}
131139

140+
src-mac:
141+
name: mac-build
142+
uses: ./.github/workflows/build-src.yml
143+
needs: [container, depends-mac]
144+
with:
145+
build-target: mac
146+
container-path: ${{ needs.container.outputs.path }}
147+
depends-key: ${{ needs.depends-mac.outputs.key }}
148+
132149
src-win64:
133150
name: win64-build
134151
uses: ./.github/workflows/build-src.yml

contrib/guix/libexec/build.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,9 @@ unset OBJCPLUS_INCLUDE_PATH
7373

7474
export C_INCLUDE_PATH="${NATIVE_GCC}/include"
7575
export CPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
76-
export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include"
77-
export OBJCPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
7876

7977
case "$HOST" in
80-
*darwin*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;;
78+
*darwin*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;; # Required for qt/qmake
8179
*mingw*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;;
8280
*)
8381
NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)"
@@ -182,6 +180,14 @@ make -C depends --jobs="$JOBS" HOST="$HOST" \
182180
x86_64_linux_NM=x86_64-linux-gnu-gcc-nm \
183181
x86_64_linux_STRIP=x86_64-linux-gnu-strip
184182

183+
case "$HOST" in
184+
*darwin*)
185+
# Unset now that Qt is built
186+
unset C_INCLUDE_PATH
187+
unset CPLUS_INCLUDE_PATH
188+
unset LIBRARY_PATH
189+
;;
190+
esac
185191

186192
###########################
187193
# Source Tarball Building #

depends/hosts/darwin.mk

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,11 @@ darwin_STRIP=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-strip")
5050
# Disable adhoc codesigning (for now) when using LLVM tooling, to avoid
5151
# non-determinism issues with the Identifier field.
5252

53-
darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
54-
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
55-
-u LIBRARY_PATH \
56-
$(clang_prog) --target=$(host) \
53+
darwin_CC=$(clang_prog) --target=$(host) \
5754
-isysroot$(OSX_SDK) -nostdlibinc \
5855
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
5956

60-
darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
61-
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
62-
-u LIBRARY_PATH \
63-
$(clangxx_prog) --target=$(host) \
57+
darwin_CXX=$(clangxx_prog) --target=$(host) \
6458
-isysroot$(OSX_SDK) -nostdlibinc \
6559
-iwithsysroot/usr/include/c++/v1 \
6660
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks

depends/packages/qt.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ $(package)_patches += memory_resource.patch
2424
$(package)_patches += clang_18_libpng.patch
2525
$(package)_patches += utc_from_string_no_optimize.patch
2626
$(package)_patches += windows_lto.patch
27+
$(package)_patches += darwin_no_libm.patch
2728
$(package)_patches += zlib-timebits64.patch
2829

2930
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
@@ -256,6 +257,7 @@ define $(package)_preprocess_cmds
256257
patch -p1 -i $($(package)_patch_dir)/utc_from_string_no_optimize.patch && \
257258
patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
258259
patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \
260+
patch -p1 -i $($(package)_patch_dir)/darwin_no_libm.patch && \
259261
patch -p1 -i $($(package)_patch_dir)/zlib-timebits64.patch && \
260262
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
261263
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
build: remove explicit -lm link from qttools
2+
3+
This causes issues with at least the macOS cross build, and shouldn't
4+
actually be required anywhere else. GCC with libstdc++ will already get libm.
5+
6+
--- a/qtbase/src/corelib/tools/tools.pri
7+
+++ b/qtbase/src/corelib/tools/tools.pri
8+
@@ -111,9 +111,6 @@ qtConfig(easingcurve) {
9+
tools/qtimeline.cpp
10+
}
11+
12+
-# Note: libm should be present by default becaue this is C++
13+
-unix:!macx-icc:!vxworks:!haiku:!integrity:!wasm: LIBS_PRIVATE += -lm
14+
-
15+
TR_EXCLUDE += ../3rdparty/*
16+
17+
# MIPS DSP

0 commit comments

Comments
 (0)