From 0f8f18236cdc0124386652f50aa5f973e3016d6b Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 12 Apr 2024 14:15:07 +0900 Subject: [PATCH] GH-41124: [CI][C++] Don't use CMake 3.29.1 with vcpkg (#41151) ### Rationale for this change vcpkg doesn't work with CMake 3.29.1. See also: https://github.com/microsoft/vcpkg/issues/37968 ### What changes are included in this PR? Use CMake 3.29.0 temporary. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41124 Lead-authored-by: Sutou Kouhei Co-authored-by: Sutou Kouhei Co-authored-by: Jacob Wujciak-Jens Signed-off-by: Sutou Kouhei --- ci/scripts/install_cmake.sh | 29 ++++++++++++++++++++--- dev/tasks/macros.jinja | 6 +++-- dev/tasks/python-wheels/github.osx.yml | 8 +++++++ dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat | 3 ++- dev/tasks/vcpkg-tests/github.windows.yml | 23 ++++++++---------- 5 files changed, 50 insertions(+), 19 deletions(-) diff --git a/ci/scripts/install_cmake.sh b/ci/scripts/install_cmake.sh index 2f5e5d52051ed..7fdb06d90f02c 100755 --- a/ci/scripts/install_cmake.sh +++ b/ci/scripts/install_cmake.sh @@ -21,7 +21,10 @@ set -e declare -A archs archs=([amd64]=x86_64 - [arm64v8]=aarch64) + [arch64]=aarch64 + [arm64]=aarch64 + [arm64v8]=aarch64 + [x86_64]=x86_64) declare -A platforms platforms=([linux]=linux @@ -38,5 +41,25 @@ platform=${platforms[$2]} version=$3 prefix=$4 -url="https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-${arch}.tar.gz" -wget -q ${url} -O - | tar -xzf - --directory ${prefix} --strip-components=1 +mkdir -p ${prefix} +url="https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-" +case ${platform} in + macos) + url+="universal.tar.gz" + curl -L ${url} | tar -xzf - --directory ${prefix} --strip-components=1 + ln -s CMake.app/Contents/bin ${prefix}/bin + ;; + windows) + url+="${arch}.zip" + archive_name=$(basename ${url}) + curl -L -o ${archive_name} ${url} + unzip ${archive_name} + base_name=$(basename ${archive_name} .zip) + mv ${base_name}/* ${prefix} + rm -rf ${base_name} ${archive_name} + ;; + *) + url+="${arch}.tar.gz" + curl -L ${url} | tar -xzf - --directory ${prefix} --strip-components=1 + ;; +esac diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index f55a7f9481e56..1e819d3cf4556 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -59,7 +59,8 @@ env: {%- macro github_install_archery() -%} - name: Set up Python by actions/setup-python - if: runner.arch == 'X64' + if: | + !(runner.os == 'Linux' && runner.arch != 'X64') uses: actions/setup-python@v4 with: cache: 'pip' @@ -86,7 +87,8 @@ env: {%- macro github_upload_releases(pattern) -%} - name: Set up Python by actions/setup-python - if: runner.arch == 'X64' + if: | + !(runner.os == 'Linux' && runner.arch != 'X64') uses: actions/setup-python@v4 with: python-version: 3.12 diff --git a/dev/tasks/python-wheels/github.osx.yml b/dev/tasks/python-wheels/github.osx.yml index cf99c84c60bfd..ce9613545eb54 100644 --- a/dev/tasks/python-wheels/github.osx.yml +++ b/dev/tasks/python-wheels/github.osx.yml @@ -50,6 +50,14 @@ jobs: run: | brew list + # CMake 3.29.1 that is pre-installed on the macOS image has a problem. + # See also: https://github.com/microsoft/vcpkg/issues/37968 + - name: Install CMake 3.29.0 + shell: bash + run: | + arrow/ci/scripts/install_cmake.sh $(arch) macos 3.29.0 ${PWD}/local + echo "${PWD}/local/bin" >> $GITHUB_PATH + - name: Retrieve VCPKG version from arrow/.env run: | vcpkg_version=$(cat "arrow/.env" | grep "VCPKG" | cut -d "=" -f2 | tr -d '"') diff --git a/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat b/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat index 8f160ee7c4fd2..3b337bb175005 100644 --- a/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat +++ b/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat @@ -78,7 +78,8 @@ cmake --build . --target INSTALL --config Release || exit /B 1 @rem Test Arrow C++ library -ctest --output-on-failure ^ +ctest --build-config Release ^ + --output-on-failure ^ --parallel %NUMBER_OF_PROCESSORS% ^ --timeout 300 || exit /B 1 diff --git a/dev/tasks/vcpkg-tests/github.windows.yml b/dev/tasks/vcpkg-tests/github.windows.yml index 618c997c2527b..af12db595286f 100644 --- a/dev/tasks/vcpkg-tests/github.windows.yml +++ b/dev/tasks/vcpkg-tests/github.windows.yml @@ -15,14 +15,9 @@ # specific language governing permissions and limitations # under the License. -# NOTE: must set "Crossbow" as name to have the badge links working in the -# github comment reports! -name: Crossbow +{% import 'macros.jinja' as macros with context %} -on: - push: - branches: - - "*-github-*" +{{ macros.github_header() }} jobs: test-vcpkg-win: @@ -31,12 +26,14 @@ jobs: env: VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' steps: - - name: Checkout Arrow + {{ macros.github_checkout_arrow()|indent }} + # CMake 3.29.1 that is pre-installed on the Windows image has a problem. + # See also: https://github.com/microsoft/vcpkg/issues/37968 + - name: Install CMake 3.29.0 + shell: bash run: | - git clone --no-checkout {{ arrow.remote }} arrow - git -C arrow fetch -t {{ arrow.remote }} {{ arrow.branch }} - git -C arrow checkout FETCH_HEAD - git -C arrow submodule update --init --recursive + arrow/ci/scripts/install_cmake.sh amd64 windows 3.29.0 /c/cmake + echo "c:\\cmake\\bin" >> $GITHUB_PATH - name: Download Timezone Database shell: bash run: arrow/ci/scripts/download_tz_database.sh @@ -59,7 +56,7 @@ jobs: CALL setx PATH "%PATH%;C:\vcpkg" - name: Setup NuGet Credentials shell: bash - env: + env: GITHUB_TOKEN: {{ '${{ secrets.GITHUB_TOKEN }}' }} run: | `vcpkg fetch nuget | tail -n 1` \