diff --git a/ci/scripts/install_vcpkg.sh b/ci/scripts/install_vcpkg.sh new file mode 100755 index 00000000000..fe99a7fea2f --- /dev/null +++ b/ci/scripts/install_vcpkg.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e + +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +vcpkg_version=$1 +vcpkg_destination=$2 +vcpkg_patch=$(realpath $(dirname "${0}")/../vcpkg/ports.patch) + +git clone --depth 1 --branch ${vcpkg_version} https://github.com/microsoft/vcpkg ${vcpkg_destination} + +pushd ${vcpkg_destination} + +./bootstrap-vcpkg.sh -useSystemBinaries -disableMetrics +git apply --ignore-whitespace ${vcpkg_patch} +echo "Patch successfully applied!" + +popd diff --git a/dev/tasks/python-wheels/github.osx.yml b/dev/tasks/python-wheels/github.osx.yml index 84b094b84d1..a2e5c0af21b 100644 --- a/dev/tasks/python-wheels/github.osx.yml +++ b/dev/tasks/python-wheels/github.osx.yml @@ -30,7 +30,7 @@ env: VCPKG_DEFAULT_TRIPLET: x64-osx-static-release VCPKG_FEATURE_FLAGS: "-manifests" VCPKG_OVERLAY_TRIPLETS: {{ "${{ github.workspace }}/arrow/ci/vcpkg" }} - ARROW_VCPKG_PATCH_FILE: {{ "${{ github.workspace }}/arrow/ci/vcpkg/ports.patch" }} + VCPKG_ROOT: {{ "${{ github.workspace }}/vcpkg" }} jobs: build: @@ -40,34 +40,20 @@ jobs: {{ macros.github_checkout_arrow()|indent }} - name: Install System Dependencies - run: brew install bison ninja - - # Restore from cache the previously built ports. - # If cache-miss, download and build vcpkg (aka "bootstrap vcpkg"). - - name: Restore from Cache and Install Vcpkg - # Download and build vcpkg, without installing any port. - # If content is cached already, it is a no-op. - uses: kszucs/run-vcpkg@main + run: brew install bison coreutils ninja cmake + + - uses: actions/cache@v2 + id: vcpkg-cache with: - # Required to prevent cache eviction on crossbow's main branch - # where we build pre-build the vcpkg packages - setupOnly: true - doNotSaveCache: true - appendedCacheKey: "-macos-{{ macos_deployment_target }}-2021-06-25" - vcpkgDirectory: {{ "${{ github.workspace }}/vcpkg" }} - vcpkgGitCommitId: "2021.04.30" - - - name: Patch Vcpkg Ports - run: | - set -ex - cd $VCPKG_ROOT - if ! git apply --reverse --check --ignore-whitespace ${ARROW_VCPKG_PATCH_FILE}; then - git apply --ignore-whitespace ${ARROW_VCPKG_PATCH_FILE} - echo "Patch successfully applied!" - fi - - # Now that vcpkg is installed, it is being used to run with the desired arguments. - - name: Install Vcpkg Dependencies + path: vcpkg + key: vcpkg-{{ macos_deployment_target }}-{{ vcpkg_version }}-{{ "${{ hashFiles('arrow/ci/vcpkg/**') }}" }} + + - name: Install Vcpkg + if: steps.vcpkg-cache.outputs.cache-hit != 'true' + shell: bash + run: arrow/ci/scripts/install_vcpkg.sh $VCPKG_VERSION $VCPKG_ROOT + + - name: Install Packages run: | $VCPKG_ROOT/vcpkg install \ abseil \ @@ -94,9 +80,7 @@ jobs: {% if arrow_s3 == "ON" %} - name: Install AWS SDK C++ - run: | - $VCPKG_ROOT/vcpkg install \ - aws-sdk-cpp[config,cognito-identity,core,identity-management,s3,sts,transfer] + run: $VCPKG_ROOT/vcpkg install aws-sdk-cpp[config,cognito-identity,core,identity-management,s3,sts,transfer] {% endif %} - name: Setup Multibuild diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml index 34307bb2583..963e7dadc26 100644 --- a/dev/tasks/tasks.yml +++ b/dev/tasks/tasks.yml @@ -359,6 +359,7 @@ tasks: ci: github template: python-wheels/github.osx.yml params: + vcpkg_version: "2021.04.30" python_version: {{ python_version }} macos_deployment_target: {{ macos_version }} arrow_s3: {{ arrow_s3 }}