From 4b4ff444dd68308e8938a1e5c33e0c8b9390d1da Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 1 Oct 2024 13:20:09 +0200 Subject: [PATCH] GHA/macos: Sequoia chores, fixes for llvm 18 - add `macos-15` Sequoia to combinations jobs. - add `llvm@18` to combinations jobs for `macos-15`. - fix cmake, autotools configurations for llvm 18. It requires `CMAKE_OSX_SYSROOT` for cmake, and `--sysroot` within `CC` for both cmake and autotools. (Also add `--target` to `CC` for all jobs.) - stop `brew update` on `macos-12`. `macos-12` is Monterey. Homebrew stopped providing binaries for it after the latest macOS was out. It means newer versions of packages have to be built from source, which is slow and undesired. Try to avoid it using this trick. If it doesn't work, `macos-12` jobs will have to be dropped. - update Xcode support matrix. Ref: https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md Closes #15108 --- .github/workflows/macos.yml | 60 +++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a07d6f25b3..d25292afb9 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -173,7 +173,12 @@ jobs: - name: 'configure' run: | - [[ '${{ matrix.compiler }}' = 'llvm'* ]] && CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang" + if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then + CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang" + CC+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" + CC+=" --target=$(uname -m)-apple-darwin" + options+=" --target=$(uname -m)-apple-darwin" + fi CFLAGS+=' ${{ matrix.cflags }}' if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then libgccdir="$(dirname "$("${CC}" -print-libgcc-file-name)")" @@ -185,10 +190,6 @@ jobs: fi done fi - if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then - options+=" --target=$(uname -m)-apple-darwin" - CC+=" --target=$(uname -m)-apple-darwin" - fi if [ '${{ matrix.compiler }}' != 'clang' ]; then options+=" --with-sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" CFLAGS+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" @@ -332,7 +333,11 @@ jobs: - name: 'cmake configure' run: | - [[ '${{ matrix.compiler }}' = 'llvm'* ]] && CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang" + if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then + CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang" + CC+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" + CC+=" --target=$(uname -m)-apple-darwin" + fi if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then libgccdir="$(dirname "$("${CC}" -print-libgcc-file-name)")" echo '::group::gcc include-fixed details'; find "${libgccdir}/include-fixed" | sort; echo '::endgroup::' @@ -345,6 +350,7 @@ jobs: fi cmake -B bld -G Ninja -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \ -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.build.macos-version-min }} \ + "-DCMAKE_OSX_SYSROOT=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" \ "-DCMAKE_C_COMPILER_TARGET=$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \ ${{ matrix.build.generate }} @@ -419,17 +425,18 @@ jobs: fail-fast: false matrix: config: [SecureTransport] # also: OpenSSL - compiler: [gcc-12, gcc-13, gcc-14, llvm@15, clang] + compiler: [gcc-12, gcc-13, gcc-14, llvm@15, llvm@18, clang] # Xcode support matrix as of 2024-07, with default macOS SDK versions and OS names, years: # * = default Xcode on the runner. # macos-12: 13.1, 13.2.1, 13.3.1, 13.4.1, 14.0.1, 14.1,*14.2 # macos-13: 14.1, 14.2, 14.3.1,*15.0.1, 15.1, 15.2 # macos-14: 14.3.1, 15.0.1, 15.1, 15.2, 15.3,*15.4, 16.0 - # macOSSDK: 12.0, 12.1, 12.3, 12.3, 12.3, 13.0, 13.1, 13.3, 14.0, 14.2, 14.2, 14.4, 14.5, 15.0 + # macos-15: *16.0, 16.1 + # macOSSDK: 12.0, 12.1, 12.3, 12.3, 12.3, 13.0, 13.1, 13.3, 14.0, 14.2, 14.2, 14.4, 14.5, 15.0, 15.1 # Monterey (2021) Ventura (2022) Sonoma (2023) Sequoia (2024) # https://github.com/actions/runner-images/tree/main/images/macos # https://en.wikipedia.org/wiki/MacOS_version_history - image: [macos-12, macos-13, macos-14] + image: [macos-12, macos-13, macos-14, macos-15] # Can skip these to reduce jobs: # 13.1, 13.2.1 are fairly old. # 13.3.1, 14.0.1 have the same default macOS SDK as 13.4.1 and identical test results. @@ -465,6 +472,23 @@ jobs: - { image: macos-14, xcode: '14.0.1' } - { image: macos-14, xcode: '14.1' } - { image: macos-14, xcode: '14.2' } + - { image: macos-15, xcode: '13.1' } + - { image: macos-15, xcode: '13.2.1' } + - { image: macos-15, xcode: '13.3.1' } + - { image: macos-15, xcode: '13.4.1' } + - { image: macos-15, xcode: '14.0.1' } + - { image: macos-15, xcode: '14.1' } + - { image: macos-15, xcode: '14.2' } + - { image: macos-15, xcode: '14.3.1' } + - { image: macos-15, xcode: '15.0.1' } + - { image: macos-15, xcode: '15.1' } + - { image: macos-15, xcode: '15.2' } + - { image: macos-15, xcode: '15.3' } + - { image: macos-15, xcode: '15.4' } + - { image: macos-12, compiler: 'llvm@18' } + - { image: macos-13, compiler: 'llvm@18' } + - { image: macos-14, compiler: 'llvm@18' } + - { image: macos-15, compiler: 'llvm@15' } # Reduce build combinations, by dropping less interesting ones - { compiler: gcc-12, config: SecureTransport } - { compiler: gcc-13, build: cmake } @@ -475,7 +499,13 @@ jobs: if: ${{ matrix.build == 'autotools' }} run: | echo automake libtool | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile - while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done + while [[ $? == 0 ]]; do + for i in 1 2 3; do + [ '${{ matrix.image }}' != 'macos-12' ] && brew update # To avoid triggering updates needing build from source + brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } + done + false Too many retries + done - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4 @@ -497,7 +527,11 @@ jobs: - name: 'configure / ${{ matrix.build }}' run: | - [[ '${{ matrix.compiler }}' = 'llvm'* ]] && CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang" + if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then + CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang" + CC+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" + CC+=" --target=$(uname -m)-apple-darwin" + fi # gcc ships with an `include-fixed` header set, which overrides SDK # headers with the intent of making them compatible with gcc. The @@ -598,7 +632,6 @@ jobs: export CFLAGS if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then options+=" --target=$(uname -m)-apple-darwin" - CC+=" --target=$(uname -m)-apple-darwin" fi if [ '${{ matrix.compiler }}' != 'clang' ]; then options+=" --with-sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" @@ -620,8 +653,9 @@ jobs: # would pick up nghttp2, libidn2, and libssh2 cmake -B bld -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \ -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.macos-version-min }} \ - "-DCMAKE_IGNORE_PREFIX_PATH=$(brew --prefix)" \ + "-DCMAKE_OSX_SYSROOT=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" \ "-DCMAKE_C_COMPILER_TARGET=$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \ + "-DCMAKE_IGNORE_PREFIX_PATH=$(brew --prefix)" \ -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF \ -DUSE_NGHTTP2=OFF -DUSE_LIBIDN2=OFF \ -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF \ -- 2.47.2