Skip to content

Commit

Permalink
build(ci): Update pyvelox workflow and add new manylinux docker image (
Browse files Browse the repository at this point in the history
…#12516)

Summary:
Building only linux wheel for one python version and sdist for now so we can test publishing credentials.
Fixes #9014

Follow up issues:
- #12524
- #12525
- #12526

Pull Request resolved: #12516

Reviewed By: kgpai

Differential Revision: D70644047

Pulled By: Yuhta

fbshipit-source-id: 58208787d9e8c068bde9d7294911e606c6c72fa7
  • Loading branch information
assignUser authored and facebook-github-bot committed Mar 5, 2025
1 parent 15b3743 commit eb90f29
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 27 deletions.
42 changes: 16 additions & 26 deletions .github/workflows/build_pyvelox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@ concurrency:
cancel-in-progress: true

jobs:
# TODO: https://github.com/facebookincubator/velox/issues/9014
if: false
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
os: [8-core-ubuntu]
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -92,6 +90,7 @@ jobs:
- run: mkdir -p ccache
- name: "Restore ccache"
if: false
uses: actions/cache/restore@v3
id: restore-cache
with:
Expand All @@ -101,57 +100,48 @@ jobs:
ccache-wheels-${{ matrix.os }}-
- name: Install macOS dependencies
if: matrix.os == 'macos-11'
if: startsWith(matrix.os, 'macos')
run: |
echo "OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1/" >> $GITHUB_ENV
bash scripts/setup-macos.sh &&
bash scripts/setup-macos.sh install_folly
export INSTALL_PREFIX="$GITHUB_WORKSPACE/dependencies"
echo "CMAKE_PREFIX_PATH=$INSTALL_PREFIX" >> $GITHUB_ENV
bash scripts/setup-macos.sh
- name: "Create sdist"
if: matrix.os == 'ubuntu-22.04'
if: matrix.os == '8-core-ubuntu'
env:
BUILD_VERSION: "${{ inputs.version || steps.version.outputs.build_version }}"
run: |
python setup.py sdist --dist-dir wheelhouse
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
uses: pypa/cibuildwheel@v2.23.0
env:
# required for preadv/pwritev
MACOSX_DEPLOYMENT_TARGET: "11.0"
CIBW_ARCHS: "x86_64"
# On PRs only build for Python 3.7
CIBW_BUILD: ${{ github.event_name == 'pull_request' && 'cp37-*' || 'cp3*' }}
# Only build for 3.12 for now
CIBW_BUILD: ${{ github.event_name == 'pull_request' && 'cp312-*' || 'cp312-*' }}
CIBW_SKIP: "*musllinux* cp36-*"
CIBW_MANYLINUX_X86_64_IMAGE: "ghcr.io/facebookincubator/velox-dev:torcharrow-avx"
CIBW_BEFORE_ALL_LINUX: >
mkdir -p /output &&
cp -R /host${{ github.workspace }}/ccache /output/ccache &&
ccache -s
CIBW_ENVIRONMENT_PASS_LINUX: CCACHE_DIR BUILD_VERSION
CIBW_MANYLINUX_X86_64_IMAGE: "ghcr.io/facebookincubator/velox-dev:pyvelox"
CIBW_ENVIRONMENT_PASS_LINUX: "CCACHE_DIR BUILD_VERSION CMAKE_PREFIX_PATH"
CIBW_TEST_EXTRAS: "tests"
CIBW_TEST_COMMAND: "cd {project}/pyvelox && python -m unittest -v"
CIBW_TEST_SKIP: "*macos*"
CCACHE_DIR: "${{ matrix.os != 'macos-11' && '/output' || github.workspace }}/ccache"
CIBW_TEST_SKIP: "*"
# CCACHE_DIR: "${{ matrix.os != 'macos-11' && '/output' || github.workspace }}/ccache"
BUILD_VERSION: "${{ inputs.version || steps.version.outputs.build_version }}"
with:
output-dir: wheelhouse

- name: "Move ccache to workspace"
if: matrix.os != 'macos-11'
run: |
mkdir -p ccache
cp -R ./wheelhouse/ccache/* ccache
- name: "Save ccache"
if: false
uses: actions/cache/save@v3
id: cache
with:
path: "ccache"
key: ccache-wheels-${{ matrix.os }}-${{ github.sha }}

- name: "Rename wheel compatibility tag"
if: matrix.os == 'macos-11'
if: startsWith(matrix.os, 'macos')
run: |
brew install rename
cd wheelhouse
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
- name: Centos 9
file: "scripts/centos.dockerfile"
tags: "ghcr.io/facebookincubator/velox-dev:centos9"
- name: Pyvelox
file: "scripts/pyvelox.dockerfile"
tags: "ghcr.io/facebookincubator/velox-dev:pyvelox"
- name: Dev
file: "scripts/ubuntu-22.04-cpp.dockerfile"
args: ""
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ if(${VELOX_BUILD_PYTHON_PACKAGE})
set(VELOX_ENABLE_AGGREGATES ON)
set(VELOX_ENABLE_SPARK_FUNCTIONS ON)
set(VELOX_BUILD_RUNNER OFF)
set(VELOX_BUILD_TEST_UTILS ON) # required for velox_exec_test_lib
endif()

if(${VELOX_ENABLE_DUCKDB})
Expand Down
34 changes: 34 additions & 0 deletions scripts/pyvelox.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed 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.
# Build the test and build container for presto_cpp
FROM quay.io/pypa/manylinux_2_28_x86_64:latest

COPY scripts/setup-helper-functions.sh /
COPY scripts/setup-manylinux.sh /

# Build static folly to reduce wheel size (folly.so is ~120M)
ENV VELOX_BUILD_SHARED=OFF
# The removal of the build dir has to happen in the same layer as the build
# to minimize the image size. gh & jq are required for CI
RUN mkdir build && ( cd build && bash /setup-manylinux.sh ) && rm -rf build && \
dnf install -y -q 'dnf-command(config-manager)' && \
dnf config-manager --add-repo 'https://cli.github.com/packages/rpm/gh-cli.repo' && \
dnf install -y -q gh jq && \
dnf clean all

ENV CC=/opt/rh/gcc-toolset-12/root/bin/gcc \
CXX=/opt/rh/gcc-toolset-12/root/bin/g++

ENTRYPOINT ["/bin/bash", "-c", "source /opt/rh/gcc-toolset-12/enable && exec \"$@\"", "--"]
CMD ["/bin/bash"]
1 change: 0 additions & 1 deletion scripts/setup-helper-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ function cmake_install {
cmake -Wno-dev ${CMAKE_OPTIONS} -B"${BINARY_DIR}" \
-GNinja \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_CXX_STANDARD=17 \
"${INSTALL_PREFIX+-DCMAKE_PREFIX_PATH=}${INSTALL_PREFIX-}" \
"${INSTALL_PREFIX+-DCMAKE_INSTALL_PREFIX=}${INSTALL_PREFIX-}" \
-DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" \
Expand Down
Loading

0 comments on commit eb90f29

Please sign in to comment.