diff --git a/.github/workflows/linux-wheel-builder.yml b/.github/workflows/linux-wheel-builder.yml index 4826eb7..6728118 100644 --- a/.github/workflows/linux-wheel-builder.yml +++ b/.github/workflows/linux-wheel-builder.yml @@ -1,10 +1,6 @@ name: linux-wheel-builder -on: - pull_request: - push: - schedule: - - cron: "0 7 * * *" # Run once daily +on: [pull_request, push] permissions: contents: read # to fetch code (actions/checkout) @@ -30,12 +26,14 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'true' - - uses: mamba-org/provision-with-micromamba@v14 + - uses: mamba-org/setup-micromamba@v1.8.1 with: + micromamba-version: '1.5.6-0' cache-downloads: true - cache-env: true + cache-environment: true environment-name: dev environment-file: ops/conda_env/dev.yml + init-shell: bash - name: Display Conda env run: | conda info diff --git a/.github/workflows/macos-wheel-builder.yml b/.github/workflows/macos-wheel-builder.yml index d6e29a5..637563e 100644 --- a/.github/workflows/macos-wheel-builder.yml +++ b/.github/workflows/macos-wheel-builder.yml @@ -1,10 +1,6 @@ name: macos-wheel-builder -on: - pull_request: - push: - schedule: - - cron: "0 7 * * *" # Run once daily +on: [pull_request, push] permissions: contents: read # to fetch code (actions/checkout) diff --git a/.github/workflows/misc-tests.yml b/.github/workflows/misc-tests.yml index 203c55d..ec2fc3a 100644 --- a/.github/workflows/misc-tests.yml +++ b/.github/workflows/misc-tests.yml @@ -1,10 +1,6 @@ name: misc-tests -on: - pull_request: - push: - schedule: - - cron: "0 7 * * *" # Run once daily +on: [pull_request, push] permissions: contents: read # to fetch code (actions/checkout) diff --git a/.github/workflows/windows-wheel-builder.yml b/.github/workflows/windows-wheel-builder.yml index 30620e9..df37237 100644 --- a/.github/workflows/windows-wheel-builder.yml +++ b/.github/workflows/windows-wheel-builder.yml @@ -1,10 +1,6 @@ name: windows-wheel-builder -on: - pull_request: - push: - schedule: - - cron: "0 7 * * *" # Run once daily +on: [push, pull_request] permissions: contents: read # to fetch code (actions/checkout) diff --git a/cmake/ExternalLibs.cmake b/cmake/ExternalLibs.cmake index fffa2af..5d9c4eb 100644 --- a/cmake/ExternalLibs.cmake +++ b/cmake/ExternalLibs.cmake @@ -1,7 +1,8 @@ include(FetchContent) # Treelite -find_package(Treelite 4.1.1) +set(TREELITE_VERSION 4.1.2) +find_package(Treelite ${TREELITE_VERSION}) if (Treelite_FOUND) set(TREELITE_FROM_SYSTEM_ROOT TRUE) set(TREELITE_LIB treelite::treelite) @@ -10,7 +11,7 @@ else () FetchContent_Declare( treelite GIT_REPOSITORY https://github.com/dmlc/treelite.git - GIT_TAG 4.1.1 + GIT_TAG ${TREELITE_VERSION} ) set(Treelite_BUILD_STATIC_LIBS ON) FetchContent_MakeAvailable(treelite) diff --git a/ops/build-linux.sh b/ops/build-linux.sh index 46c3990..271494c 100755 --- a/ops/build-linux.sh +++ b/ops/build-linux.sh @@ -4,12 +4,13 @@ set -euo pipefail TAG=manylinux2014_x86_64 -echo "##[section]Building TL2cgen..." -ops/docker/ci_build.sh cpu ops/scripts/build_via_cmake.sh +export CIBW_BUILD=cp38-manylinux_x86_64 +export CIBW_ARCHS=x86_64 +export CIBW_BUILD_VERBOSITY=3 +export CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014 -echo "##[section]Packaging Python wheel for TL2cgen..." -ops/docker/ci_build.sh cpu bash -c "cd python/ && pip wheel --no-deps -v . --wheel-dir dist/" -ops/docker/ci_build.sh auditwheel_x86_64 auditwheel repair --only-plat --plat ${TAG} python/dist/*.whl -rm -v python/dist/*.whl +echo "##[section]Building Python wheel (amd64) for Treelite..." +python -m cibuildwheel python --output-dir wheelhouse +python ops/scripts/rename_whl.py wheelhouse ${COMMIT_ID} ${TAG} +mkdir -vp python/dist/ mv -v wheelhouse/*.whl python/dist/ -ops/docker/ci_build.sh cpu python ops/scripts/rename_whl.py python/dist ${COMMIT_ID} ${TAG} diff --git a/ops/conda_env/dev.yml b/ops/conda_env/dev.yml index ab54c3d..98ae062 100644 --- a/ops/conda_env/dev.yml +++ b/ops/conda_env/dev.yml @@ -25,3 +25,5 @@ dependencies: - pip - python-build - treelite=4.1.1 +- pip: + - cibuildwheel diff --git a/ops/docker/Dockerfile.auditwheel_x86_64 b/ops/docker/Dockerfile.auditwheel_x86_64 deleted file mode 100644 index 6c21501..0000000 --- a/ops/docker/Dockerfile.auditwheel_x86_64 +++ /dev/null @@ -1,15 +0,0 @@ -FROM quay.io/pypa/manylinux2014_x86_64 - -# Install lightweight sudo (not bound to TTY) -ENV GOSU_VERSION 1.10 -RUN set -ex; \ - curl -o /usr/local/bin/gosu -L "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \ - chmod +x /usr/local/bin/gosu && \ - gosu nobody true - -# Default entry-point to use if running locally -# It will preserve attributes of created files -COPY entrypoint.sh /scripts/ - -WORKDIR /workspace -ENTRYPOINT ["/scripts/entrypoint.sh"] diff --git a/ops/docker/Dockerfile.cpu b/ops/docker/Dockerfile.cpu deleted file mode 100644 index 8e0eec2..0000000 --- a/ops/docker/Dockerfile.cpu +++ /dev/null @@ -1,39 +0,0 @@ -FROM centos:7 -LABEL maintainer "DMLC" - -# Install all basic requirements -RUN \ - yum install -y epel-release centos-release-scl && \ - yum-config-manager --enable centos-sclo-rh-testing && \ - yum -y update && \ - yum install -y tar unzip wget xz git yum-utils which ninja-build devtoolset-8-gcc devtoolset-8-binutils devtoolset-8-gcc-c++ && \ - # Python - wget -nv -O conda.sh https://github.com/conda-forge/miniforge/releases/download/23.1.0-1/Mambaforge-23.1.0-1-Linux-x86_64.sh && \ - bash conda.sh -b -p /opt/python && \ - # CMake - wget -nv https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.sh --no-check-certificate && \ - bash cmake-3.16.0-Linux-x86_64.sh --skip-license --prefix=/usr - -ENV PATH=/opt/python/bin:$PATH -ENV CC=/opt/rh/devtoolset-8/root/usr/bin/gcc -ENV CXX=/opt/rh/devtoolset-8/root/usr/bin/c++ -ENV CPP=/opt/rh/devtoolset-8/root/usr/bin/cpp - -# Install Python packages -RUN \ - mamba install -y -c conda-forge python=3.10 numpy pytest scipy scikit-learn wheel pandas pip - -ENV GOSU_VERSION 1.10 - -# Install lightweight sudo (not bound to TTY) -RUN set -ex; \ - wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \ - chmod +x /usr/local/bin/gosu && \ - gosu nobody true - -# Default entry-point to use if running locally -# It will preserve attributes of created files -COPY entrypoint.sh /scripts/ - -WORKDIR /workspace -ENTRYPOINT ["/scripts/entrypoint.sh"] diff --git a/ops/docker/ci_build.sh b/ops/docker/ci_build.sh deleted file mode 100755 index c3367b9..0000000 --- a/ops/docker/ci_build.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env bash -# -# Execute command within a docker container -# -# Usage: ci_build.sh [--dockerfile ] [-it] -# -# -# CONTAINER_TYPE: Type of the docker container used the run the build: e.g., -# (cpu | gpu) -# -# DOCKERFILE_PATH: (Optional) Path to the Dockerfile used for docker build. If -# this optional value is not supplied (via the --dockerfile -# flag), will use Dockerfile.CONTAINER_TYPE in default -# -# COMMAND: Command to be executed in the docker container -# -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -# Get the command line arguments. -CONTAINER_TYPE=$( echo "$1" | tr '[:upper:]' '[:lower:]' ) -shift 1 - -# Dockerfile to be used in docker build -DOCKERFILE_PATH="${SCRIPT_DIR}/Dockerfile.${CONTAINER_TYPE}" -DOCKER_CONTEXT_PATH="${SCRIPT_DIR}" - -if [[ "$1" == "--dockerfile" ]]; then - DOCKERFILE_PATH="$2" - DOCKER_CONTEXT_PATH=$(dirname "${DOCKERFILE_PATH}") - echo "Using custom Dockerfile path: ${DOCKERFILE_PATH}" - echo "Using custom docker build context path: ${DOCKER_CONTEXT_PATH}" - shift 2 -fi - -if [[ "$1" == "-it" ]]; then - CI_DOCKER_EXTRA_PARAMS+=('-it') - shift 1 -fi - -if [[ "$1" == "--build-arg" ]]; then - CI_DOCKER_BUILD_ARG+="$1" - CI_DOCKER_BUILD_ARG+=" $2" - shift 2 -fi - -if [[ ! -f "${DOCKERFILE_PATH}" ]]; then - echo "Invalid Dockerfile path: \"${DOCKERFILE_PATH}\"" - exit 1 -fi - -COMMAND=("$@") - -# Validate command line arguments. -if [ "$#" -lt 1 ] || [ ! -e "${SCRIPT_DIR}/Dockerfile.${CONTAINER_TYPE}" ]; then - supported_container_types=$( ls -1 ${SCRIPT_DIR}/Dockerfile.* | \ - sed -n 's/.*Dockerfile\.\([^\/]*\)/\1/p' | tr '\n' ' ' ) - echo "Usage: $(basename $0) CONTAINER_TYPE COMMAND" - echo " CONTAINER_TYPE can be one of [${supported_container_types}]" - echo " COMMAND is a command (with arguments) to run inside" - echo " the container." - exit 1 -fi - -# Use nvidia-docker if the container is GPU. -if [[ "${CONTAINER_TYPE}" == *"gpu"* ]]; then - DOCKER_BINARY="nvidia-docker" -else - DOCKER_BINARY="docker" -fi - -# Helper function to traverse directories up until given file is found. -function upsearch () { - test / == "$PWD" && return || \ - test -e "$1" && echo "$PWD" && return || \ - cd .. && upsearch "$1" -} - -# Set up WORKSPACE. Jenkins will set them for you or we pick -# reasonable defaults if you run it outside of Jenkins. -WORKSPACE="${WORKSPACE:-${SCRIPT_DIR}/../../}" - -# Determine the docker image name -DOCKER_IMG_NAME="tl2cgen-build.${CONTAINER_TYPE}" - -# Append cuda version if available -CUDA_VERSION=$(echo "${CI_DOCKER_BUILD_ARG}" | grep CUDA_VERSION | egrep -o '[0-9]*\.[0-9]*') -DOCKER_IMG_NAME=$DOCKER_IMG_NAME$CUDA_VERSION - -# Under Jenkins matrix build, the build tag may contain characters such as -# commas (,) and equal signs (=), which are not valid inside docker image names. -DOCKER_IMG_NAME=$(echo "${DOCKER_IMG_NAME}" | sed -e 's/=/_/g' -e 's/,/-/g') - -# Convert to all lower-case, as per requirement of Docker image names -DOCKER_IMG_NAME=$(echo "${DOCKER_IMG_NAME}" | tr '[:upper:]' '[:lower:]') - -# Bash on Ubuntu on Windows -UBUNTU_ON_WINDOWS=$([ -e /proc/version ] && grep -l Microsoft /proc/version || echo "") -# MSYS, Git Bash, etc. -MSYS=$([ -e /proc/version ] && grep -l MINGW /proc/version || echo "") - -if [[ -z "$UBUNTU_ON_WINDOWS" ]] && [[ -z "$MSYS" ]] && [[ ! "$OSTYPE" == "darwin"* ]]; then - USER_IDS="-e CI_BUILD_UID=$( id -u ) -e CI_BUILD_GID=$( id -g ) -e CI_BUILD_USER=$( id -un ) -e CI_BUILD_GROUP=$( id -gn ) -e CI_BUILD_HOME=${WORKSPACE}" -fi - -# Print arguments. -cat <=4.1.1" + "treelite>=4.1.2" ] [project.urls]